diff --git a/Libs/AceAddon-3.0/AceAddon-3.0.lua b/Libs/AceAddon-3.0/AceAddon-3.0.lua index 70369317..b338695f 100644 --- a/Libs/AceAddon-3.0/AceAddon-3.0.lua +++ b/Libs/AceAddon-3.0/AceAddon-3.0.lua @@ -28,9 +28,9 @@ -- end -- @class file -- @name AceAddon-3.0.lua --- @release $Id: AceAddon-3.0.lua 1036 2011-08-16 22:45:05Z nevcairiel $ +-- @release $Id: AceAddon-3.0.lua 1084 2013-04-27 20:14:11Z nevcairiel $ -local MAJOR, MINOR = "AceAddon-3.0", 11 +local MAJOR, MINOR = "AceAddon-3.0", 12 local AceAddon, oldminor = LibStub:NewLibrary(MAJOR, MINOR) if not AceAddon then return end -- No Upgrade needed. @@ -108,6 +108,16 @@ local Enable, Disable, EnableModule, DisableModule, Embed, NewModule, GetModule, -- used in the addon metatable local function addontostring( self ) return self.name end +-- Check if the addon is queued for initialization +local function queuedForInitialization(addon) + for i = 1, #AceAddon.initializequeue do + if AceAddon.initializequeue[i] == addon then + return true + end + end + return false +end + --- Create a new AceAddon-3.0 addon. -- Any libraries you specified will be embeded, and the addon will be scheduled for -- its OnInitialize and OnEnable callbacks. @@ -314,7 +324,12 @@ end -- MyModule:Enable() function Enable(self) self:SetEnabledState(true) - return AceAddon:EnableAddon(self) + + -- nevcairiel 2013-04-27: don't enable an addon/module if its queued for init still + -- it'll be enabled after the init process + if not queuedForInitialization(self) then + return AceAddon:EnableAddon(self) + end end --- Disables the Addon, if possible, return true or false depending on success. diff --git a/Libs/AceComm-3.0/AceComm-3.0.lua b/Libs/AceComm-3.0/AceComm-3.0.lua index b4763a33..17411ba4 100644 --- a/Libs/AceComm-3.0/AceComm-3.0.lua +++ b/Libs/AceComm-3.0/AceComm-3.0.lua @@ -9,7 +9,7 @@ -- make into AceComm. -- @class file -- @name AceComm-3.0 --- @release $Id: AceComm-3.0.lua 1019 2011-03-27 12:08:33Z mikk $ +-- @release $Id: AceComm-3.0.lua 1107 2014-02-19 16:40:32Z nevcairiel $ --[[ AceComm-3.0 @@ -17,7 +17,7 @@ TODO: Time out old data rotting around from dead senders? Not a HUGE deal since ]] -local MAJOR, MINOR = "AceComm-3.0", 7 +local MAJOR, MINOR = "AceComm-3.0", 9 local AceComm,oldminor = LibStub:NewLibrary(MAJOR, MINOR) @@ -33,6 +33,9 @@ local match = string.match local tinsert, tconcat = table.insert, table.concat local error, assert = error, assert +-- WoW APIs +local Ambiguate = Ambiguate + -- Global vars/functions that we don't upvalue since they might get hooked, or upgraded -- List them here for Mikk's FindGlobals script -- GLOBALS: LibStub, DEFAULT_CHAT_FRAME, geterrorhandler, RegisterAddonMessagePrefix @@ -45,15 +48,10 @@ local MSG_MULTI_NEXT = "\002" local MSG_MULTI_LAST = "\003" local MSG_ESCAPE = "\004" -if not RegisterAddonMessagePrefix then - AceComm.multipart_origprefixes = AceComm.multipart_origprefixes or {} -- e.g. "Prefix\001"="Prefix", "Prefix\002"="Prefix" - AceComm.multipart_reassemblers = AceComm.multipart_reassemblers or {} -- e.g. "Prefix\001"="OnReceiveMultipartFirst" -else - AceComm.multipart_origprefixes = nil - AceComm.multipart_reassemblers = nil -end +-- remove old structures (pre WoW 4.0) +AceComm.multipart_origprefixes = nil +AceComm.multipart_reassemblers = nil - -- the multipart message spool: indexed by a combination of sender+distribution+ AceComm.multipart_spool = AceComm.multipart_spool or {} @@ -65,12 +63,11 @@ function AceComm:RegisterComm(prefix, method) method = "OnCommReceived" end - if RegisterAddonMessagePrefix then - if #prefix>16 then -- TODO: 15? - error("AceComm:RegisterComm(prefix,method): prefix length is limited to 16 characters") - end - RegisterAddonMessagePrefix(prefix) + if #prefix > 16 then -- TODO: 15? + error("AceComm:RegisterComm(prefix,method): prefix length is limited to 16 characters") end + RegisterAddonMessagePrefix(prefix) + return AceComm._RegisterComm(self, prefix, method) -- created by CallbackHandler end @@ -94,26 +91,9 @@ function AceComm:SendCommMessage(prefix, text, distribution, target, prio, callb ) then error('Usage: SendCommMessage(addon, "prefix", "text", "distribution"[, "target"[, "prio"[, callbackFn, callbackarg]]])', 2) end - - if not RegisterAddonMessagePrefix then - if strfind(prefix, "[\001-\009]") then - if strfind(prefix, "[\001-\003]") then - error("SendCommMessage: Characters \\001--\\003 in prefix are reserved for AceComm metadata", 2) - elseif not warnedPrefix then - -- I have some ideas about future extensions that require more control characters /mikk, 20090808 - geterrorhandler()("SendCommMessage: Heads-up developers: Characters \\004--\\009 in prefix are reserved for AceComm future extension") - warnedPrefix = true - end - end - end local textlen = #text - local maxtextlen; - if not RegisterAddonMessagePrefix then - maxtextlen = 254 - #prefix -- 254 is the max length of prefix + text that can be sent in one message (there's an internal separator char) - else - maxtextlen = 255 -- Yes, the max is 255 even if the dev post said 256. I tested. Char 256+ get silently truncated. /Mikk, 20110327 - end + local maxtextlen = 255 -- Yes, the max is 255 even if the dev post said 256. I tested. Char 256+ get silently truncated. /Mikk, 20110327 local queueName = prefix..distribution..(target or "") local ctlCallback = nil @@ -124,7 +104,7 @@ function AceComm:SendCommMessage(prefix, text, distribution, target, prio, callb end local forceMultipart - if RegisterAddonMessagePrefix and match(text, "^[\001-\009]") then -- 4.1+: see if the first character is a control character + if match(text, "^[\001-\009]") then -- 4.1+: see if the first character is a control character -- we need to escape the first character with a \004 if textlen+1 > maxtextlen then -- would we go over the size limit? forceMultipart = true -- just make it multipart, no escape problems then @@ -141,32 +121,20 @@ function AceComm:SendCommMessage(prefix, text, distribution, target, prio, callb -- first part local chunk = strsub(text, 1, maxtextlen) - if not RegisterAddonMessagePrefix then - CTL:SendAddonMessage(prio, prefix..MSG_MULTI_FIRST, chunk, distribution, target, queueName, ctlCallback, maxtextlen) - else - CTL:SendAddonMessage(prio, prefix, MSG_MULTI_FIRST..chunk, distribution, target, queueName, ctlCallback, maxtextlen) - end + CTL:SendAddonMessage(prio, prefix, MSG_MULTI_FIRST..chunk, distribution, target, queueName, ctlCallback, maxtextlen) -- continuation local pos = 1+maxtextlen while pos+maxtextlen <= textlen do chunk = strsub(text, pos, pos+maxtextlen-1) - if not RegisterAddonMessagePrefix then - CTL:SendAddonMessage(prio, prefix..MSG_MULTI_NEXT, chunk, distribution, target, queueName, ctlCallback, pos+maxtextlen-1) - else - CTL:SendAddonMessage(prio, prefix, MSG_MULTI_NEXT..chunk, distribution, target, queueName, ctlCallback, pos+maxtextlen-1) - end + CTL:SendAddonMessage(prio, prefix, MSG_MULTI_NEXT..chunk, distribution, target, queueName, ctlCallback, pos+maxtextlen-1) pos = pos + maxtextlen end -- final part chunk = strsub(text, pos) - if not RegisterAddonMessagePrefix then - CTL:SendAddonMessage(prio, prefix..MSG_MULTI_LAST, chunk, distribution, target, queueName, ctlCallback, textlen) - else - CTL:SendAddonMessage(prio, prefix, MSG_MULTI_LAST..chunk, distribution, target, queueName, ctlCallback, textlen) - end + CTL:SendAddonMessage(prio, prefix, MSG_MULTI_LAST..chunk, distribution, target, queueName, ctlCallback, textlen) end end @@ -269,80 +237,32 @@ if not AceComm.callbacks then "UnregisterAllComm") end -local OnEvent +AceComm.callbacks.OnUsed = nil +AceComm.callbacks.OnUnused = nil -if not RegisterAddonMessagePrefix then -- 4.0: per-prefix callbacks per part type - - function AceComm.callbacks:OnUsed(target, prefix) - AceComm.multipart_origprefixes[prefix..MSG_MULTI_FIRST] = prefix - AceComm.multipart_reassemblers[prefix..MSG_MULTI_FIRST] = "OnReceiveMultipartFirst" - - AceComm.multipart_origprefixes[prefix..MSG_MULTI_NEXT] = prefix - AceComm.multipart_reassemblers[prefix..MSG_MULTI_NEXT] = "OnReceiveMultipartNext" - - AceComm.multipart_origprefixes[prefix..MSG_MULTI_LAST] = prefix - AceComm.multipart_reassemblers[prefix..MSG_MULTI_LAST] = "OnReceiveMultipartLast" - end - - function AceComm.callbacks:OnUnused(target, prefix) - AceComm.multipart_origprefixes[prefix..MSG_MULTI_FIRST] = nil - AceComm.multipart_reassemblers[prefix..MSG_MULTI_FIRST] = nil - - AceComm.multipart_origprefixes[prefix..MSG_MULTI_NEXT] = nil - AceComm.multipart_reassemblers[prefix..MSG_MULTI_NEXT] = nil - - AceComm.multipart_origprefixes[prefix..MSG_MULTI_LAST] = nil - AceComm.multipart_reassemblers[prefix..MSG_MULTI_LAST] = nil - end - - function OnEvent(this, event, ...) - if event == "CHAT_MSG_ADDON" then - local prefix,message,distribution,sender = ... - local reassemblername = AceComm.multipart_reassemblers[prefix] - if reassemblername then - -- multipart: reassemble - local aceCommReassemblerFunc = AceComm[reassemblername] - local origprefix = AceComm.multipart_origprefixes[prefix] - aceCommReassemblerFunc(AceComm, origprefix, message, distribution, sender) +local function OnEvent(self, event, prefix, message, distribution, sender) + if event == "CHAT_MSG_ADDON" then + sender = Ambiguate(sender, "none") + local control, rest = match(message, "^([\001-\009])(.*)") + if control then + if control==MSG_MULTI_FIRST then + AceComm:OnReceiveMultipartFirst(prefix, rest, distribution, sender) + elseif control==MSG_MULTI_NEXT then + AceComm:OnReceiveMultipartNext(prefix, rest, distribution, sender) + elseif control==MSG_MULTI_LAST then + AceComm:OnReceiveMultipartLast(prefix, rest, distribution, sender) + elseif control==MSG_ESCAPE then + AceComm.callbacks:Fire(prefix, rest, distribution, sender) else - -- single part: fire it off immediately and let CallbackHandler decide if it's registered or not - AceComm.callbacks:Fire(prefix, message, distribution, sender) + -- unknown control character, ignore SILENTLY (dont warn unnecessarily about future extensions!) end else - assert(false, "Received "..tostring(event).." event?!") + -- single part: fire it off immediately and let CallbackHandler decide if it's registered or not + AceComm.callbacks:Fire(prefix, message, distribution, sender) end + else + assert(false, "Received "..tostring(event).." event?!") end - -else -- 4.1+: only one prefix for all - - AceComm.callbacks.OnUsed = nil - AceComm.callbacks.OnUnused = nil - - function OnEvent(this, event, ...) - if event == "CHAT_MSG_ADDON" then - local prefix,message,distribution,sender = ... - local control, rest = match(message, "^([\001-\009])(.*)") - if control then - if control==MSG_MULTI_FIRST then - AceComm:OnReceiveMultipartFirst(prefix, rest, distribution, sender) - elseif control==MSG_MULTI_NEXT then - AceComm:OnReceiveMultipartNext(prefix, rest, distribution, sender) - elseif control==MSG_MULTI_LAST then - AceComm:OnReceiveMultipartLast(prefix, rest, distribution, sender) - elseif control==MSG_ESCAPE then - AceComm.callbacks:Fire(prefix, rest, distribution, sender) - else - -- unknown control character, ignore SILENTLY (dont warn unnecessarily about future extensions!) - end - else - -- single part: fire it off immediately and let CallbackHandler decide if it's registered or not - AceComm.callbacks:Fire(prefix, message, distribution, sender) - end - else - assert(false, "Received "..tostring(event).." event?!") - end - end - end AceComm.frame = AceComm.frame or CreateFrame("Frame", "AceComm30Frame") diff --git a/Libs/AceTimer-3.0/AceTimer-3.0.lua b/Libs/AceTimer-3.0/AceTimer-3.0.lua index 62f6ee36..8092d3b1 100644 --- a/Libs/AceTimer-3.0/AceTimer-3.0.lua +++ b/Libs/AceTimer-3.0/AceTimer-3.0.lua @@ -1,296 +1,138 @@ --- **AceTimer-3.0** provides a central facility for registering timers. -- AceTimer supports one-shot timers and repeating timers. All timers are stored in an efficient --- data structure that allows easy dispatching and fast rescheduling. Timers can be registered, rescheduled +-- data structure that allows easy dispatching and fast rescheduling. Timers can be registered -- or canceled at any time, even from within a running timer, without conflict or large overhead.\\ --- AceTimer is currently limited to firing timers at a frequency of 0.1s. This constant may change --- in the future, but for now it seemed like a good compromise in efficiency and accuracy. +-- AceTimer is currently limited to firing timers at a frequency of 0.01s. This constant may change +-- in the future, but for now it's required as animations with lower frequencies are buggy. -- -- All `:Schedule` functions will return a handle to the current timer, which you will need to store if you --- need to cancel or reschedule the timer you just registered. +-- need to cancel the timer you just registered. -- --- **AceTimer-3.0** can be embeded into your addon, either explicitly by calling AceTimer:Embed(MyAddon) or by +-- **AceTimer-3.0** can be embeded into your addon, either explicitly by calling AceTimer:Embed(MyAddon) or by -- specifying it as an embeded library in your AceAddon. All functions will be available on your addon object -- and can be accessed directly, without having to explicitly call AceTimer itself.\\ -- It is recommended to embed AceTimer, otherwise you'll have to specify a custom `self` on all calls you -- make into AceTimer. -- @class file -- @name AceTimer-3.0 --- @release $Id: AceTimer-3.0.lua 1037 2011-09-02 16:24:08Z mikk $ +-- @release $Id: AceTimer-3.0.lua 1079 2013-02-17 19:56:06Z funkydude $ ---[[ - Basic assumptions: - * In a typical system, we do more re-scheduling per second than there are timer pulses per second - * Regardless of timer implementation, we cannot guarantee timely delivery due to FPS restriction (may be as low as 10) - - This implementation: - CON: The smallest timer interval is constrained by HZ (currently 1/10s). - PRO: It will still correctly fire any timer slower than HZ over a length of time, e.g. 0.11s interval -> 90 times over 10 seconds - PRO: In lag bursts, the system simly skips missed timer intervals to decrease load - CON: Algorithms depending on a timer firing "N times per minute" will fail - PRO: (Re-)scheduling is O(1) with a VERY small constant. It's a simple linked list insertion in a hash bucket. - CAUTION: The BUCKETS constant constrains how many timers can be efficiently handled. With too many hash collisions, performance will decrease. - - Major assumptions upheld: - - ALLOWS scheduling multiple timers with the same funcref/method - - ALLOWS scheduling more timers during OnUpdate processing - - ALLOWS unscheduling ANY timer (including the current running one) at any time, including during OnUpdate processing -]] - -local MAJOR, MINOR = "AceTimer-3.0", 6 +local MAJOR, MINOR = "AceTimer-3.0", 16 -- Bump minor on changes local AceTimer, oldminor = LibStub:NewLibrary(MAJOR, MINOR) if not AceTimer then return end -- No upgrade needed -AceTimer.hash = AceTimer.hash or {} -- Array of [0..BUCKET-1] = linked list of timers (using .next member) - -- Linked list gets around ACE-88 and ACE-90. -AceTimer.selfs = AceTimer.selfs or {} -- Array of [self]={[handle]=timerobj, [handle2]=timerobj2, ...} -AceTimer.frame = AceTimer.frame or CreateFrame("Frame", "AceTimer30Frame") +AceTimer.frame = AceTimer.frame or CreateFrame("Frame", "AceTimer30Frame") -- Animation parent +AceTimer.inactiveTimers = AceTimer.inactiveTimers or {} -- Timer recycling storage +AceTimer.activeTimers = AceTimer.activeTimers or {} -- Active timer list -- Lua APIs -local assert, error, loadstring = assert, error, loadstring -local setmetatable, rawset, rawget = setmetatable, rawset, rawget -local select, pairs, type, next, tostring = select, pairs, type, next, tostring -local floor, max, min = math.floor, math.max, math.min -local tconcat = table.concat +local type, unpack, next, error, pairs, tostring, select = type, unpack, next, error, pairs, tostring, select --- WoW APIs -local GetTime = GetTime +-- Upvalue our private data +local inactiveTimers = AceTimer.inactiveTimers +local activeTimers = AceTimer.activeTimers --- Global vars/functions that we don't upvalue since they might get hooked, or upgraded --- List them here for Mikk's FindGlobals script --- GLOBALS: DEFAULT_CHAT_FRAME, geterrorhandler - --- Simple ONE-SHOT timer cache. Much more efficient than a full compost for our purposes. -local timerCache = nil - ---[[ - Timers will not be fired more often than HZ-1 times per second. - Keep at intended speed PLUS ONE or we get bitten by floating point rounding errors (n.5 + 0.1 can be n.599999) - If this is ever LOWERED, all existing timers need to be enforced to have a delay >= 1/HZ on lib upgrade. - If this number is ever changed, all entries need to be rehashed on lib upgrade. - ]] -local HZ = 11 - ---[[ - Prime for good distribution - If this number is ever changed, all entries need to be rehashed on lib upgrade. -]] -local BUCKETS = 131 - -local hash = AceTimer.hash -for i=1,BUCKETS do - hash[i] = hash[i] or false -- make it an integer-indexed array; it's faster than hashes -end - ---[[ - xpcall safecall implementation -]] -local xpcall = xpcall - -local function errorhandler(err) - return geterrorhandler()(err) -end - -local function CreateDispatcher(argCount) - local code = [[ - local xpcall, eh = ... -- our arguments are received as unnamed values in "..." since we don't have a proper function declaration - local method, ARGS - local function call() return method(ARGS) end - - local function dispatch(func, ...) - method = func - if not method then return end - ARGS = ... - return xpcall(call, eh) - end - - return dispatch - ]] - - local ARGS = {} - for i = 1, argCount do ARGS[i] = "arg"..i end - code = code:gsub("ARGS", tconcat(ARGS, ", ")) - return assert(loadstring(code, "safecall Dispatcher["..argCount.."]"))(xpcall, errorhandler) -end - -local Dispatchers = setmetatable({}, { - __index=function(self, argCount) - local dispatcher = CreateDispatcher(argCount) - rawset(self, argCount, dispatcher) - return dispatcher +local function OnFinished(self) + local id = self.id + if type(self.func) == "string" then + -- We manually set the unpack count to prevent issues with an arg set that contains nil and ends with nil + -- e.g. local t = {1, 2, nil, 3, nil} print(#t) will result in 2, instead of 5. This fixes said issue. + self.object[self.func](self.object, unpack(self.args, 1, self.argsCount)) + else + self.func(unpack(self.args, 1, self.argsCount)) + end + + -- If the id is different it means that the timer was already cancelled + -- and has been used to create a new timer during the OnFinished callback. + if not self.looping and id == self.id then + activeTimers[self.id] = nil + self.args = nil + inactiveTimers[self] = true end -}) -Dispatchers[0] = function(func) - return xpcall(func, errorhandler) -end - -local function safecall(func, ...) - return Dispatchers[select('#', ...)](func, ...) end -local lastint = floor(GetTime() * HZ) - --- -------------------------------------------------------------------- --- OnUpdate handler --- --- traverse buckets, always chasing "now", and fire timers that have expired - -local function OnUpdate() - local now = GetTime() - local nowint = floor(now * HZ) - - -- Have we passed into a new hash bucket? - if nowint == lastint then return end - - local soon = now + 1 -- +1 is safe as long as 1 < HZ < BUCKETS/2 - - -- Pass through each bucket at most once - -- Happens on e.g. instance loads, but COULD happen on high local load situations also - for curint = (max(lastint, nowint - BUCKETS) + 1), nowint do -- loop until we catch up with "now", usually only 1 iteration - local curbucket = (curint % BUCKETS)+1 - -- Yank the list of timers out of the bucket and empty it. This allows reinsertion in the currently-processed bucket from callbacks. - local nexttimer = hash[curbucket] - hash[curbucket] = false -- false rather than nil to prevent the array from becoming a hash - - while nexttimer do - local timer = nexttimer - nexttimer = timer.next - local when = timer.when - - if when < soon then - -- Call the timer func, either as a method on given object, or a straight function ref - local callback = timer.callback - if type(callback) == "string" then - safecall(timer.object[callback], timer.object, timer.arg) - elseif callback then - safecall(callback, timer.arg) - else - -- probably nilled out by CancelTimer - timer.delay = nil -- don't reschedule it - end - - local delay = timer.delay -- NOW make a local copy, can't do it earlier in case the timer cancelled itself in the callback - - if not delay then - -- single-shot timer (or cancelled) - AceTimer.selfs[timer.object][tostring(timer)] = nil - timerCache = timer - else - -- repeating timer - local newtime = when + delay - if newtime < now then -- Keep lag from making us firing a timer unnecessarily. (Note that this still won't catch too-short-delay timers though.) - newtime = now + delay - end - timer.when = newtime - - -- add next timer execution to the correct bucket - local bucket = (floor(newtime * HZ) % BUCKETS) + 1 - timer.next = hash[bucket] - hash[bucket] = timer - end - else -- if when>=soon - -- reinsert (yeah, somewhat expensive, but shouldn't be happening too often either due to hash distribution) - timer.next = hash[curbucket] - hash[curbucket] = timer - end -- if whenhandle->timer registry - local handle = tostring(timer) - - local selftimers = AceTimer.selfs[self] - if not selftimers then - selftimers = {} - AceTimer.selfs[self] = selftimers + local anim = timer:GetParent() + if loop then + anim:SetLooping("REPEAT") + else + anim:SetLooping("NONE") end - selftimers[handle] = timer - selftimers.__ops = (selftimers.__ops or 0) + 1 - - return handle + timer:SetDuration(delay) + + local id = tostring(timer.args) + timer.id = id + activeTimers[id] = timer + + anim:Play() + return id end --- Schedule a new one-shot timer. -- The timer will fire once in `delay` seconds, unless canceled before. -- @param callback Callback function for the timer pulse (funcref or method name). -- @param delay Delay for the timer, in seconds. --- @param arg An optional argument to be passed to the callback function. +-- @param ... An optional, unlimited amount of arguments to pass to the callback function. -- @usage --- MyAddon = LibStub("AceAddon-3.0"):NewAddon("TimerTest", "AceTimer-3.0") --- --- function MyAddon:OnEnable() +-- MyAddOn = LibStub("AceAddon-3.0"):NewAddon("MyAddOn", "AceTimer-3.0") +-- +-- function MyAddOn:OnEnable() -- self:ScheduleTimer("TimerFeedback", 5) -- end -- --- function MyAddon:TimerFeedback() +-- function MyAddOn:TimerFeedback() -- print("5 seconds passed") -- end -function AceTimer:ScheduleTimer(callback, delay, arg) - return Reg(self, callback, delay, arg) +function AceTimer:ScheduleTimer(func, delay, ...) + if not func or not delay then + error(MAJOR..": ScheduleTimer(callback, delay, args...): 'callback' and 'delay' must have set values.", 2) + end + if type(func) == "string" then + if type(self) ~= "table" then + error(MAJOR..": ScheduleTimer(callback, delay, args...): 'self' - must be a table.", 2) + elseif not self[func] then + error(MAJOR..": ScheduleTimer(callback, delay, args...): Tried to register '"..func.."' as the callback, but it doesn't exist in the module.", 2) + end + end + return new(self, nil, func, delay, ...) end --- Schedule a repeating timer. -- The timer will fire every `delay` seconds, until canceled. -- @param callback Callback function for the timer pulse (funcref or method name). -- @param delay Delay for the timer, in seconds. --- @param arg An optional argument to be passed to the callback function. +-- @param ... An optional, unlimited amount of arguments to pass to the callback function. -- @usage --- MyAddon = LibStub("AceAddon-3.0"):NewAddon("TimerTest", "AceTimer-3.0") --- --- function MyAddon:OnEnable() +-- MyAddOn = LibStub("AceAddon-3.0"):NewAddon("MyAddOn", "AceTimer-3.0") +-- +-- function MyAddOn:OnEnable() -- self.timerCount = 0 -- self.testTimer = self:ScheduleRepeatingTimer("TimerFeedback", 5) -- end -- --- function MyAddon:TimerFeedback() +-- function MyAddOn:TimerFeedback() -- self.timerCount = self.timerCount + 1 -- print(("%d seconds passed"):format(5 * self.timerCount)) -- -- run 30 seconds in total @@ -298,131 +140,106 @@ end -- self:CancelTimer(self.testTimer) -- end -- end -function AceTimer:ScheduleRepeatingTimer(callback, delay, arg) - return Reg(self, callback, delay, arg, true) +function AceTimer:ScheduleRepeatingTimer(func, delay, ...) + if not func or not delay then + error(MAJOR..": ScheduleRepeatingTimer(callback, delay, args...): 'callback' and 'delay' must have set values.", 2) + end + if type(func) == "string" then + if type(self) ~= "table" then + error(MAJOR..": ScheduleRepeatingTimer(callback, delay, args...): 'self' - must be a table.", 2) + elseif not self[func] then + error(MAJOR..": ScheduleRepeatingTimer(callback, delay, args...): Tried to register '"..func.."' as the callback, but it doesn't exist in the module.", 2) + end + end + return new(self, true, func, delay, ...) end ---- Cancels a timer with the given handle, registered by the same addon object as used for `:ScheduleTimer` --- Both one-shot and repeating timers can be canceled with this function, as long as the `handle` is valid +--- Cancels a timer with the given id, registered by the same addon object as used for `:ScheduleTimer` +-- Both one-shot and repeating timers can be canceled with this function, as long as the `id` is valid -- and the timer has not fired yet or was canceled before. --- @param handle The handle of the timer, as returned by `:ScheduleTimer` or `:ScheduleRepeatingTimer` --- @param silent If true, no error is raised if the timer handle is invalid (expired or already canceled) --- @return True if the timer was successfully cancelled. -function AceTimer:CancelTimer(handle, silent) - if not handle then return end -- nil handle -> bail out without erroring - if type(handle) ~= "string" then - error(MAJOR..": CancelTimer(handle): 'handle' - expected a string", 2) -- for now, anyway - end - local selftimers = AceTimer.selfs[self] - local timer = selftimers and selftimers[handle] - if silent then - if timer then - timer.callback = nil -- don't run it again - timer.delay = nil -- if this is the currently-executing one: don't even reschedule - -- The timer object is removed in the OnUpdate loop - end - return not not timer -- might return "true" even if we double-cancel. we'll live. - else - if not timer then - geterrorhandler()(MAJOR..": CancelTimer(handle[, silent]): '"..tostring(handle).."' - no such timer registered") - return false - end - if not timer.callback then - geterrorhandler()(MAJOR..": CancelTimer(handle[, silent]): '"..tostring(handle).."' - timer already cancelled or expired") - return false - end - timer.callback = nil -- don't run it again - timer.delay = nil -- if this is the currently-executing one: don't even reschedule - return true - end +-- @param id The id of the timer, as returned by `:ScheduleTimer` or `:ScheduleRepeatingTimer` +function AceTimer:CancelTimer(id) + local timer = activeTimers[id] + if not timer then return false end + + local anim = timer:GetParent() + anim:Stop() + + activeTimers[id] = nil + timer.args = nil + inactiveTimers[timer] = true + return true end --- Cancels all timers registered to the current addon object ('self') function AceTimer:CancelAllTimers() - if not(type(self) == "string" or type(self) == "table") then - error(MAJOR..": CancelAllTimers(): 'self' - must be a string or a table",2) - end - if self == AceTimer then - error(MAJOR..": CancelAllTimers(): supply a meaningful 'self'", 2) - end - - local selftimers = AceTimer.selfs[self] - if selftimers then - for handle,v in pairs(selftimers) do - if type(v) == "table" then -- avoid __ops, etc - AceTimer.CancelTimer(self, handle, true) - end + for k,v in pairs(activeTimers) do + if v.object == self then + AceTimer.CancelTimer(self, k) end end end ---- Returns the time left for a timer with the given handle, registered by the current addon object ('self'). --- This function will raise a warning when the handle is invalid, but not stop execution. --- @param handle The handle of the timer, as returned by `:ScheduleTimer` or `:ScheduleRepeatingTimer` --- @return The time left on the timer, or false if the handle is invalid. -function AceTimer:TimeLeft(handle) - if not handle then return end - if type(handle) ~= "string" then - error(MAJOR..": TimeLeft(handle): 'handle' - expected a string", 2) -- for now, anyway - end - local selftimers = AceTimer.selfs[self] - local timer = selftimers and selftimers[handle] - if not timer then - geterrorhandler()(MAJOR..": TimeLeft(handle): '"..tostring(handle).."' - no such timer registered") - return false - end - return timer.when - GetTime() +--- Returns the time left for a timer with the given id, registered by the current addon object ('self'). +-- This function will return 0 when the id is invalid. +-- @param id The id of the timer, as returned by `:ScheduleTimer` or `:ScheduleRepeatingTimer` +-- @return The time left on the timer. +function AceTimer:TimeLeft(id) + local timer = activeTimers[id] + if not timer then return 0 end + return timer:GetDuration() - timer:GetElapsed() end -- --------------------------------------------------------------------- --- PLAYER_REGEN_ENABLED: Run through our .selfs[] array step by step --- and clean it out - otherwise the table indices can grow indefinitely --- if an addon starts and stops a lot of timers. AceBucket does this! --- --- See ACE-94 and tests/AceTimer-3.0-ACE-94.lua +-- Upgrading -local lastCleaned = nil - -local function OnEvent(this, event) - if event~="PLAYER_REGEN_ENABLED" then - return - end - - -- Get the next 'self' to process - local selfs = AceTimer.selfs - local self = next(selfs, lastCleaned) - if not self then - self = next(selfs) - end - lastCleaned = self - if not self then -- should only happen if .selfs[] is empty - return - end - - -- Time to clean it out? - local list = selfs[self] - if (list.__ops or 0) < 250 then -- 250 slosh indices = ~10KB wasted (worst case!). For one 'self'. - return - end - - -- Create a new table and copy all members over - local newlist = {} - local n=0 - for k,v in pairs(list) do - newlist[k] = v - if type(v)=="table" and v.callback then -- if the timer is actually live: count it - n=n+1 +-- Upgrade from old hash-bucket based timers to animation timers +if oldminor and oldminor < 10 then + -- disable old timer logic + AceTimer.frame:SetScript("OnUpdate", nil) + AceTimer.frame:SetScript("OnEvent", nil) + AceTimer.frame:UnregisterAllEvents() + -- convert timers + for object,timers in pairs(AceTimer.selfs) do + for handle,timer in pairs(timers) do + if type(timer) == "table" and timer.callback then + local id + if timer.delay then + id = AceTimer.ScheduleRepeatingTimer(timer.object, timer.callback, timer.delay, timer.arg) + else + id = AceTimer.ScheduleTimer(timer.object, timer.callback, timer.when - GetTime(), timer.arg) + end + -- change id to the old handle + local t = activeTimers[id] + activeTimers[id] = nil + activeTimers[handle] = t + t.id = handle + end end end - newlist.__ops = 0 -- Reset operation count - - -- And since we now have a count of the number of live timers, check that it's reasonable. Emit a warning if not. - if n>BUCKETS then - DEFAULT_CHAT_FRAME:AddMessage(MAJOR..": Warning: The addon/module '"..tostring(self).."' has "..n.." live timers. Surely that's not intended?") + AceTimer.selfs = nil + AceTimer.hash = nil + AceTimer.debug = nil +elseif oldminor and oldminor < 13 then + for handle, id in pairs(AceTimer.hashCompatTable) do + local t = activeTimers[id] + if t then + activeTimers[id] = nil + activeTimers[handle] = t + t.id = handle + end end - - selfs[self] = newlist + AceTimer.hashCompatTable = nil +end + +-- upgrade existing timers to the latest OnFinished +for timer in pairs(inactiveTimers) do + timer:SetScript("OnFinished", OnFinished) +end + +for _,timer in pairs(activeTimers) do + timer:SetScript("OnFinished", OnFinished) end -- --------------------------------------------------------------------- @@ -431,7 +248,7 @@ end AceTimer.embeds = AceTimer.embeds or {} local mixins = { - "ScheduleTimer", "ScheduleRepeatingTimer", + "ScheduleTimer", "ScheduleRepeatingTimer", "CancelTimer", "CancelAllTimers", "TimeLeft" } @@ -444,32 +261,14 @@ function AceTimer:Embed(target) return target end --- AceTimer:OnEmbedDisable( target ) +-- AceTimer:OnEmbedDisable(target) -- target (object) - target object that AceTimer is embedded in. -- -- cancel all timers registered for the object -function AceTimer:OnEmbedDisable( target ) +function AceTimer:OnEmbedDisable(target) target:CancelAllTimers() end - for addon in pairs(AceTimer.embeds) do AceTimer:Embed(addon) end - --- --------------------------------------------------------------------- --- Debug tools (expose copies of internals to test suites) -AceTimer.debug = AceTimer.debug or {} -AceTimer.debug.HZ = HZ -AceTimer.debug.BUCKETS = BUCKETS - --- --------------------------------------------------------------------- --- Finishing touchups - -AceTimer.frame:SetScript("OnUpdate", OnUpdate) -AceTimer.frame:SetScript("OnEvent", OnEvent) -AceTimer.frame:RegisterEvent("PLAYER_REGEN_ENABLED") - --- In theory, we could hide&show the frame based on there being timers or not. --- However, this job is fairly expensive, and the chance that there will --- actually be zero timers running is diminuitive to say the least. diff --git a/Libs/NickTag-1.0/NickTag-1.0.lua b/Libs/NickTag-1.0/NickTag-1.0.lua index af101b17..875a4a97 100644 --- a/Libs/NickTag-1.0/NickTag-1.0.lua +++ b/Libs/NickTag-1.0/NickTag-1.0.lua @@ -35,9 +35,9 @@ end local CONST_COMM_LOGONREVISION = 2 local CONST_COMM_REQUESTPERSONA = 3 - NICKTAG_DEFAULT_AVATAR = [[Interface\EncounterJournal\UI-EJ-BOSS-Default]] - NICKTAG_DEFAULT_BACKGROUND = [[Interface\PetBattles\Weather-ArcaneStorm]] - NICKTAG_DEFAULT_BACKGROUND_CORDS = {0.129609375, 1, 1, 0} + --[[global]] NICKTAG_DEFAULT_AVATAR = [[Interface\EncounterJournal\UI-EJ-BOSS-Default]] + --[[global]] NICKTAG_DEFAULT_BACKGROUND = [[Interface\PetBattles\Weather-ArcaneStorm]] + --[[global]] NICKTAG_DEFAULT_BACKGROUND_CORDS = {0.129609375, 1, 1, 0} ------------------------------------------------------------------------------------------------------------------------------------------------------ --> library stuff diff --git a/boot.lua b/boot.lua index 9eeb5a29..acf7bd41 100644 --- a/boot.lua +++ b/boot.lua @@ -8,7 +8,7 @@ _ = nil _detalhes = LibStub("AceAddon-3.0"):NewAddon("_detalhes", "AceTimer-3.0", "AceComm-3.0", "AceSerializer-3.0", "NickTag-1.0", "LibHotCorners") - _detalhes.userversion = "v1.14.1" + _detalhes.userversion = "v1.14.5" _detalhes.version = "Alpha 018" _detalhes.realversion = 18 @@ -75,6 +75,9 @@ do _detalhes.RaidTables.Plugins = {} --> name to plugin object _detalhes.RaidTables.NameTable = {} + --> using by + _detalhes.RaidTables.InstancesInUse = {} + _detalhes.RaidTables.PluginsInUse = {} --> solo ------------------------------------------------------------------- --> general functions for solo mode plugins @@ -203,6 +206,8 @@ do SharedMedia:Register ("statusbar", "Details D'ictum (reverse)", [[Interface\AddOns\Details\images\bar4_reverse]]) SharedMedia:Register ("statusbar", "Details Serenity", [[Interface\AddOns\Details\images\bar_serenity]]) SharedMedia:Register ("background", "Details Ground", [[Interface\AddOns\Details\images\background]]) + SharedMedia:Register ("border", "Details BarBorder 1", [[Interface\AddOns\Details\images\border_1]]) + SharedMedia:Register ("border", "Details BarBorder 2", [[Interface\AddOns\Details\images\border_2]]) --> global 'vardump' for dump table contents over chat panel function vardump (t) diff --git a/classes/classe_damage.lua b/classes/classe_damage.lua index e32616a7..4bdffa84 100644 --- a/classes/classe_damage.lua +++ b/classes/classe_damage.lua @@ -1152,7 +1152,7 @@ function atributo_damage:AtualizaBarra (instancia, barras_container, qual_barra, local formated_dps = SelectedToKFunction (_, dps) if (UsingCustomRightText) then - esta_barra.texto_direita:SetText (instancia.row_info.textR_custom_text:ReplaceData (formated_damage, formated_dps, porcentagem)) + esta_barra.texto_direita:SetText (instancia.row_info.textR_custom_text:ReplaceData (formated_damage, formated_dps, porcentagem, self)) else esta_barra.texto_direita:SetText (formated_damage .. " (" .. formated_dps .. ", " .. porcentagem .. "%)") --seta o texto da direita end @@ -1165,7 +1165,7 @@ function atributo_damage:AtualizaBarra (instancia, barras_container, qual_barra, local formated_dps = SelectedToKFunction (_, dps) if (UsingCustomRightText) then - esta_barra.texto_direita:SetText (instancia.row_info.textR_custom_text:ReplaceData (formated_dps, formated_damage, porcentagem)) + esta_barra.texto_direita:SetText (instancia.row_info.textR_custom_text:ReplaceData (formated_dps, formated_damage, porcentagem, self)) else esta_barra.texto_direita:SetText (formated_dps .. " (" .. formated_damage .. ", " .. porcentagem .. "%)") --seta o texto da direita end @@ -1176,7 +1176,7 @@ function atributo_damage:AtualizaBarra (instancia, barras_container, qual_barra, local formated_damage_taken = SelectedToKFunction (_, self.damage_taken) if (UsingCustomRightText) then - esta_barra.texto_direita:SetText (instancia.row_info.textR_custom_text:ReplaceData (formated_damage_taken, "", porcentagem)) + esta_barra.texto_direita:SetText (instancia.row_info.textR_custom_text:ReplaceData (formated_damage_taken, "", porcentagem, self)) else esta_barra.texto_direita:SetText (formated_damage_taken .." (" .. porcentagem .. "%)") --seta o texto da direita -- end @@ -1187,7 +1187,7 @@ function atributo_damage:AtualizaBarra (instancia, barras_container, qual_barra, local formated_friendly_fire = SelectedToKFunction (_, self.friendlyfire_total) if (UsingCustomRightText) then - esta_barra.texto_direita:SetText (instancia.row_info.textR_custom_text:ReplaceData (formated_friendly_fire, "", porcentagem)) + esta_barra.texto_direita:SetText (instancia.row_info.textR_custom_text:ReplaceData (formated_friendly_fire, "", porcentagem, self)) else esta_barra.texto_direita:SetText (formated_friendly_fire .. " (" .. porcentagem .. "%)") --seta o texto da direita -- end @@ -1200,7 +1200,7 @@ function atributo_damage:AtualizaBarra (instancia, barras_container, qual_barra, local formated_dps = SelectedToKFunction (_, dps) if (UsingCustomRightText) then - esta_barra.texto_direita:SetText (instancia.row_info.textR_custom_text:ReplaceData (formated_damage, formated_dps, porcentagem)) + esta_barra.texto_direita:SetText (instancia.row_info.textR_custom_text:ReplaceData (formated_damage, formated_dps, porcentagem, self)) else esta_barra.texto_direita:SetText (formated_damage .. " (" .. formated_dps .. ", " .. porcentagem .. "%)") --seta o texto da direita end diff --git a/classes/classe_energy.lua b/classes/classe_energy.lua index 1e07bdd5..a3cea2ed 100644 --- a/classes/classe_energy.lua +++ b/classes/classe_energy.lua @@ -449,7 +449,7 @@ function atributo_energy:AtualizaBarra (instancia, barras_container, qual_barra, local formated_energy = SelectedToKFunction (_, esta_e_energy_total) if (UsingCustomRightText) then - esta_barra.texto_direita:SetText (instancia.row_info.textR_custom_text:ReplaceData (formated_energy, "", porcentagem)) + esta_barra.texto_direita:SetText (instancia.row_info.textR_custom_text:ReplaceData (formated_energy, "", porcentagem, self)) else esta_barra.texto_direita:SetText (formated_energy .. " (" .. porcentagem .. "%)") --seta o texto da direita end diff --git a/classes/classe_heal.lua b/classes/classe_heal.lua index 2c7d4e91..46386b53 100644 --- a/classes/classe_heal.lua +++ b/classes/classe_heal.lua @@ -574,7 +574,7 @@ function atributo_heal:AtualizaBarra (instancia, barras_container, qual_barra, l local formated_hps = SelectedToKFunction (_, hps) if (UsingCustomRightText) then - esta_barra.texto_direita:SetText (instancia.row_info.textR_custom_text:ReplaceData (formated_heal, formated_hps, porcentagem)) + esta_barra.texto_direita:SetText (instancia.row_info.textR_custom_text:ReplaceData (formated_heal, formated_hps, porcentagem, self)) else esta_barra.texto_direita:SetText (formated_heal .." (" .. formated_hps .. ", " .. porcentagem .. "%)") --seta o texto da direita end @@ -587,7 +587,7 @@ function atributo_heal:AtualizaBarra (instancia, barras_container, qual_barra, l local formated_hps = SelectedToKFunction (_, hps) if (UsingCustomRightText) then - esta_barra.texto_direita:SetText (instancia.row_info.textR_custom_text:ReplaceData (formated_hps, formated_heal, porcentagem)) + esta_barra.texto_direita:SetText (instancia.row_info.textR_custom_text:ReplaceData (formated_hps, formated_heal, porcentagem, self)) else esta_barra.texto_direita:SetText (formated_hps .. " (" .. formated_heal .. ", " .. porcentagem .. "%)") --seta o texto da direita end @@ -598,7 +598,7 @@ function atributo_heal:AtualizaBarra (instancia, barras_container, qual_barra, l local formated_overheal = SelectedToKFunction (_, self.totalover) if (UsingCustomRightText) then - esta_barra.texto_direita:SetText (instancia.row_info.textR_custom_text:ReplaceData (formated_overheal, "", porcentagem)) + esta_barra.texto_direita:SetText (instancia.row_info.textR_custom_text:ReplaceData (formated_overheal, "", porcentagem, self)) else esta_barra.texto_direita:SetText (formated_overheal .." (" .. porcentagem .. "%)") --seta o texto da direita --_cstr("%.1f", dps) .. " - ".. DPS do damage taken não será possivel correto? end @@ -609,7 +609,7 @@ function atributo_heal:AtualizaBarra (instancia, barras_container, qual_barra, l local formated_healtaken = SelectedToKFunction (_, self.healing_taken) if (UsingCustomRightText) then - esta_barra.texto_direita:SetText (instancia.row_info.textR_custom_text:ReplaceData (formated_healtaken, "", porcentagem)) + esta_barra.texto_direita:SetText (instancia.row_info.textR_custom_text:ReplaceData (formated_healtaken, "", porcentagem, self)) else esta_barra.texto_direita:SetText (formated_healtaken .. " (" .. porcentagem .. "%)") --seta o texto da direita --_cstr("%.1f", dps) .. " - ".. DPS do damage taken não será possivel correto? end @@ -620,7 +620,7 @@ function atributo_heal:AtualizaBarra (instancia, barras_container, qual_barra, l local formated_enemyheal = SelectedToKFunction (_, self.heal_enemy_amt) if (UsingCustomRightText) then - esta_barra.texto_direita:SetText (instancia.row_info.textR_custom_text:ReplaceData (formated_enemyheal, "", porcentagem)) + esta_barra.texto_direita:SetText (instancia.row_info.textR_custom_text:ReplaceData (formated_enemyheal, "", porcentagem, self)) else esta_barra.texto_direita:SetText (formated_enemyheal .. " (" .. porcentagem .. "%)") --seta o texto da direita --_cstr("%.1f", dps) .. " - ".. DPS do damage taken não será possivel correto? end @@ -631,7 +631,7 @@ function atributo_heal:AtualizaBarra (instancia, barras_container, qual_barra, l local formated_absorbs = SelectedToKFunction (_, self.totalabsorb) if (UsingCustomRightText) then - esta_barra.texto_direita:SetText (instancia.row_info.textR_custom_text:ReplaceData (formated_absorbs, "", porcentagem)) + esta_barra.texto_direita:SetText (instancia.row_info.textR_custom_text:ReplaceData (formated_absorbs, "", porcentagem, self)) else esta_barra.texto_direita:SetText (formated_absorbs .. " (" .. porcentagem .. "%)") --seta o texto da direita --_cstr("%.1f", dps) .. " - ".. DPS do damage taken não será possivel correto? end @@ -978,7 +978,7 @@ function atributo_heal:ToolTip_HealingDone (instancia, numero, barra, keydown) elseif (instancia.sub_atributo == 3) then --> overheal local overheal = ActorHealingTable[i][2] local total = ActorHealingTable[i][6] - GameCooltip:AddLine (ActorHealingTable[i][4][1] .." (|cFFFF3333" .. _math_floor ( (overheal / (overheal+total)) *100) .. "%|r):", FormatTooltipNumber (_, _math_floor (ActorHealingTable[i][5])).." (".._cstr ("%.1f", ActorHealingTable[i][3]).."%)") + GameCooltip:AddLine (ActorHealingTable[i][4][1] .." (|cFFFF3333" .. _math_floor ( (overheal / (overheal+total)) *100) .. "%|r):", FormatTooltipNumber (_, _math_floor (ActorHealingTable[i][2])).." (".._cstr ("%.1f", ActorHealingTable[i][3]).."%)") else GameCooltip:AddLine (ActorHealingTable[i][4][1]..": ", FormatTooltipNumber (_, ActorHealingTable[i][2]).." (".._cstr ("%.1f", ActorHealingTable[i][3]).."%)") end diff --git a/classes/classe_instancia.lua b/classes/classe_instancia.lua index 541f864d..9522a434 100644 --- a/classes/classe_instancia.lua +++ b/classes/classe_instancia.lua @@ -63,6 +63,9 @@ local segmentos = _detalhes.segmentos --> API: call a function to all enabled instances function _detalhes:InstanceCall (funcao, ...) + if (type (funcao) == "string") then + funcao = _detalhes [funcao] + end for index, instance in _ipairs (_detalhes.tabela_instancias) do if (instance:IsAtiva()) then --> only enabled funcao (instance, ...) @@ -151,11 +154,7 @@ function _detalhes:IsSoloMode() end function _detalhes:IsRaidMode() - if (not _detalhes.raid) then - return false - else - return _detalhes.raid == self:GetInstanceId() - end + return self.modo == _detalhes._detalhes_props["MODO_RAID"] end function _detalhes:IsNormalMode() @@ -212,8 +211,7 @@ end self:Desagrupar (-1) if (self.modo == modo_raid) then - _detalhes.RaidTables:switch() - _detalhes.raid = nil + _detalhes.RaidTables:DisableRaidMode (self) elseif (self.modo == modo_alone) then _detalhes.SoloTables:switch() @@ -332,7 +330,7 @@ end if (not temp) then if (self.modo == modo_raid) then - _detalhes:RaidMode (true, self) + _detalhes.RaidTables:EnableRaidMode (self) elseif (self.modo == modo_alone) then self:SoloMode (true) @@ -407,7 +405,7 @@ end end function _detalhes:CriarInstancia (_, id) - + if (id and _type (id) == "boolean") then if (#_detalhes.tabela_instancias >= _detalhes.instances_amount) then @@ -1520,15 +1518,7 @@ function _detalhes:TrocaTabela (instancia, segmento, atributo, sub_atributo, ini return _detalhes.SoloTables.switch (nil, nil, -1) elseif ( (instancia.modo == modo_raid) and not (_detalhes.initializing or iniciando_instancia) ) then --> raid - if (_detalhes.RaidTables.Mode == #_detalhes.RaidTables.Plugins) then - _detalhes.popup:Select (1, 1) - else - if (_detalhes.PluginCount.RAID > 0) then - _detalhes.popup:Select (1, _detalhes.RaidTables.Mode+1) - end - - end - return _detalhes.RaidTables.switch (nil, nil, -1) + return --nao faz nada quando clicar no botão end atributo_changed = true @@ -1620,18 +1610,67 @@ function _detalhes:TrocaTabela (instancia, segmento, atributo, sub_atributo, ini end -function _detalhes:MontaRaidOption (instancia) - for index, ptable in _ipairs (_detalhes.RaidTables.Menu) do - if (ptable [3].__enabled) then - GameCooltip:AddMenu (1, _detalhes.RaidTables.switch, index, nil, nil, ptable [1], ptable [2], true) +function _detalhes:GetRaidPluginName() + return self.current_raid_plugin or self.last_raid_plugin +end + +function _detalhes:GetInstanceAttributeText() + + if (self.modo == modo_grupo or self.modo == modo_all) then + local attribute = self.atributo + local sub_attribute = self.sub_atributo + local name = _detalhes:GetSubAttributeName (attribute, sub_attribute) + return name or "Unknown" + + elseif (self.modo == modo_raid) then + local plugin_name = self.current_raid_plugin or self.last_raid_plugin + if (plugin_name) then + local plugin_object = _detalhes:GetPlugin (plugin_name) + if (plugin_object) then + return plugin_object.__name + else + return "Unknown Plugin" + end + else + return "Unknown Plugin" + end + + elseif (self.modo == modo_alone) then + local atributo = _detalhes.SoloTables.Mode or 1 + local SoloInfo = _detalhes.SoloTables.Menu [atributo] + if (SoloInfo) then + return SoloInfo [1] + else + return "Unknown Plugin" end end - if (_detalhes.RaidTables.Mode and _detalhes.RaidTables.Mode == index) then - GameCooltip:SetLastSelected (1, _detalhes.RaidTables.Mode) +end + +function _detalhes:MontaRaidOption (instancia) + + local available_plugins = _detalhes.RaidTables:GetAvailablePlugins() + + if (#available_plugins == 0) then + return false end + local amount = 0 + for index, ptable in _ipairs (available_plugins) do + if (ptable [3].__enabled) then + GameCooltip:AddMenu (1, _detalhes.RaidTables.switch, ptable [4], instancia, nil, ptable [1], ptable [2], true) --PluginName, PluginIcon, PluginObject, PluginAbsoluteName + amount = amount + 1 + end + end + + if (amount == 0) then + return false + end + + GameCooltip:SetOption ("NoLastSelectedBar", true) + GameCooltip:SetWallpaper (1, [[Interface\SPELLBOOK\Spellbook-Page-1]], {.6, 0.1, 0, 0.64453125}, {1, 1, 1, 0.1}, true) + return true end function _detalhes:MontaSoloOption (instancia) @@ -1646,6 +1685,8 @@ function _detalhes:MontaSoloOption (instancia) end GameCooltip:SetWallpaper (1, [[Interface\SPELLBOOK\Spellbook-Page-1]], {.6, 0.1, 0, 0.64453125}, {1, 1, 1, 0.1}, true) + + return true end -- ~menu @@ -1742,6 +1783,8 @@ function _detalhes:ChangeIcon (icon) local skin = _detalhes.skins [self.skin] + --print (debugstack()) + if (icon) then --> plugin chamou uma troca de icone @@ -1824,11 +1867,11 @@ function _detalhes:AlteraModo (instancia, qual) if (not instancia.atributo) then instancia.atributo = 1 instancia.sub_atributo = 1 - print ("Details found a internal probleam and fixed: 'instancia.atributo' were null, now is 1.") + --print ("Details found a internal probleam and fixed: 'instancia.atributo' were null, now is 1.") end if (not instancia.showing[instancia.atributo]) then instancia.showing = _detalhes.tabela_vigente - print ("Details found a internal problem and fixed: container for instancia.showing were null, now is current combat.") + --print ("Details found a internal problem and fixed: container for instancia.showing were null, now is current combat.") end instancia.atributo = instancia.atributo or 1 instancia.showing[instancia.atributo].need_refresh = true @@ -1839,7 +1882,7 @@ function _detalhes:AlteraModo (instancia, qual) instancia.LastModo = instancia.modo if (instancia:IsRaidMode()) then - instancia:RaidMode (false, instancia) + _detalhes.RaidTables:DisableRaidMode (instancia) end --> verifica se ja tem alguma instancia desativada em solo e remove o solo dela @@ -1859,12 +1902,13 @@ function _detalhes:AlteraModo (instancia, qual) instancia:SoloMode (false) end - _detalhes:InstanciaCallFunctionOffline (_detalhes.InstanciaCheckForDisabledRaid) - + --_detalhes:InstanciaCallFunctionOffline (_detalhes.InstanciaCheckForDisabledRaid) + instancia.modo = modo_raid instancia:ChangeIcon() - _detalhes:RaidMode (true, instancia) + _detalhes.RaidTables:EnableRaidMode (instancia) + _detalhes:SendEvent ("DETAILS_INSTANCE_CHANGEMODE", nil, instancia, modo_raid) elseif (qual == modo_grupo) then @@ -1875,7 +1919,7 @@ function _detalhes:AlteraModo (instancia, qual) --instancia.modo = modo_grupo instancia:SoloMode (false) elseif (instancia:IsRaidMode()) then - instancia:RaidMode (false, instancia) + _detalhes.RaidTables:DisableRaidMode (instancia) end _detalhes:ResetaGump (instancia) @@ -1887,6 +1931,7 @@ function _detalhes:AlteraModo (instancia, qual) instancia:AtualizaGumpPrincipal (true) instancia.last_modo = modo_grupo _detalhes:SendEvent ("DETAILS_INSTANCE_CHANGEMODE", nil, instancia, modo_grupo) + _detalhes:SendEvent ("DETAILS_INSTANCE_CHANGEATTRIBUTE", nil, instancia, instancia.atributo, instancia.sub_atributo) elseif (qual == modo_all) then @@ -1897,7 +1942,7 @@ function _detalhes:AlteraModo (instancia, qual) instancia:SoloMode (false) elseif (instancia:IsRaidMode()) then - instancia:RaidMode (false, instancia) + _detalhes.RaidTables:DisableRaidMode (instancia) end instancia.modo = modo_all @@ -1906,6 +1951,7 @@ function _detalhes:AlteraModo (instancia, qual) instancia:AtualizaGumpPrincipal (true) instancia.last_modo = modo_all _detalhes:SendEvent ("DETAILS_INSTANCE_CHANGEMODE", nil, instancia, modo_all) + _detalhes:SendEvent ("DETAILS_INSTANCE_CHANGEATTRIBUTE", nil, instancia, instancia.atributo, instancia.sub_atributo) end local checked diff --git a/classes/classe_instancia_include.lua b/classes/classe_instancia_include.lua index faf8302b..04f65577 100644 --- a/classes/classe_instancia_include.lua +++ b/classes/classe_instancia_include.lua @@ -146,6 +146,8 @@ _detalhes.instance_defaults = { start_after_icon = true, --percent type percent_type = 1, + --backdrop + backdrop = {enabled = false, size = 12, color = {1, 1, 1, 1}, texture = "Details BarBorder 2"} }, --instance window color diff --git a/classes/classe_others.lua b/classes/classe_others.lua index 8c334d29..9f86fe64 100644 --- a/classes/classe_others.lua +++ b/classes/classe_others.lua @@ -667,7 +667,7 @@ function atributo_misc:AtualizaBarra (instancia, barras_container, qual_barra, l local esta_porcentagem = _math_floor ((meu_total/instancia.top) * 100) if (UsingCustomRightText) then - esta_barra.texto_direita:SetText (instancia.row_info.textR_custom_text:ReplaceData (meu_total, "", porcentagem)) + esta_barra.texto_direita:SetText (instancia.row_info.textR_custom_text:ReplaceData (meu_total, "", porcentagem, self)) else esta_barra.texto_direita:SetText (meu_total .." (" .. porcentagem .. "%)") --seta o texto da direita end diff --git a/core/control.lua b/core/control.lua index cce5f346..b67a7b92 100644 --- a/core/control.lua +++ b/core/control.lua @@ -340,19 +340,11 @@ if (instancia.auto_switch_to) then --salva o estado atual - instancia.auto_switch_to_old = {instancia.modo, instancia.atributo, instancia.sub_atributo, instancia.segmento, _detalhes.RaidTables.Mode, _detalhes.SoloTables.Mode} + instancia.auto_switch_to_old = {instancia.modo, instancia.atributo, instancia.sub_atributo, instancia.segmento, instancia:GetRaidPluginName(), _detalhes.SoloTables.Mode} --muda para um plugin de raid if (instancia.auto_switch_to [1] == "raid") then - for index, ptable in _ipairs (_detalhes.RaidTables.Menu) do - if (ptable[1] == instancia.auto_switch_to [2]) then - if (instancia.modo ~= _detalhes._detalhes_props ["MODO_RAID"]) then - _detalhes:AlteraModo (instancia, _detalhes._detalhes_props ["MODO_RAID"]) - end - _detalhes.RaidTables:switch (nil, index) - break - end - end + _detalhes.RaidTables:EnableRaidMode (instancia, instancia.auto_switch_to [2]) else --muda para um atributo normal if (instancia.modo ~= _detalhes._detalhes_props["MODO_GROUP"]) then @@ -511,8 +503,6 @@ end end end - - if (_detalhes.solo) then --> debuffs need a checkup, not well functional right now @@ -534,8 +524,8 @@ end _detalhes.tabela_overall = _detalhes.tabela_overall - _detalhes.tabela_vigente --> isso aqui é novo, ele vai subtrair da overall qualquer dado adicionado na tabela descardata - _table_wipe (_detalhes.tabela_vigente) --> descarta ela, não será mais usada + --_table_wipe (_detalhes.tabela_vigente) --> descarta ela, não será mais usada _detalhes.tabela_vigente = _detalhes.tabela_historico.tabelas[1] --> pega a tabela do ultimo combate if (_detalhes.tabela_vigente.start_time == 0) then @@ -607,7 +597,7 @@ end if (self.modo == _detalhes._detalhes_props["MODO_RAID"]) then - _detalhes.RaidTables:switch (nil, self.auto_switch_to_old [5]) + _detalhes.RaidTables:switch (nil, self.auto_switch_to_old [5], self) elseif (self.modo == _detalhes._detalhes_props["MODO_ALONE"]) then _detalhes.SoloTables:switch (nil, self.auto_switch_to_old [6]) @@ -945,13 +935,9 @@ if (esta_barra.minha_tabela.serial and esta_barra.minha_tabela.serial ~= "") then local avatar = NickTag:GetNicknameTable (esta_barra.minha_tabela.serial) if (avatar) then - if (avatar [2]) then + if (avatar [2] and avatar [4] and avatar [1]) then GameCooltip:SetBannerImage (1, avatar [2], 80, 40, avatarPoint, avatarTexCoord, nil) --> overlay [2] avatar path - end - if (avatar [4]) then GameCooltip:SetBannerImage (2, avatar [4], 200, 55, backgroundPoint, avatar [5], avatar [6]) --> background - end - if (avatar [1]) then GameCooltip:SetBannerText (1, avatar [1], textPoint) --> text [1] nickname end end diff --git a/core/meta.lua b/core/meta.lua index 14e70785..608c44f5 100644 --- a/core/meta.lua +++ b/core/meta.lua @@ -176,25 +176,22 @@ if (_detalhes.segments_amount_to_save and _detalhes.segments_amount_to_save < _detalhes.segments_amount) then for i = _detalhes.segments_amount, _detalhes.segments_amount_to_save+1, -1 do if (_detalhes.tabela_historico.tabelas [i]) then - --_detalhes.tabela_historico.tabelas [i] = nil table.remove (_detalhes.tabela_historico.tabelas, i) end end end - --local tabela_overall = _detalhes.tabela_overall - _detalhes.tabela_overall = nil + --tabela do combate atual + local tabela_atual = _detalhes.tabela_vigente or _detalhes.combate:NovaTabela (_, _detalhes.tabela_overall) - local tabela_atual = _detalhes.tabela_vigente or {} + --limpa a tabela overall + _detalhes.tabela_overall = nil for _, _tabela in _ipairs (historico_tabelas) do tabelas_de_combate [#tabelas_de_combate+1] = _tabela end - - --tabelas_de_combate [#tabelas_de_combate+1] = tabela_atual --não salva mais a atual - --tabelas_de_combate [#tabelas_de_combate+1] = tabela_overall --não salva mais a overall - --> make sure details database exists + --verifica se a database existe mesmo _detalhes_database = _detalhes_database or {} for tabela_index, _combate in _ipairs (tabelas_de_combate) do @@ -238,9 +235,6 @@ if (_iter.data.grupo or _iter.data.boss or _iter.data.boss_fight_component or IsBossEncounter) then can_erase = false - --if (class_type == 1) then - -- print ("SAVE ", _iter.data.nome, tabela_index) - --end else local owner = _iter.data.owner if (owner) then @@ -563,6 +557,10 @@ esta_instancia.lastIcon = nil esta_instancia.menu_attribute_string = nil + + esta_instancia.wait_for_plugin_created = nil + esta_instancia.waiting_raid_plugin = nil + esta_instancia.waiting_pid = nil end diff --git a/core/plugins.lua b/core/plugins.lua index bfadfd3f..60f8fc5a 100644 --- a/core/plugins.lua +++ b/core/plugins.lua @@ -25,6 +25,10 @@ print (PluginName, Loc ["STRING_TOOOLD"]) return _detalhes:NewError ("Details version is out of date.") end + + if (PluginType == "TANK") then + PluginType = "RAID" + end if (not PluginType) then return _detalhes:NewError ("InstallPlugin parameter 1 (plugin type) not especified") @@ -77,7 +81,7 @@ _detalhes.PluginCount.SOLO = _detalhes.PluginCount.SOLO + 1 - elseif (PluginType == "TANK") then + elseif (PluginType == "RAID") then --> Install Plugin _detalhes.RaidTables.Plugins [#_detalhes.RaidTables.Plugins+1] = PluginObject @@ -87,6 +91,8 @@ _detalhes.PluginCount.RAID = _detalhes.PluginCount.RAID + 1 + _detalhes:InstanceCall ("RaidPluginInstalled", PluginAbsoluteName) + elseif (PluginType == "TOOLBAR") then --> Install Plugin diff --git a/core/plugins_raid.lua b/core/plugins_raid.lua index ab98d26d..411f1ed6 100644 --- a/core/plugins_raid.lua +++ b/core/plugins_raid.lua @@ -19,135 +19,224 @@ --> constants local modo_raid = _detalhes._detalhes_props["MODO_RAID"] + local modo_alone = _detalhes._detalhes_props["MODO_ALONE"] ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --> internal functions - - function _detalhes:RaidMode (enable, instancia) - if (enable) then - - _detalhes.RaidTables.instancia = instancia - _detalhes.RaidTables.Mode = _detalhes.RaidTables.Mode or 1 --> solo mode - - instancia.modo = _detalhes._detalhes_props["MODO_RAID"] - - gump:Fade (instancia, 1, nil, "barras") - - if (instancia.rolagem) then - instancia:EsconderScrollBar (true) --> hida a scrollbar - end - - _detalhes:ResetaGump (instancia) - - _detalhes.raid = instancia.meu_id - instancia:AtualizaGumpPrincipal (true) - - local first_enabled_plugin, first_enabled_plugin_index - for index, plugin in ipairs (_detalhes.RaidTables.Plugins) do - if (plugin.__enabled) then - first_enabled_plugin = plugin - first_enabled_plugin_index = index - end - end - - if (not first_enabled_plugin) then - _detalhes:WaitForSoloPlugin (instancia) - else - if (not _detalhes.RaidTables.Plugins [_detalhes.RaidTables.Mode]) then - _detalhes.RaidTables.Mode = first_enabled_plugin_index - end - _detalhes.RaidTables:switch (nil, _detalhes.RaidTables.Mode) - end + + function _detalhes.RaidTables:DisableRaidMode (instance) + --free + self:SetInUse (instance.current_raid_plugin, nil) + --hide + local current_plugin_object = _detalhes:GetPlugin (instance.current_raid_plugin) + if (current_plugin_object) then + current_plugin_object.Frame:Hide() + end + instance.current_raid_plugin = nil + --[[ + if (_G.DetailsWaitForPluginFrame:IsShown()) then + _detalhes:CancelWaitForPlugin() + end + gump:Fade (instancia, 1, nil, "barras") + gump:Fade (instancia.scroll, 0) + + if (instancia.need_rolagem) then + instancia:MostrarScrollBar (true) else - - _detalhes.RaidTables:switch() - _detalhes.raid = nil + --> precisa verificar se ele precisa a rolagem certo? + instancia:ReajustaGump() + end + + --> calcula se existem barras, etc... + if (not instancia.rows_fit_in_window) then --> as barras não forma iniciadas ainda + instancia.rows_fit_in_window = _math_floor (instancia.baseframe.BoxBarrasAltura / instancia.row_height) + if (instancia.rows_created < instancia.rows_fit_in_window) then + for i = #instancia.barras+1, instancia.rows_fit_in_window do + local nova_barra = gump:CriaNovaBarra (instancia, i, 30) --> cria nova barra + nova_barra.texto_esquerdo:SetText (Loc ["STRING_NEWROW"]) + nova_barra.statusbar:SetValue (100) + instancia.barras [i] = nova_barra + end + instancia.rows_created = #instancia.barras + end + end + --]] + end + + function _detalhes:RaidPluginInstalled (plugin_name) + if (self.waiting_raid_plugin) then + --print (self.meu_id, 2, self.last_raid_plugin, " == ", plugin_name) + if (self.last_raid_plugin == plugin_name) then + if (self.waiting_pid) then + self:CancelTimer (self.waiting_pid, true) + end + self:CancelWaitForPlugin() + _detalhes.RaidTables:EnableRaidMode (self, plugin_name) + end + end + end + + function _detalhes.RaidTables:EnableRaidMode (instance, plugin_name) - if (_G.DetailsWaitForPluginFrame:IsShown()) then - _detalhes:CancelWaitForPlugin() - end - - gump:Fade (instancia, 1, nil, "barras") - gump:Fade (instancia.scroll, 0) - - if (instancia.need_rolagem) then - instancia:MostrarScrollBar (true) - else - --> precisa verificar se ele precisa a rolagem certo? - instancia:ReajustaGump() - end - - --> calcula se existem barras, etc... - if (not instancia.rows_fit_in_window) then --> as barras não forma iniciadas ainda - instancia.rows_fit_in_window = _math_floor (instancia.baseframe.BoxBarrasAltura / instancia.row_height) - if (instancia.rows_created < instancia.rows_fit_in_window) then - for i = #instancia.barras+1, instancia.rows_fit_in_window do - local nova_barra = gump:CriaNovaBarra (instancia, i, 30) --> cria nova barra - nova_barra.texto_esquerdo:SetText (Loc ["STRING_NEWROW"]) - nova_barra.statusbar:SetValue (100) - instancia.barras [i] = nova_barra - end - instancia.rows_created = #instancia.barras + --> set the mode + if (instance.modo == modo_alone) then + instance:SoloMode (false) + end + instance.modo = modo_raid + + --> hide rows, scrollbar + gump:Fade (instance, 1, nil, "barras") + if (instance.rolagem) then + instance:EsconderScrollBar (true) --> hida a scrollbar + end + _detalhes:ResetaGump (instance) + instance:AtualizaGumpPrincipal (true) + + --> get the plugin name + + --if the desired plugin isn't passed, try to get the latest used. + if (not plugin_name) then + local last_plugin_used = instance.last_raid_plugin + if (last_plugin_used) then + if (self:IsAvailable (last_plugin_used, instance)) then + plugin_name = last_plugin_used end end + end + + --if we still doesnt have a name, try to get the first available + if (not plugin_name) then + local available = self:GetAvailablePlugins() + if (#available == 0) then + if (not instance.wait_for_plugin_created or not instance.WaitForPlugin) then + instance:CreateWaitForPlugin() + end + return instance:WaitForPlugin() + end + plugin_name = available [1] [4] end + + --last check if the name is okey + if (self:IsAvailable (plugin_name, instance)) then + self:switch (nil, plugin_name, instance) + else + if (not instance.wait_for_plugin) then + instance:CreateWaitForPlugin() + end + return instance:WaitForPlugin() + end + end - function _detalhes:InstanciaCheckForDisabledRaid (instancia) - - if (not instancia) then - instancia = self - end - - if (instancia.modo == modo_raid) then - if (instancia.iniciada) then - _detalhes:AlteraModo (instancia, _detalhes._detalhes_props["MODO_GROUP"]) - instancia:RaidMode (false, instancia) - _detalhes:ResetaGump (instancia) - else - instancia.modo = _detalhes._detalhes_props["MODO_GROUP"] - instancia.last_modo = _detalhes._detalhes_props["MODO_GROUP"] + function _detalhes.RaidTables:GetAvailablePlugins() + local available = {} + for index, plugin in ipairs (self.Menu) do + if (not self.PluginsInUse [ plugin [4] ] and plugin [3].__enabled) then -- 3 = plugin object 4 = absolute name + tinsert (available, plugin) end end + return available end + + function _detalhes.RaidTables:IsAvailable (plugin_name, instance) + --check if is installed + if (not self.NameTable [plugin_name]) then + return false + end - function _detalhes.RaidTables:switch (_, _switchTo) - - --> just hide all - if (not _switchTo) then - if (#_detalhes.RaidTables.Plugins > 0) then --> have at least one plugin - _detalhes.RaidTables.Plugins [_detalhes.RaidTables.Mode].Frame:Hide() + --check if is enabled + if (not self.NameTable [plugin_name].__enabled) then + return false + end + + --check if is available + local in_use = self.PluginsInUse [ plugin_name ] + + -- print (instance:GetId() .. " In Use By Instance: ", in_use ) + + if (in_use and in_use ~= instance:GetId()) then + return false + else + return true + end + end + + function _detalhes.RaidTables:SetInUse (absolute_name, instance_number) + if (absolute_name) then + self.PluginsInUse [ absolute_name ] = instance_number + end + end + + + ---------------- + + function _detalhes.RaidTables:switch (_, plugin_name, instance) + + local update_menu = false + if (not self) then --came from cooltip + self = _detalhes.RaidTables + update_menu = true + end + + --only hide the current plugin shown + if (not plugin_name) then + if (instance.current_raid_plugin) then + --free + self:SetInUse (instance.current_raid_plugin, nil) + --hide + local current_plugin_object = _detalhes:GetPlugin (instance.current_raid_plugin) + if (current_plugin_object) then + current_plugin_object.Frame:Hide() + end + instance.current_raid_plugin = nil end return end - --> jump to the next - if (_switchTo == -1) then - _switchTo = _detalhes.RaidTables.Mode + 1 - if (_switchTo > #_detalhes.RaidTables.Plugins) then - _switchTo = 1 + --check if is realy available + if (not self:IsAvailable (plugin_name, instance)) then + instance.last_raid_plugin = plugin_name + if (not instance.wait_for_plugin) then + instance:CreateWaitForPlugin() + end + return instance:WaitForPlugin() + end + + --hide current shown plugin + if (instance.current_raid_plugin) then + --free + self:SetInUse (instance.current_raid_plugin, nil) + --hide + local current_plugin_object = _detalhes:GetPlugin (instance.current_raid_plugin) + if (current_plugin_object) then + current_plugin_object.Frame:Hide() end end + + local plugin_object = _detalhes:GetPlugin (plugin_name) - local ThisFrame = _detalhes.RaidTables.Plugins [_detalhes.RaidTables.Mode] - if (not ThisFrame or not ThisFrame.__enabled) then - --> frame not found, try in few second again - _detalhes.RaidTables.Mode = _switchTo - _detalhes:WaitForSoloPlugin (_detalhes:GetRaidMode()) - return + if (plugin_object and plugin_object.__enabled and plugin_object.Frame) then + instance.last_raid_plugin = plugin_name + instance.current_raid_plugin = plugin_name + + self:SetInUse (plugin_name, instance:GetId()) + plugin_object.instance_id = instance:GetId() + plugin_object.Frame:SetPoint ("TOPLEFT", instance.bgframe) + plugin_object.Frame:Show() + instance:ChangeIcon (plugin_object.__icon)--; print (instance:GetId(),"icon",plugin_object.__icon) + _detalhes:SendEvent ("DETAILS_INSTANCE_CHANGEATTRIBUTE", nil, instance, instance.atributo, instance.sub_atributo) + + if (update_menu) then + GameCooltip:ExecFunc (instance.baseframe.cabecalho.atributo) + --instance _detalhes.popup:ExecFunc (DeleteButton) + end + else + if (not instance.wait_for_plugin) then + instance:CreateWaitForPlugin() + end + return instance:WaitForPlugin() end - --> hide current frame - _detalhes.RaidTables.Plugins [_detalhes.RaidTables.Mode].Frame:Hide() - --> switch mode - _detalhes.RaidTables.Mode = _switchTo - --> show and setpoint new frame - - _detalhes.RaidTables.Plugins [_detalhes.RaidTables.Mode].Frame:Show() - _detalhes.RaidTables.Plugins [_detalhes.RaidTables.Mode].Frame:SetPoint ("TOPLEFT",_detalhes.RaidTables.instancia.bgframe) - - _detalhes.RaidTables.instancia:ChangeIcon (_detalhes.RaidTables.Menu [_detalhes.RaidTables.Mode] [2]) - end diff --git a/core/plugins_solo.lua b/core/plugins_solo.lua index 882bdcfe..542a1d91 100644 --- a/core/plugins_solo.lua +++ b/core/plugins_solo.lua @@ -192,6 +192,8 @@ _detalhes.SoloTables.instancia:ChangeIcon (_detalhes.SoloTables.Menu [_detalhes.SoloTables.Mode] [2]) + _detalhes:SendEvent ("DETAILS_INSTANCE_CHANGEATTRIBUTE", nil, _detalhes.SoloTables.instancia, _detalhes.SoloTables.instancia.atributo, _detalhes.SoloTables.instancia.sub_atributo) + end return true diff --git a/core/plugins_statusbar.lua b/core/plugins_statusbar.lua index 8607b242..d717f0a8 100644 --- a/core/plugins_statusbar.lua +++ b/core/plugins_statusbar.lua @@ -870,7 +870,7 @@ do for index, child in _ipairs (PAttribute.childs) do if (child.instance == instance and child.enabled and child.instance:IsEnabled()) then - local sName = _detalhes:GetSubAttributeName (attribute, subAttribute) + local sName = child.instance:GetInstanceAttributeText() child.text:SetText (sName) end end diff --git a/core/plugins_toolbar.lua b/core/plugins_toolbar.lua index d1eeb7a3..190388bd 100644 --- a/core/plugins_toolbar.lua +++ b/core/plugins_toolbar.lua @@ -146,8 +146,8 @@ GameCooltip:Reset() --GameCooltip:SetOption ("FixedWidth", 200) - GameCooltip:SetOption ("ButtonsYMod", -5) - GameCooltip:SetOption ("YSpacingMod", -5) + GameCooltip:SetOption ("ButtonsYMod", -3) + GameCooltip:SetOption ("YSpacingMod", -3) GameCooltip:SetOption ("IgnoreButtonAutoHeight", true) GameCooltip:SetColor (1, 0.5, 0.5, 0.5, 0.5) diff --git a/core/util.lua b/core/util.lua index 0ee505f8..11c33e11 100644 --- a/core/util.lua +++ b/core/util.lua @@ -20,6 +20,7 @@ local _math_max = math.max --lua local local _type = type --lua local local _string_match = string.match --lua local + local loadstring = loadstring --lua local local _UnitClass = UnitClass --wow api local local _IsInRaid = IsInRaid --wow api local @@ -115,17 +116,18 @@ _detalhes.ToKFunctions = {_detalhes.NoToK, _detalhes.ToK, _detalhes.ToK2, _detalhes.ToK0, _detalhes.ToKMin, _detalhes.ToK2Min, _detalhes.ToK0Min, _detalhes.comma_value} + --> replacing data + local args + local replace_arg = function (i) + return args [tonumber(i)] + end + local run_function = function (str) + local r = loadstring (str)(args[4]) + return r or 0 + end function string:ReplaceData (...) - local args = {...} - local function getarg (i) - local n = tonumber (i) - if (n) then - return args [tonumber(i)] - else - return loadstring (i)() - end - end - return (self:gsub('{data(%d+)}', getarg):gsub ('{func(.-)}', getarg)) + args = {...} + return (self:gsub ("{data(%d+)}", replace_arg):gsub ("{func(.-)}", run_function)) end --local usertext = "i got the time: {data2}, {data3}% of {data1} minutes" @@ -160,7 +162,10 @@ s = string.sub(hexstr, mod+1, mod+1) .. s num = math.floor(num / 16) end - if s == '' then s = '0' end + if s == '' then s = '00' end + if (string.len (s) == 1) then + s = "0"..s + end return s end diff --git a/core/windows.lua b/core/windows.lua index ffe19c2e..7a83ba43 100644 --- a/core/windows.lua +++ b/core/windows.lua @@ -74,39 +74,31 @@ function _detalhes:AnimarBarra (esta_barra, fim) esta_barra.inicio = esta_barra.statusbar:GetValue() esta_barra.fim = fim - esta_barra.proximo_update = 0 esta_barra.tem_animacao = 1 - esta_barra:SetScript ("OnUpdate", self.FazerAnimacao) + + if (esta_barra.fim > esta_barra.inicio) then + esta_barra:SetScript ("OnUpdate", self.FazerAnimacao_Direita) + else + esta_barra:SetScript ("OnUpdate", self.FazerAnimacao_Esquerda) + end end - function _detalhes:FazerAnimacao (elapsed) + function _detalhes:FazerAnimacao_Esquerda (elapsed) + self.inicio = self.inicio - 0.8 + self.statusbar:SetValue (self.inicio) + if (self.inicio-1 <= self.fim) then + self.tem_animacao = 0 + self:SetScript ("OnUpdate", nil) + end + end - local velocidade = 0.8 - --[[ - local velocidade = 0.1 - local distancia = self.inicio - self.fim - if (distancia > 40 or distancia < -40) then - velocidade = 0.8 - elseif (distancia > 20 or distancia < -20) then - velocidade = 0.4 + function _detalhes:FazerAnimacao_Direita (elapsed) + self.inicio = self.inicio + 0.8 + self.statusbar:SetValue (self.inicio) + if (self.inicio+1 >= self.fim) then + self.tem_animacao = 0 + self:SetScript ("OnUpdate", nil) end - --]] - if (self.fim > self.inicio) then - self.inicio = self.inicio+velocidade - self.statusbar:SetValue (self.inicio) - if (self.inicio+1 >= self.fim) then - self.tem_animacao = 0 - self:SetScript ("OnUpdate", nil) - end - else - self.inicio = self.inicio-velocidade - self.statusbar:SetValue (self.inicio) - if (self.inicio-1 <= self.fim) then - self.tem_animacao = 0 - self:SetScript ("OnUpdate", nil) - end - end - self.proximo_update = 0 end function _detalhes:AtualizaPontos() @@ -530,6 +522,86 @@ end --> cria o frame de wait for plugin + + function _detalhes:CreateWaitForPlugin() + + local WaitForPluginFrame = CreateFrame ("frame", "DetailsWaitForPluginFrame" .. self.meu_id, UIParent) + local WaitTexture = WaitForPluginFrame:CreateTexture (nil, "overlay") + WaitTexture:SetTexture ("Interface\\UNITPOWERBARALT\\Mechanical_Circular_Frame") + WaitTexture:SetPoint ("center", WaitForPluginFrame) + WaitTexture:SetWidth (180) + WaitTexture:SetHeight (180) + WaitForPluginFrame.wheel = WaitTexture + local RotateAnimGroup = WaitForPluginFrame:CreateAnimationGroup() + local rotate = RotateAnimGroup:CreateAnimation ("Rotation") + rotate:SetDegrees (360) + rotate:SetDuration (60) + RotateAnimGroup:SetLooping ("repeat") + + local bgpanel = gump:NewPanel (UIParent, UIParent, "DetailsWaitFrameBG"..self.meu_id, nil, 120, 30, false, false, false) + bgpanel:SetPoint ("center", WaitForPluginFrame, "center") + bgpanel:SetBackdrop ({bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background"}) + bgpanel:SetBackdropColor (.2, .2, .2, 1) + + local label = gump:NewLabel (UIParent, UIParent, nil, nil, Loc ["STRING_WAITPLUGIN"]) --> localize-me + label.color = "silver" + label:SetPoint ("center", WaitForPluginFrame, "center") + label:SetJustifyH ("center") + label:Hide() + + WaitForPluginFrame:Hide() + self.wait_for_plugin_created = true + + function self:WaitForPlugin() + + self:ChangeIcon ([[Interface\GossipFrame\ActiveQuestIcon]]) + + if (WaitForPluginFrame:IsShown() and WaitForPluginFrame:GetParent() == self.baseframe) then + self.waiting_pid = self:ScheduleTimer ("ExecDelayedPlugin1", 5, self) + end + + WaitForPluginFrame:SetParent (self.baseframe) + WaitForPluginFrame:SetAllPoints (self.baseframe) + local size = math.max (self.baseframe:GetHeight()* 0.35, 100) + WaitForPluginFrame.wheel:SetWidth (size) + WaitForPluginFrame.wheel:SetHeight (size) + WaitForPluginFrame:Show() + label:Show() + bgpanel:Show() + RotateAnimGroup:Play() + + self.waiting_raid_plugin = true + + self.waiting_pid = self:ScheduleTimer ("ExecDelayedPlugin1", 5, self) + end + + function self:CancelWaitForPlugin() + RotateAnimGroup:Stop() + WaitForPluginFrame:Hide() + label:Hide() + bgpanel:Hide() + end + + function self:ExecDelayedPlugin1() + + self.waiting_raid_plugin = nil + self.waiting_pid = nil + + RotateAnimGroup:Stop() + WaitForPluginFrame:Hide() + label:Hide() + bgpanel:Hide() + + if (self.meu_id == _detalhes.solo) then + _detalhes.SoloTables:switch (nil, _detalhes.SoloTables.Mode) + + elseif (self.modo == _detalhes._detalhes_props["MODO_RAID"]) then + _detalhes.RaidTables:EnableRaidMode (self) + + end + end + end + do local WaitForPluginFrame = CreateFrame ("frame", "DetailsWaitForPluginFrame", UIParent) local WaitTexture = WaitForPluginFrame:CreateTexture (nil, "overlay") diff --git a/framework/cooltip.lua b/framework/cooltip.lua index f173554c..2438c809 100644 --- a/framework/cooltip.lua +++ b/framework/cooltip.lua @@ -362,13 +362,15 @@ function DetailsCreateCoolTip() ---------------------------------------------------------------------- function GameCooltipButtonMouseDown (button) - button.leftText:SetPoint ("center", button.leftIcon, "center", 0, 0) - button.leftText:SetPoint ("left", button.leftIcon, "right", 4, -1) + local mod = CoolTip.OptionsTable.TextHeightMod or 0 + button.leftText:SetPoint ("center", button.leftIcon, "center", 0, 0+mod) + button.leftText:SetPoint ("left", button.leftIcon, "right", 4, -1+mod) end function GameCooltipButtonMouseUp (button) - button.leftText:SetPoint ("center", button.leftIcon, "center", 0, 0) - button.leftText:SetPoint ("left", button.leftIcon, "right", 3, 0) + local mod = CoolTip.OptionsTable.TextHeightMod or 0 + button.leftText:SetPoint ("center", button.leftIcon, "center", 0, 0+mod) + button.leftText:SetPoint ("left", button.leftIcon, "right", 3, 0+mod) end function CoolTip:CreateButton (index, frame, name) @@ -670,6 +672,10 @@ function DetailsCreateCoolTip() flags = leftTextTable [8] or CoolTip.OptionsTable.TextShadow or nil menuButton.leftText:SetFont (face, size, flags) end + + local height_mod = CoolTip.OptionsTable.TextHeightMod or 0 + menuButton.leftText:SetPoint ("center", menuButton.leftIcon, "center", 0, 0+height_mod) + menuButton.leftText:SetPoint ("left", menuButton.leftIcon, "right", 3, 0+height_mod) else menuButton.leftText:SetText ("") @@ -1551,6 +1557,10 @@ function DetailsCreateCoolTip() --> frame [, x mod, y mod] --> alias + function CoolTip:GetOwner() + return CoolTip.Host + end + function CoolTip:SetOwner (frame, myPoint, hisPoint, x, y) return CoolTip:SetHost (frame, myPoint, hisPoint, x, y) end @@ -2543,22 +2553,20 @@ function DetailsCreateCoolTip() function CoolTip:Close() CoolTip.active = false + CoolTip.Host = nil gump:Fade (frame1, 1) gump:Fade (frame2, 1) end --> old function call function CoolTip:ShowMe (host, arg2) - --> ignore if mouse is up me if (CoolTip.mouseOver) then return end if (not host or not arg2) then --> hideme - CoolTip.active = false - gump:Fade (frame1, 1) - gump:Fade (frame2, 1) + CoolTip:Close() end end diff --git a/framework/panel.lua b/framework/panel.lua index 3ad5605c..836d34bb 100644 --- a/framework/panel.lua +++ b/framework/panel.lua @@ -752,6 +752,7 @@ function gump:NewFillPanel (parent, rows, name, member, w, h, total_lines, fill_ editbox:SetBackdrop ({bgFile = [[Interface\DialogFrame\UI-DialogBox-Background]], edgeFile = "Interface\\ChatFrame\\ChatFrameBackground", edgeSize = 1}) editbox:SetBackdropColor (1, 1, 1, 0.1) editbox:SetBackdropBorderColor (1, 1, 1, 0.1) + editbox.editbox.current_bordercolor = {1, 1, 1, 0.1} --> insert in the table tinsert (row.row_widgets, editbox) diff --git a/framework/slider.lua b/framework/slider.lua index ca11e898..2de0f115 100644 --- a/framework/slider.lua +++ b/framework/slider.lua @@ -306,23 +306,25 @@ local SliderMetaFunctions = {} local OnEnter = function (slider) + DetailsFrameworkSliderButtons:ShowMe (slider) + if (slider.MyObject.OnEnterHook) then local interrupt = slider.MyObject.OnEnterHook (slider) if (interrupt) then return end end - - DetailsFrameworkSliderButtons:ShowMe (slider) - + slider.thumb:SetAlpha (1) - if (slider.MyObject.have_tooltip) then - _detalhes:CooltipPreset (1) + if (slider.MyObject.have_tooltip and slider.MyObject.have_tooltip ~= Loc ["STRING_RIGHTCLICK_TYPEVALUE"]) then + GameCooltip:Reset() GameCooltip:AddLine (slider.MyObject.have_tooltip) - if (slider.MyObject.have_tooltip == Loc ["STRING_RIGHTCLICK_TYPEVALUE"]) then - GameCooltip:AddIcon ([[Interface\TUTORIALFRAME\UI-TUTORIAL-FRAME]], 1, 1, 16, 16, 0.015625, 0.15671875, 0.640625, 0.798828125) - end + GameCooltip:ShowCooltip (slider, "tooltip") + else + _detalhes:CooltipPreset (1) + GameCooltip:AddLine (Loc ["STRING_RIGHTCLICK_TYPEVALUE"]) + GameCooltip:AddIcon ([[Interface\TUTORIALFRAME\UI-TUTORIAL-FRAME]], 1, 1, 16, 16, 0.015625, 0.15671875, 0.640625, 0.798828125) GameCooltip:ShowCooltip (slider, "tooltip") end @@ -336,6 +338,9 @@ local SliderMetaFunctions = {} end local OnLeave = function (slider) + + DetailsFrameworkSliderButtons:PrepareToHide() + if (slider.MyObject.OnLeaveHook) then local interrupt = slider.MyObject.OnLeaveHook (slider) if (interrupt) then @@ -343,8 +348,6 @@ local SliderMetaFunctions = {} end end - DetailsFrameworkSliderButtons:PrepareToHide() - slider.thumb:SetAlpha (.7) if (slider.MyObject.have_tooltip) then diff --git a/framework/textentry.lua b/framework/textentry.lua index 4695f017..8473a177 100644 --- a/framework/textentry.lua +++ b/framework/textentry.lua @@ -251,7 +251,7 @@ local TextEntryMetaFunctions = {} ------------------------------------------------------------------------------------------------------------ --> scripts local OnEnter = function (textentry) - + if (textentry.MyObject.OnEnterHook) then local interrupt = textentry.MyObject.OnEnterHook (textentry) if (interrupt) then @@ -527,11 +527,14 @@ function gump:NewTextEntry (parent, container, name, member, w, h, func, param1, TextEntryObject.editbox:SetJustifyH ("center") TextEntryObject.editbox:EnableMouse (true) TextEntryObject.editbox:SetText ("") - TextEntryObject.editbox:SetBackdrop ({bgFile = "Interface\\ChatFrame\\ChatFrameBackground", - edgeFile = "Interface\\ChatFrame\\ChatFrameBackground", - tile = true, edgeSize = 1, tileSize = 5}) - TextEntryObject.editbox:SetBackdropColor (0, 0, 0, 0.5) - TextEntryObject.editbox:SetBackdropBorderColor (0.3, 0.3, 0.30, 0.80) + + --TextEntryObject.editbox:SetBackdrop ({bgFile = "Interface\\ChatFrame\\ChatFrameBackground", + --edgeFile = "Interface\\ChatFrame\\ChatFrameBackground", + --tile = true, edgeSize = 1, tileSize = 5}) + + --TextEntryObject.editbox:SetBackdropColor (0, 0, 0, 0.5) + --TextEntryObject.editbox:SetBackdropBorderColor (0.3, 0.3, 0.30, 0.80) + TextEntryObject.editbox.current_bordercolor = {1, 1, 1, 1} TextEntryObject.editbox:SetAutoFocus (false) TextEntryObject.editbox:SetFontObject ("GameFontHighlightSmall") diff --git a/framework/textentry.xml b/framework/textentry.xml index 252d1c3e..e7569f23 100644 --- a/framework/textentry.xml +++ b/framework/textentry.xml @@ -5,15 +5,15 @@ - + - + - + diff --git a/functions/loaddata.lua b/functions/loaddata.lua index bdb4d723..ba18f2fc 100644 --- a/functions/loaddata.lua +++ b/functions/loaddata.lua @@ -152,10 +152,8 @@ function _detalhes:LoadCombatTables() --> if isn't nothing saved, build a new one if (not _detalhes_database.tabela_historico) then _detalhes.tabela_historico = _detalhes.historico:NovoHistorico() - _detalhes.tabela_pets = _detalhes.container_pets:NovoContainer() _detalhes.tabela_overall = _detalhes.combate:NovaTabela() _detalhes.tabela_vigente = _detalhes.combate:NovaTabela (_, _detalhes.tabela_overall) - else --> build basic containers @@ -164,7 +162,10 @@ function _detalhes:LoadCombatTables() -- overall _detalhes.tabela_overall = _detalhes.combate:NovaTabela() -- pets - _detalhes.tabela_pets = _detalhes_database.tabela_pets or _detalhes.container_pets:NovoContainer() + _detalhes.tabela_pets = _detalhes.container_pets:NovoContainer() + if (_detalhes_database.tabela_pets) then + _detalhes.tabela_pets.pets = _detalhes_database.tabela_pets + end --> if the core revision was incremented, reset all combat data if (_detalhes_database.last_realversion and _detalhes_database.last_realversion < _detalhes.realversion) then @@ -250,14 +251,21 @@ function _detalhes:LoadConfig() end end - if (_detalhes_database.RaidTablesSaved) then - if (_detalhes_database.RaidTablesSaved.Mode) then - _detalhes.RaidTables.Mode = _detalhes_database.RaidTablesSaved.Mode - _detalhes.RaidTables.LastSelected = _detalhes_database.RaidTablesSaved.LastSelected - else - _detalhes.RaidTables.Mode = 1 - end - end + --if (_detalhes_database.RaidTablesSaved) then + + --for id, instance in ipairs (_detalhes.tabela_instancias) do + -- if (instance.modo == _detalhes._detalhes_props["MODO_RAID"]) then + -- _detalhes:AlteraModo (instance, _detalhes._detalhes_props["MODO_GROUP"]) + -- end + --end + + --if (_detalhes_database.RaidTablesSaved.Mode) then + -- _detalhes.RaidTables.Mode = _detalhes_database.RaidTablesSaved.Mode + -- _detalhes.RaidTables.LastSelected = _detalhes_database.RaidTablesSaved.LastSelected + --else + -- _detalhes.RaidTables.Mode = 1 + --end + --end --> switch tables _detalhes.switch.slots = _detalhes_database.switchSaved.slots diff --git a/functions/savedata.lua b/functions/savedata.lua index 91e60863..10c2f2a4 100644 --- a/functions/savedata.lua +++ b/functions/savedata.lua @@ -435,6 +435,12 @@ function _detalhes:SaveConfig() _detalhes_database.tabela_instancias = _detalhes.tabela_instancias _detalhes_database.tabela_historico = _detalhes.tabela_historico + local name, ttype, difficulty, difficultyName, maxPlayers, playerDifficulty, isDynamicInstance, mapID, instanceGroupSize = GetInstanceInfo() + if (ttype == "party" or ttype == "raid") then + --> salvar container de pet + _detalhes_database.tabela_pets = _detalhes.tabela_pets.pets + end + _detalhes:TimeDataCleanUpTemporary() --> buffs @@ -462,13 +468,15 @@ function _detalhes:SaveConfig() _detalhes_database.SoloTablesSaved.LastSelected = _detalhes.SoloTables.Plugins [_detalhes.SoloTables.Mode].real_name end end - if (_detalhes.RaidTables.Mode) then - _detalhes_database.RaidTablesSaved = {} - _detalhes_database.RaidTablesSaved.Mode = _detalhes.RaidTables.Mode - if (_detalhes.RaidTables.Plugins [_detalhes.RaidTables.Mode]) then - _detalhes_database.RaidTablesSaved.LastSelected = _detalhes.RaidTables.Plugins [_detalhes.RaidTables.Mode].real_name - end - end + + --if (_detalhes.RaidTables.Mode) then + -- _detalhes_database.RaidTablesSaved = {} + -- _detalhes_database.RaidTablesSaved.Mode = _detalhes.RaidTables.Mode + -- if (_detalhes.RaidTables.Plugins [_detalhes.RaidTables.Mode]) then + -- _detalhes_database.RaidTablesSaved.LastSelected = _detalhes.RaidTables.Plugins [_detalhes.RaidTables.Mode].real_name + -- end + --end + _detalhes_database.RaidTablesSaved = nil --> salva switch tables _detalhes_database.switchSaved.slots = _detalhes.switch.slots diff --git a/functions/slash.lua b/functions/slash.lua index ca8d91bf..497b30c2 100644 --- a/functions/slash.lua +++ b/functions/slash.lua @@ -260,6 +260,7 @@ function SlashCmdList.DETAILS (msg, editbox) elseif (command == "owner") then local petname = rest:match ("^(%S*)%s*(.-)$") + local petGUID = UnitGUID ("target") if (not _G.DetailsScanTooltip) then local scanTool = CreateFrame ("GameTooltip", "DetailsScanTooltip", nil, "GameTooltipTemplate") @@ -271,15 +272,21 @@ function SlashCmdList.DETAILS (msg, editbox) local scanText = _G ["DetailsScanTooltipTextLeft2"] -- This is the line with <[Player]'s Pet> scanTool:ClearLines() + + print (petName) scanTool:SetUnit (petName) + local ownerText = scanText:GetText() - if not ownerText then return nil end - local owner, _ = string.split("'",ownerText) + if (not ownerText) then + return nil + end + local owner, _ = string.split ("'", ownerText) return owner -- This is the pet's owner end - print (getPetOwner (petname)) + --print (getPetOwner (petname)) + print (getPetOwner (petGUID)) elseif (command == "buffsof") then diff --git a/functions/spells.lua b/functions/spells.lua index a549072c..32db60e1 100644 --- a/functions/spells.lua +++ b/functions/spells.lua @@ -906,6 +906,7 @@ do [116888] = true, --Shroud of Purgatory (talent) [51052] = true, --Anti-Magic Zone (talent) [77535] = true, --Blood Shield + [115635] = true, --death barrier --shaman [114893] = true, --Stone Bulwark (stone bulwark totem) diff --git a/functions/timedata.lua b/functions/timedata.lua index b1035394..9eb5dd59 100644 --- a/functions/timedata.lua +++ b/functions/timedata.lua @@ -229,10 +229,20 @@ function _detalhes:BrokerTick() local texttype = _detalhes.minimap.text_type if (texttype == 1) then --dps - _detalhes.databroker.text = _detalhes.tabela_vigente.totals_grupo[1] + local time = _detalhes.tabela_vigente:GetCombatTime() + if (not time or time == 0) then + _detalhes.databroker.text = 0 + else + _detalhes.databroker.text = _detalhes.tabela_vigente.totals_grupo[1] / time + end elseif (texttype == 2) then --hps - _detalhes.databroker.text = _detalhes.tabela_vigente.totals_grupo[2] + local time = _detalhes.tabela_vigente:GetCombatTime() + if (not time or time == 0) then + _detalhes.databroker.text = 0 + else + _detalhes.databroker.text = _detalhes.tabela_vigente.totals_grupo[2] / time + end else if (_detalhes.minimap.text_func) then diff --git a/gumps/janela_options.lua b/gumps/janela_options.lua index d799a53f..ccdf869d 100644 --- a/gumps/janela_options.lua +++ b/gumps/janela_options.lua @@ -83,7 +83,7 @@ function _detalhes:OpenOptionsWindow (instance) local bigdog = g:NewImage (window, [[Interface\MainMenuBar\UI-MainMenuBar-EndCap-Human]], 180, 200, nil, {1, 0, 0, 1}, "backgroundBigDog", "$parentBackgroundBigDog") bigdog:SetPoint ("bottomright", window, "bottomright", -8, 31) - bigdog:SetAlpha (.15) + bigdog:SetAlpha (.25) local window_icon = g:NewImage (window, [[Interface\AddOns\Details\images\options_window]], 58, 58, nil, nil, "windowicon", "$parentWindowIcon") window_icon:SetPoint (17, -17) @@ -138,6 +138,19 @@ function _detalhes:OpenOptionsWindow (instance) info_text.active = false info_text.color = "white" + local desc_anchor_topright = g:NewImage (window, [[Interface\AddOns\Details\images\options_window]], 75, 106, "artwork", {0.2724609375, 0.19921875, 0.6796875, 0.783203125}, "descAnchorTopRightImage", "$parentDescAnchorTopRightImage") --204 696 279 802 + desc_anchor_topright:SetPoint ("topleft", window.widget, "topleft", 796, -76) + desc_anchor_topright:Hide() + desc_anchor_topright:SetAlpha (.8) + local desc_anchor_topleft = g:NewImage (window, [[Interface\AddOns\Details\images\options_window]], 75, 106, "artwork", {0.19921875, 0.2724609375, 0.783203125, 0.6796875}, "descAnchorBottomLeftImage", "$parentDescAnchorBottomLeftImage") --204 696 279 802 + desc_anchor_topleft:SetPoint ("topleft", window.widget, "topleft", 191, -465) + desc_anchor_topleft:Hide() + desc_anchor_topleft:SetAlpha (.8) + local desc_anchor_bottomleft = g:NewImage (window, [[Interface\AddOns\Details\images\options_window]], 75, 106, "artwork", {0.19921875, 0.2724609375, 0.6796875, 0.783203125}, "descAnchorTopLeftImage", "$parentDescAnchorTopLeftImage") --204 696 279 802 + desc_anchor_bottomleft:SetPoint ("topleft", window.widget, "topleft", 191, -76) + desc_anchor_bottomleft:Hide() + desc_anchor_bottomleft:SetAlpha (.8) + local desc_anchor = g:NewImage (window, [[Interface\AddOns\Details\images\options_window]], 75, 106, "artwork", {0.19921875, 0.2724609375, 0.6796875, 0.783203125}, "descAnchorImage", "$parentDescAnchorImage") --204 696 279 802 desc_anchor:SetPoint ("topleft", info_text, "topleft", -28, 33) @@ -191,10 +204,14 @@ function _detalhes:OpenOptionsWindow (instance) end elseif (modo == 4) then --raid - atributo = _detalhes.RaidTables.Mode or 1 - local RaidInfo = _detalhes.RaidTables.Menu [atributo] - if (RaidInfo) then - InstanceList [#InstanceList+1] = {value = index, label = "#".. index .. " " .. RaidInfo [1], onclick = onSelectInstance, icon = RaidInfo [2]} + local plugin_name = _this_instance.current_raid_plugin or _this_instance.last_raid_plugin + if (plugin_name) then + local plugin_object = _detalhes:GetPlugin (plugin_name) + if (plugin_object) then + InstanceList [#InstanceList+1] = {value = index, label = "#".. index .. " " .. plugin_object.__name, onclick = onSelectInstance, icon = plugin_object.__icon} + else + InstanceList [#InstanceList+1] = {value = index, label = "#".. index .. " unknown", onclick = onSelectInstance, icon = ""} + end else InstanceList [#InstanceList+1] = {value = index, label = "#".. index .. " unknown", onclick = onSelectInstance, icon = ""} end @@ -276,6 +293,9 @@ function _detalhes:OpenOptionsWindow (instance) local actors_name = {"Ragnaros", "The Lich King", "Your Neighbor", "Your Raid Leader", "Your Internet Girlfriend", "Mr. President", "A Shadow Priest Complaining About Dps", "Ms. Gray", "Parry Hotter", "Your Math Teacher", "King Djoffrey", UnitName ("player") .. " Snow", "A Drunk Dawrf", "Somebody That You Used To Know", "Low Dps Guy", "Helvis Phresley (Death Log Not Found)", "Stormwind Guard", "A PvP Player", "Bolvar Fordragon","Malygos","Akama","Anachronos","Lady Blaumeux","Cairne Bloodhoof","Borivar","C'Thun","Drek'Thar","Durotan","Eonar","Footman Malakai","Bolvar Fordragon","Fritz Fizzlesprocket","Lisa Gallywix","M'uru","High Priestess MacDonnell","Nazgrel","Ner'zhul","Saria Nightwatcher","Chief Ogg'ora","Ogoun","Grimm Onearm","Apothecary Oni'jus","Orman of Stromgarde","General Rajaxx","Baron Rivendare","Roland","Archmage Trelane","Liam Trollbane"} local actors_classes = CLASS_SORT_ORDER + local total_damage = 0 + local total_heal = 0 + for i = 1, 10 do local robot = current_combat[1]:PegarCombatente (0x0000000000000, actors_name [math.random (1, #actors_name)], 0x114, true) robot.grupo = true @@ -284,6 +304,8 @@ function _detalhes:OpenOptionsWindow (instance) robot.damage_taken = math.random (10000000, 60000000) robot.friendlyfire_total = math.random (10000000, 60000000) + total_damage = total_damage + robot.total + if (robot.nome == "King Djoffrey") then local robot_death = current_combat[4]:PegarCombatente (0x0000000000000, robot.nome, 0x114, true) robot_death.grupo = true @@ -306,12 +328,18 @@ function _detalhes:OpenOptionsWindow (instance) robot.totalabsorb = math.random (10000000, 60000000) robot.healing_taken = math.random (10000000, 60000000) + total_heal = total_heal + robot.total end current_combat.start_time = time()-360 current_combat.end_time = time() + current_combat.totals_grupo [1] = total_damage + current_combat.totals_grupo [2] = total_heal + current_combat.totals [1] = total_damage + current_combat.totals [2] = total_heal + for _, instance in ipairs (_detalhes.tabela_instancias) do if (instance:IsEnabled()) then instance:InstanceReset() @@ -335,7 +363,7 @@ function _detalhes:OpenOptionsWindow (instance) local menus = { --labels nos menus {"Display", "Combat", "Tooltips", "Externals", "Profiles"}, - {"Skin Selection", "Row Settings", "Row Texts", "Show & Hide Settings", "Window Settings", "Attribute Text", "Menus: Left Buttons", "Menus: Right Buttons", "Wallpaper", "Miscellaneous"}, + {"Skin Selection", "Row Settings", "Row Texts", "Show & Hide Settings", "Window Settings", "Title Text", "Menus: Left Buttons", "Menus: Right Buttons", "Wallpaper", "Miscellaneous"}, {"Data Collector", "Performance Tweaks", "Plugins Management", "Spell Customization", "Data for Charts"} } @@ -353,7 +381,7 @@ local menus = { --labels nos menus "Data Collector", --11 "Plugins Management",--12 "Profiles", --13 - "Attribute Text", --14 + "Title Text", --14 "Spell Customization", --15 "Data for Charts", --16 "Show & Hide Settings", --17 @@ -377,10 +405,18 @@ local menus = { --labels nos menus info_text:Hide() window.descAnchorImage:Hide() window.descBackgroundImage:Hide() + + window.descAnchorTopLeftImage:Hide() + window.descAnchorBottomLeftImage:Hide() + window.descAnchorTopRightImage:Hide() + else - info_text:Show() - window.descAnchorImage:Show() - window.descBackgroundImage:Show() + info_text:Hide() + window.descAnchorImage:Hide() + window.descBackgroundImage:Hide() + window.descAnchorTopLeftImage:Show() + window.descAnchorBottomLeftImage:Show() + window.descAnchorTopRightImage:Show() end end @@ -775,17 +811,120 @@ local menus = { --labels nos menus return f end + +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + + + + local background_on_enter2 = function (self) + if (self.background_frame) then + self = self.background_frame + end + + self.label:SetTextColor (1, .8, 0) + + if (self.parent and self.parent.info) then + _detalhes:CooltipPreset (2) + GameCooltip:AddLine (self.parent.info) + GameCooltip:ShowCooltip (self, "tooltip") + return true + end + + end + + local background_on_leave2 = function (self) + if (self.background_frame) then + self = self.background_frame + end + + GameCooltip:Hide() + + self.label:SetTextColor (1, 1, 1) + end + + function window:create_line_background2 (frameX, label, parent) + local f = CreateFrame ("frame", nil, frameX) + f:SetPoint ("left", label.widget or label, "left", -2, 0) + f:SetSize (260, 16) + f:SetScript ("OnEnter", background_on_enter2) + f:SetScript ("OnLeave", background_on_leave2) + f:SetScript ("OnMouseDown", background_on_mouse_down) + f:SetScript ("OnMouseUp", background_on_mouse_up) + f:SetBackdrop({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16, insets = {left = 0, right = 0, top = 0, bottom = 0}}) + f:SetBackdropColor (0, 0, 0, 0) + f.parent = parent + f.label = label + if (parent.widget) then + parent.widget.background_frame = f + else + parent.background_frame = f + end + + if (label:GetObjectType() == "FontString") then + local t = frameX:CreateTexture (nil, "artwork") + t:SetPoint ("left", label.widget or label, "left") + t:SetSize (label:GetStringWidth(), 12) + t:SetTexture ([[Interface\ACHIEVEMENTFRAME\UI-Achievement-HorizontalShadow]]) + t:SetDesaturated (true) + t:SetAlpha (.5) + end + + return f + end + + function window:CreateLineBackground2 (frame, widget_name, label_name, desc_loc) + + if (type (widget_name) == "table") then + widget_name.info = desc_loc + widget_name.have_tooltip = desc_loc + local f = window:create_line_background2 (frame, label_name, widget_name) + if (widget_name.SetHook) then + widget_name:SetHook ("OnEnter", background_on_enter2) + widget_name:SetHook ("OnLeave", background_on_leave2) + else + widget_name:SetScript ("OnEnter", background_on_enter2) + widget_name:SetScript ("OnLeave", background_on_leave2) + end + return f + end + + frame [widget_name].info = desc_loc + frame [widget_name].have_tooltip = desc_loc + local f = window:create_line_background2 (frame, frame [label_name], frame [widget_name]) + frame [widget_name]:SetHook ("OnEnter", background_on_enter2) + frame [widget_name]:SetHook ("OnLeave", background_on_leave2) + return f + end + select_options (1) - --[[ - _detalhes.savedCustomSpells = {} - local a, _, b = GetSpellInfo (124464) - tinsert (_detalhes.savedCustomSpells, {124464, a, b}) - local a, _, b = GetSpellInfo (124465) - tinsert (_detalhes.savedCustomSpells, {124465, a, b}) - local a, _, b = GetSpellInfo (124468) - tinsert (_detalhes.savedCustomSpells, {1244684, a, b}) ---]] +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + + window.left_start_at = 30 + window.right_start_at = 360 + window.top_start_at = -90 + + function window:arrange_menu (frame, t, x, y_start) + local y = y_start + + table.sort (t, function (a, b) return a[2] < b[2] end) + + for index, _table in ipairs (t) do + local widget = _table [1] + local istitle = _table [3] + + if (istitle and y ~= y_start) then + y = y - 10 + end + + if (type (widget) == "string") then + widget = frame [widget] + end + widget:SetPoint (x, y) + y = y - 25 + end + end + --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -- Advanced Settings - Tooltips ~20 @@ -806,7 +945,7 @@ function window:CreateFrame20() g:NewColorPickButton (frame20, "$parentTooltipTextColorPick", "TooltipTextColorPick", tooltip_text_color_callback) g:NewLabel (frame20, _, "$parentTooltipTextColorLabel", "TooltipTextColorLabel", Loc ["STRING_OPTIONS_TOOLTIPS_FONTCOLOR"], "GameFontHighlightLeft") frame20.TooltipTextColorPick:SetPoint ("left", frame20.TooltipTextColorLabel, "right", 2, 0) - window:CreateLineBackground (frame20, "TooltipTextColorPick", "TooltipTextColorLabel", Loc ["STRING_OPTIONS_TOOLTIPS_FONTCOLOR_DESC"]) + window:CreateLineBackground2 (frame20, "TooltipTextColorPick", "TooltipTextColorLabel", Loc ["STRING_OPTIONS_TOOLTIPS_FONTCOLOR_DESC"]) -- text size g:NewLabel (frame20, _, "$parentTooltipTextSizeLabel", "TooltipTextSizeLabel", Loc ["STRING_OPTIONS_TOOLTIPS_FONTSIZE"], "GameFontHighlightLeft") @@ -819,7 +958,7 @@ function window:CreateFrame20() frame20.TooltipTextSizeSlider:SetHook ("OnValueChange", function (self, _, amount) _detalhes.tooltip.fontsize = amount end) - window:CreateLineBackground (frame20, "TooltipTextSizeSlider", "TooltipTextSizeLabel", Loc ["STRING_OPTIONS_TOOLTIPS_FONTSIZE_DESC"]) + window:CreateLineBackground2 (frame20, "TooltipTextSizeSlider", "TooltipTextSizeLabel", Loc ["STRING_OPTIONS_TOOLTIPS_FONTSIZE_DESC"]) -- text face local on_select_tooltip_font = function (self, _, fontName) @@ -844,7 +983,7 @@ function window:CreateFrame20() frame20.TooltipFontDropdown:SetPoint ("left", frame20.TooltipFontLabel, "right", 2) - window:CreateLineBackground (frame20, "TooltipFontDropdown", "TooltipFontLabel", Loc ["STRING_OPTIONS_TOOLTIPS_FONTFACE_DESC"]) + window:CreateLineBackground2 (frame20, "TooltipFontDropdown", "TooltipFontLabel", Loc ["STRING_OPTIONS_TOOLTIPS_FONTFACE_DESC"]) -- text shadow g:NewLabel (frame20, _, "$parentTooltipShadowLabel", "TooltipShadowLabel", Loc ["STRING_OPTIONS_TOOLTIPS_FONTSHADOW"], "GameFontHighlightLeft") @@ -853,7 +992,7 @@ function window:CreateFrame20() frame20.TooltipShadowSwitch.OnSwitch = function (self, _, value) _detalhes.tooltip.fontshadow = value end - window:CreateLineBackground (frame20, "TooltipShadowSwitch", "TooltipShadowLabel", Loc ["STRING_OPTIONS_TOOLTIPS_FONTSHADOW_DESC"]) + window:CreateLineBackground2 (frame20, "TooltipShadowSwitch", "TooltipShadowLabel", Loc ["STRING_OPTIONS_TOOLTIPS_FONTSHADOW_DESC"]) -- background color local tooltip_background_color_callback = function (button, r, g, b, a) @@ -862,7 +1001,7 @@ function window:CreateFrame20() g:NewColorPickButton (frame20, "$parentTooltipBackgroundColorPick", "TooltipBackgroundColorPick", tooltip_background_color_callback) g:NewLabel (frame20, _, "$parentTooltipBackgroundColorLabel", "TooltipBackgroundColorLabel", Loc ["STRING_OPTIONS_TOOLTIPS_BACKGROUNDCOLOR"], "GameFontHighlightLeft") frame20.TooltipBackgroundColorPick:SetPoint ("left", frame20.TooltipBackgroundColorLabel, "right", 2, 0) - window:CreateLineBackground (frame20, "TooltipBackgroundColorPick", "TooltipBackgroundColorLabel", Loc ["STRING_OPTIONS_TOOLTIPS_BACKGROUNDCOLOR_DESC"]) + window:CreateLineBackground2 (frame20, "TooltipBackgroundColorPick", "TooltipBackgroundColorLabel", Loc ["STRING_OPTIONS_TOOLTIPS_BACKGROUNDCOLOR_DESC"]) -- abbreviation method g:NewLabel (frame20, _, "$parentTooltipDpsAbbreviateLabel", "TooltipdpsAbbreviateLabel", Loc ["STRING_OPTIONS_TOOLTIPS_ABBREVIATION"], "GameFontHighlightLeft") @@ -900,7 +1039,7 @@ function window:CreateFrame20() frame20.TooltipdpsAbbreviateDropdown:SetPoint ("left", frame20.TooltipdpsAbbreviateLabel, "right", 2, 0) - window:CreateLineBackground (frame20, "TooltipdpsAbbreviateDropdown", "TooltipdpsAbbreviateLabel", Loc ["STRING_OPTIONS_TOOLTIPS_ABBREVIATION_DESC"]) + window:CreateLineBackground2 (frame20, "TooltipdpsAbbreviateDropdown", "TooltipdpsAbbreviateLabel", Loc ["STRING_OPTIONS_TOOLTIPS_ABBREVIATION_DESC"]) -- maximize g:NewLabel (frame20, _, "$parentTooltipMaximizeLabel", "TooltipMaximizeLabel", Loc ["STRING_OPTIONS_TOOLTIPS_MAXIMIZE"], "GameFontHighlightLeft") @@ -935,19 +1074,33 @@ function window:CreateFrame20() frame20.TooltipMaximizeDropdown:SetPoint ("left", frame20.TooltipMaximizeLabel, "right", 2, 0) - window:CreateLineBackground (frame20, "TooltipMaximizeDropdown", "TooltipMaximizeLabel", Loc ["STRING_OPTIONS_TOOLTIPS_MAXIMIZE_DESC"]) + window:CreateLineBackground2 (frame20, "TooltipMaximizeDropdown", "TooltipMaximizeLabel", Loc ["STRING_OPTIONS_TOOLTIPS_MAXIMIZE_DESC"]) --> anchors: - titulo_tooltips:SetPoint (10, -10) - titulo_tooltips_desc:SetPoint (10, -30) + + --general anchor + g:NewLabel (frame20, _, "$parentTooltipsTextsAnchor", "TooltipsTextsAnchorLabel", Loc ["STRING_OPTIONS_TOOLTIP_ANCHORTEXTS"], "GameFontNormal") + g:NewLabel (frame20, _, "$parentTooltipsAnchor", "TooltipsAnchorLabel", Loc ["STRING_OPTIONS_TOOLTIP_ANCHOR"], "GameFontNormal") - frame20.TooltipTextColorLabel:SetPoint (10, -70) - frame20.TooltipTextSizeLabel:SetPoint (10, -95) - frame20.TooltipFontLabel:SetPoint (10, -120) - frame20.TooltipShadowLabel:SetPoint (10, -145) - frame20.TooltipBackgroundColorLabel:SetPoint (10, -170) - frame20.TooltipdpsAbbreviateLabel:SetPoint (10, -195) - frame20.TooltipMaximizeLabel:SetPoint (10, -220) + local x = window.left_start_at + + titulo_tooltips:SetPoint (x, -30) + titulo_tooltips_desc:SetPoint (x, -50) + + local left_side = { + {"TooltipsTextsAnchorLabel", 1, true}, + {"TooltipTextColorLabel", 2}, + {"TooltipTextSizeLabel", 3}, + {"TooltipFontLabel", 4}, + {"TooltipShadowLabel", 5}, + {"TooltipsAnchorLabel", 6, true}, + {"TooltipBackgroundColorLabel", 7}, + {"TooltipdpsAbbreviateLabel", 8}, + {"TooltipMaximizeLabel", 9}, + + } + + window:arrange_menu (frame20, left_side, x, -90) end --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- @@ -981,7 +1134,7 @@ function window:CreateFrame19() LDBIcon:Show ("Details!") end end - window:CreateLineBackground (frame19, "minimapSlider", "minimapLabel", Loc ["STRING_OPTIONS_MINIMAP_DESC"]) + window:CreateLineBackground2 (frame19, "minimapSlider", "minimapLabel", Loc ["STRING_OPTIONS_MINIMAP_DESC"]) --on click action do @@ -1002,7 +1155,7 @@ function window:CreateFrame19() dropdown:SetBackdropColor (unpack (dropdown_backdrop_onleave)) frame19.minimapActionDropdown:SetPoint ("left", frame19.minimapActionLabel, "right", 2, 0) - window:CreateLineBackground (frame19, "minimapActionDropdown", "minimapActionLabel", Loc ["STRING_OPTIONS_MINIMAP_ACTION_DESC"]) + window:CreateLineBackground2 (frame19, "minimapActionDropdown", "minimapActionLabel", Loc ["STRING_OPTIONS_MINIMAP_ACTION_DESC"]) end --> hot corner @@ -1017,7 +1170,7 @@ function window:CreateFrame19() frame19.hotcornerSlider.OnSwitch = function (self, _, value) _detalhes:HideHotCornerButton ("Details!", "TOPLEFT", not value) end - window:CreateLineBackground (frame19, "hotcornerSlider", "hotcornerLabel", Loc ["STRING_OPTIONS_HOTCORNER_DESC"]) + window:CreateLineBackground2 (frame19, "hotcornerSlider", "hotcornerLabel", Loc ["STRING_OPTIONS_HOTCORNER_DESC"]) --on click action do @@ -1038,7 +1191,7 @@ function window:CreateFrame19() dropdown:SetBackdropColor (unpack (dropdown_backdrop_onleave)) frame19.hotcornerActionDropdown:SetPoint ("left", frame19.hotcornerActionLabel, "right", 2, 0) - window:CreateLineBackground (frame19, "hotcornerActionDropdown", "hotcornerActionLabel", Loc ["STRING_OPTIONS_HOTCORNER_ACTION_DESC"]) + window:CreateLineBackground2 (frame19, "hotcornerActionDropdown", "hotcornerActionLabel", Loc ["STRING_OPTIONS_HOTCORNER_ACTION_DESC"]) end --quick click enabled @@ -1049,7 +1202,7 @@ function window:CreateFrame19() frame19.hotcornerQuickClickSlider.OnSwitch = function (self, _, value) _detalhes:QuickHotCornerEnable ("Details!", "TOPLEFT", value) end - window:CreateLineBackground (frame19, "hotcornerQuickClickSlider", "hotcornerQuickClickLabel", Loc ["STRING_OPTIONS_HOTCORNER_QUICK_CLICK_DESC"]) + window:CreateLineBackground2 (frame19, "hotcornerQuickClickSlider", "hotcornerQuickClickLabel", Loc ["STRING_OPTIONS_HOTCORNER_QUICK_CLICK_DESC"]) --quick click function do @@ -1070,7 +1223,7 @@ function window:CreateFrame19() dropdown:SetBackdropColor (unpack (dropdown_backdrop_onleave)) frame19.quickClickDropdown:SetPoint ("left", frame19.quickClickLabel, "right", 2, 0) - window:CreateLineBackground (frame19, "quickClickDropdown", "quickClickLabel", Loc ["STRING_OPTIONS_HOTCORNER_QUICK_CLICK_FUNC_DESC"]) + window:CreateLineBackground2 (frame19, "quickClickDropdown", "quickClickLabel", Loc ["STRING_OPTIONS_HOTCORNER_QUICK_CLICK_FUNC_DESC"]) end --> broker --anchor @@ -1095,24 +1248,30 @@ function window:CreateFrame19() dropdown:SetBackdropColor (unpack (dropdown_backdrop_onleave)) frame19.brokerTextDropdown:SetPoint ("left", frame19.brokerTextLabel, "right", 2, 0) - window:CreateLineBackground (frame19, "brokerTextDropdown", "brokerTextLabel", Loc ["STRING_OPTIONS_DATABROKER_TEXT_DESC"]) + window:CreateLineBackground2 (frame19, "brokerTextDropdown", "brokerTextLabel", Loc ["STRING_OPTIONS_DATABROKER_TEXT_DESC"]) end --> anchors: - titulo_externals:SetPoint (10, -10) - titulo_externals_desc:SetPoint (10, -30) - frame19.minimapAnchorLabel:SetPoint (10, -70) - frame19.minimapLabel:SetPoint (10, -95) - frame19.minimapActionLabel:SetPoint (10, -120) + + local x = window.left_start_at - frame19.hotcornerAnchorLabel:SetPoint (10, -155) - frame19.hotcornerLabel:SetPoint (10, -180) - frame19.hotcornerActionLabel:SetPoint (10, -205) - frame19.hotcornerQuickClickLabel:SetPoint (10, -230) - frame19.quickClickLabel:SetPoint (10, -255) + titulo_externals:SetPoint (x, -30) + titulo_externals_desc:SetPoint (x, -50) - frame19.brokerAnchorLabel:SetPoint (10, -290) - frame19.brokerTextLabel:SetPoint (10, -315) + local left_side = { + {"minimapAnchorLabel", 1, true}, + {"minimapLabel", 2}, + {"minimapActionLabel", 3}, + {"hotcornerAnchorLabel", 4, true}, + {"hotcornerLabel", 5}, + {"hotcornerActionLabel", 6}, + {"hotcornerQuickClickLabel", 7}, + {"quickClickLabel", 8}, + {"brokerAnchorLabel", 9, true}, + {"brokerTextLabel", 10}, + } + + window:arrange_menu (frame19, left_side, x, -90) end @@ -1138,14 +1297,13 @@ function window:CreateFrame18() end local selected = window.lastSwitchList [switch_to] + _G.DetailsOptionsWindow.instance.auto_switch_to = selected - if (selected [1] == "raid") then - local name = _detalhes.RaidTables.Menu [selected [2]] [1] - selected [2] = name - _G.DetailsOptionsWindow.instance.auto_switch_to = selected - else - _G.DetailsOptionsWindow.instance.auto_switch_to = selected - end + --if (selected [1] == "raid") then + + --else + -- _G.DetailsOptionsWindow.instance.auto_switch_to = selected + --end end @@ -1169,7 +1327,7 @@ function window:CreateFrame18() for index, ptable in ipairs (_detalhes.RaidTables.Menu) do tinsert (t, {value = i, label = ptable [1], onclick = onSelectAutoSwitch, icon = ptable [2]}) - window.lastSwitchList [i] = {"raid", index, i} + window.lastSwitchList [i] = {"raid", ptable [4], i} i = i + 1 end @@ -1184,11 +1342,7 @@ function window:CreateFrame18() frame18.autoSwitchDropdown:SetPoint ("left", frame18.autoSwitchLabel, "right", 2, 0) - frame18.autoSwitchDropdown.info = Loc ["STRING_OPTIONS_AUTO_SWITCH_DESC"] - - window:create_line_background (frame18, frame18.autoSwitchLabel, frame18.autoSwitchDropdown) - frame18.autoSwitchDropdown:SetHook ("OnEnter", background_on_enter) - frame18.autoSwitchDropdown:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame18, "autoSwitchDropdown", "autoSwitchLabel", Loc ["STRING_OPTIONS_AUTO_SWITCH_DESC"]) --> auto current segment g:NewSwitch (frame18, _, "$parentAutoCurrentSlider", "autoCurrentSlider", 60, 20, _, _, instance.auto_current) @@ -1202,10 +1356,7 @@ function window:CreateFrame18() instance.auto_current = value end - frame18.autoCurrentSlider.info = Loc ["STRING_OPTIONS_INSTANCE_CURRENT_DESC"] - window:create_line_background (frame18, frame18.autoCurrentLabel, frame18.autoCurrentSlider) - frame18.autoCurrentSlider:SetHook ("OnEnter", background_on_enter) - frame18.autoCurrentSlider:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame18, "autoCurrentSlider", "autoCurrentLabel", Loc ["STRING_OPTIONS_INSTANCE_CURRENT_DESC"]) --> show total bar @@ -1218,10 +1369,7 @@ function window:CreateFrame18() instance:InstanceReset() end - frame18.totalBarSlider.info = Loc ["STRING_OPTIONS_SHOW_TOTALBAR_DESC"] - window:create_line_background (frame18, frame18.totalBarLabel, frame18.totalBarSlider) - frame18.totalBarSlider:SetHook ("OnEnter", background_on_enter) - frame18.totalBarSlider:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame18, "totalBarSlider", "totalBarLabel", Loc ["STRING_OPTIONS_SHOW_TOTALBAR_DESC"]) --> total bar color local totalbarcolor_callback = function (button, r, g, b, a) @@ -1233,11 +1381,8 @@ function window:CreateFrame18() g:NewColorPickButton (frame18, "$parentTotalBarColorPick", "totalBarColorPick", totalbarcolor_callback) g:NewLabel (frame18, _, "$parentTotalBarColorPickLabel", "totalBarPickColorLabel", Loc ["STRING_OPTIONS_COLOR"], "GameFontHighlightLeft") frame18.totalBarColorPick:SetPoint ("left", frame18.totalBarPickColorLabel, "right", 2, 0) - - frame18.totalBarColorPick.info = Loc ["STRING_OPTIONS_SHOW_TOTALBAR_COLOR_DESC"] - window:create_line_background (frame18, frame18.totalBarPickColorLabel, frame18.totalBarColorPick) - frame18.totalBarColorPick:SetHook ("OnEnter", background_on_enter) - frame18.totalBarColorPick:SetHook ("OnLeave", background_on_leave) + + window:CreateLineBackground2 (frame18, "totalBarColorPick", "totalBarPickColorLabel", Loc ["STRING_OPTIONS_SHOW_TOTALBAR_COLOR_DESC"]) --> total bar only in group g:NewLabel (frame18, _, "$parentTotalBarOnlyInGroupLabel", "totalBarOnlyInGroupLabel", Loc ["STRING_OPTIONS_SHOW_TOTALBAR_INGROUP"], "GameFontHighlightLeft") @@ -1249,10 +1394,7 @@ function window:CreateFrame18() instance:InstanceReset() end - frame18.totalBarOnlyInGroupSlider.info = Loc ["STRING_OPTIONS_SHOW_TOTALBAR_INGROUP_DESC"] - window:create_line_background (frame18, frame18.totalBarOnlyInGroupLabel, frame18.totalBarOnlyInGroupSlider) - frame18.totalBarOnlyInGroupSlider:SetHook ("OnEnter", background_on_enter) - frame18.totalBarOnlyInGroupSlider:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame18, "totalBarOnlyInGroupSlider", "totalBarOnlyInGroupLabel", Loc ["STRING_OPTIONS_SHOW_TOTALBAR_INGROUP_DESC"]) --> total bar icon local totalbar_pickicon_callback = function (texture) @@ -1270,14 +1412,10 @@ function window:CreateFrame18() frame18.totalBarIconButton:SetPoint ("left", frame18.totalBarIconLabel, "right", 2, 0) frame18.totalBarIconTexture:SetPoint ("left", frame18.totalBarIconLabel, "right", 2, 0) - frame18.totalBarIconButton.info = Loc ["STRING_OPTIONS_SHOW_TOTALBAR_ICON_DESC"] - window:create_line_background (frame18, frame18.totalBarIconLabel, frame18.totalBarIconButton) - frame18.totalBarIconButton:SetHook ("OnEnter", background_on_enter) - frame18.totalBarIconButton:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame18, "totalBarIconButton", "totalBarIconLabel", Loc ["STRING_OPTIONS_SHOW_TOTALBAR_ICON_DESC"]) --> instances - g:NewLabel (frame18, _, "$parentInstancesMiscAnchor", "instancesMiscLabel", Loc ["STRING_OPTIONS_INSTANCES"], "GameFontNormal") - + g:NewLabel (frame18, _, "$parentDeleteInstanceLabel", "deleteInstanceLabel", Loc ["STRING_OPTIONS_INSTANCE_DELETE"], "GameFontHighlightLeft") local onSelectDeleteInstance = function (_, _, selected) @@ -1339,11 +1477,8 @@ function window:CreateFrame18() frame18.deleteInstanceDropdown:SetPoint ("left", frame18.deleteInstanceLabel, "right", 2, 0) - frame18.deleteInstanceDropdown.info = Loc ["STRING_OPTIONS_INSTANCE_DELETE_DESC"] - - window:create_line_background (frame18, frame18.deleteInstanceLabel, frame18.deleteInstanceDropdown) - frame18.deleteInstanceDropdown:SetHook ("OnEnter", background_on_enter) - frame18.deleteInstanceDropdown:SetHook ("OnLeave", background_on_leave) + local desc = window:CreateLineBackground2 (frame18, "deleteInstanceDropdown", "deleteInstanceLabel", Loc ["STRING_OPTIONS_INSTANCE_DELETE_DESC"]) + desc:SetWidth (180) local delete_instance = function (self) if (self.selected_instance) then @@ -1362,27 +1497,39 @@ function window:CreateFrame18() --local confirm_button = g:NewButton (frame18, nil, "$parentDeleteInstanceButton", "deleteInstanceButton", 60, 20, delete_instance, nil, nil, nil, "delete") --confirm_button:InstallCustomTexture() - --> anchors - - titulo_misc_settings:SetPoint (10, -10) - titulo_misc_settings_desc:SetPoint (10, -30) + --> Anchors + g:NewLabel (frame18, _, "$parentInstancesMiscAnchor", "instancesMiscLabel", Loc ["STRING_OPTIONS_INSTANCES"], "GameFontNormal") g:NewLabel (frame18, _, "$parentSwitchesAnchor", "switchesAnchorLabel", "Switches:", "GameFontNormal") - frame18.switchesAnchorLabel:SetPoint (10, -70) - frame18.autoSwitchLabel:SetPoint (10, -95) - frame18.autoCurrentLabel:SetPoint (10, -120) --auto current - g:NewLabel (frame18, _, "$parentTotalBarAnchor", "totalBarAnchorLabel", "Total Bar:", "GameFontNormal") - frame18.totalBarAnchorLabel:SetPoint (10, -155) - frame18.totalBarIconLabel:SetPoint (10, -180) - --frame18.totalBarPickColorLabel:SetPoint (10, -415) - frame18.totalBarPickColorLabel:SetPoint ("left", frame18.totalBarIconTexture, "right", 10, 0) - frame18.totalBarLabel:SetPoint (10, -205) - frame18.totalBarOnlyInGroupLabel:SetPoint (10, -230) - frame18.instancesMiscLabel:SetPoint (10, -265) - frame18.deleteInstanceLabel:SetPoint (10, -290) + --frame18.totalBarPickColorLabel:SetPoint ("left", frame18.totalBarIconTexture, "right", 10, 0) + local x = window.left_start_at + + titulo_misc_settings:SetPoint (x, -30) + titulo_misc_settings_desc:SetPoint (x, -50) + + local left_side = { + {"switchesAnchorLabel", 1, true}, + {"autoSwitchLabel", 2}, + {"autoCurrentLabel", 3}, + + {"totalBarAnchorLabel", 4, true}, + {"totalBarIconLabel", 5}, + {"totalBarPickColorLabel", 6}, + {"totalBarLabel", 7}, + {"totalBarOnlyInGroupLabel", 8}, + } + + window:arrange_menu (frame18, left_side, x, -90) + + local right_side = { + {"instancesMiscLabel", 1, true}, + {"deleteInstanceLabel", 2}, + } + + window:arrange_menu (frame18, right_side, window.right_start_at, -90) end --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- @@ -1394,8 +1541,7 @@ function window:CreateFrame17() local titulo_instance_settings = g:NewLabel (frame17, _, "$parentTituloInstanceSettingsText", "InstanceSettingsLabel", Loc ["STRING_OPTIONS_SHOWHIDE"], "GameFontNormal", 16) local titulo_instance_settings_desc = g:NewLabel (frame17, _, "$parentInstanceSettingsText2", "InstanceSettingsLabel", Loc ["STRING_OPTIONS_SHOWHIDE_DESC"], "GameFontNormal", 9, "white") - titulo_instance_settings_desc.width = 350 - titulo_instance_settings_desc.height = 40 + titulo_instance_settings_desc:SetSize (450, 20) --> combat alpha modifier @@ -1425,11 +1571,7 @@ function window:CreateFrame17() frame17.combatAlphaDropdown:SetPoint ("left", frame17.combatAlphaLabel, "right", 2, 0) - frame17.combatAlphaDropdown.info = Loc ["STRING_OPTIONS_COMBAT_ALPHA_DESC"] - - window:create_line_background (frame17, frame17.combatAlphaLabel, frame17.combatAlphaDropdown) - frame17.combatAlphaDropdown:SetHook ("OnEnter", background_on_enter) - frame17.combatAlphaDropdown:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame17, "combatAlphaDropdown", "combatAlphaLabel", Loc ["STRING_OPTIONS_COMBAT_ALPHA_DESC"]) g:NewLabel (frame17, _, "$parentHideOnCombatAlphaLabel", "hideOnCombatAlphaLabel", Loc ["STRING_OPTIONS_HIDECOMBATALPHA"], "GameFontHighlightLeft") @@ -1444,11 +1586,7 @@ function window:CreateFrame17() _G.DetailsOptionsWindow.instance:SetCombatAlpha (nil, nil, true) end) - frame17.hideOnCombatAlphaSlider.info = Loc ["STRING_OPTIONS_HIDECOMBATALPHA_DESC"] - - window:create_line_background (frame17, frame17.hideOnCombatAlphaLabel, frame17.hideOnCombatAlphaSlider) - frame17.hideOnCombatAlphaSlider:SetHook ("OnEnter", background_on_enter) - frame17.hideOnCombatAlphaSlider:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame17, "hideOnCombatAlphaSlider", "hideOnCombatAlphaLabel", Loc ["STRING_OPTIONS_HIDECOMBATALPHA_DESC"]) --> auto transparency --> alpha onenter onleave auto transparency @@ -1474,21 +1612,12 @@ function window:CreateFrame17() g:NewLabel (frame17, _, "$parentMenuOnEnterLeaveAlphaLabel", "alphaSwitchLabel", Loc ["STRING_OPTIONS_MENU_ALPHAENABLED"], "GameFontHighlightLeft") g:NewLabel (frame17, _, "$parentMenuOnEnterAlphaLabel", "menuOnEnterLabel", Loc ["STRING_OPTIONS_MENU_ALPHAENTER"], "GameFontHighlightLeft") g:NewLabel (frame17, _, "$parentMenuOnLeaveAlphaLabel", "menuOnLeaveLabel", Loc ["STRING_OPTIONS_MENU_ALPHALEAVE"], "GameFontHighlightLeft") - - frame17.alphaSwitch.info = Loc ["STRING_OPTIONS_MENU_ALPHAENABLED_DESC"] - window:create_line_background (frame17, frame17.alphaSwitchLabel, frame17.alphaSwitch) - frame17.alphaSwitch:SetHook ("OnEnter", background_on_enter) - frame17.alphaSwitch:SetHook ("OnLeave", background_on_leave) - frame17.menuOnEnterSlider.info = Loc ["STRING_OPTIONS_MENU_ALPHAENTER_DESC"] - window:create_line_background (frame17, frame17.menuOnEnterLabel, frame17.menuOnEnterSlider) - frame17.menuOnEnterSlider:SetHook ("OnEnter", background_on_enter) - frame17.menuOnEnterSlider:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame17, "alphaSwitch", "alphaSwitchLabel", Loc ["STRING_OPTIONS_MENU_ALPHAENABLED_DESC"]) - frame17.menuOnLeaveSlider.info = Loc ["STRING_OPTIONS_MENU_ALPHALEAVE_DESC"] - window:create_line_background (frame17, frame17.menuOnLeaveLabel, frame17.menuOnLeaveSlider) - frame17.menuOnLeaveSlider:SetHook ("OnEnter", background_on_enter) - frame17.menuOnLeaveSlider:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame17, "menuOnEnterSlider", "menuOnEnterLabel", Loc ["STRING_OPTIONS_MENU_ALPHAENTER_DESC"]) + + window:CreateLineBackground2 (frame17, "menuOnLeaveSlider", "menuOnLeaveLabel", Loc ["STRING_OPTIONS_MENU_ALPHALEAVE_DESC"]) frame17.alphaSwitch:SetPoint ("left", frame17.alphaSwitchLabel, "right", 2) frame17.menuOnEnterSlider:SetPoint ("left", frame17.menuOnEnterLabel, "right", 2) @@ -1501,10 +1630,7 @@ function window:CreateFrame17() g:NewLabel (frame17, _, "$parentMenuOnEnterLeaveAlphaIconsTooLabel", "alphaIconsTooLabel", Loc ["STRING_OPTIONS_MENU_IGNOREBARS"], "GameFontHighlightLeft") g:NewSwitch (frame17, _, "$parentMenuOnEnterLeaveAlphaIconsTooSwitch", "alphaIconsTooSwitch", 60, 20, _, _, instance.menu_alpha.ignorebars) - frame17.alphaIconsTooSwitch.info = Loc ["STRING_OPTIONS_MENU_IGNOREBARS_DESC"] - window:create_line_background (frame17, frame17.alphaIconsTooLabel, frame17.alphaIconsTooSwitch) - frame17.alphaIconsTooSwitch:SetHook ("OnEnter", background_on_enter) - frame17.alphaIconsTooSwitch:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame17, "alphaIconsTooSwitch", "alphaIconsTooLabel", Loc ["STRING_OPTIONS_MENU_IGNOREBARS_DESC"]) frame17.alphaIconsTooSwitch:SetPoint ("left", frame17.alphaIconsTooLabel, "right", 2) @@ -1528,24 +1654,26 @@ function window:CreateFrame17() return true end) - - --> auto hide menus - - - --> anchors - titulo_instance_settings:SetPoint (10, -10) - titulo_instance_settings_desc:SetPoint (10, -30) + + local x = window.left_start_at - frame17.hideInCombatAnchor:SetPoint (10, -80) - frame17.combatAlphaLabel:SetPoint (10, -105) - frame17.hideOnCombatAlphaLabel:SetPoint (10, -130) + titulo_instance_settings:SetPoint (x, -30) + titulo_instance_settings_desc:SetPoint (x, -50) - frame17.menuAlphaAnchorLabel:SetPoint (10, -165) - frame17.alphaSwitchLabel:SetPoint (10, -190) - frame17.menuOnEnterLabel:SetPoint (10, -215) - frame17.menuOnLeaveLabel:SetPoint (10, -240) - frame17.alphaIconsTooLabel:SetPoint (10, -265) + local left_side = { + {"hideInCombatAnchor", 1, true}, + {"combatAlphaLabel", 2}, + {"hideOnCombatAlphaLabel", 3}, + {"menuAlphaAnchorLabel", 4, true}, + {"alphaSwitchLabel", 5}, + {"menuOnEnterLabel", 6}, + {"menuOnLeaveLabel", 7}, + {"alphaIconsTooLabel", 8}, + + } + + window:arrange_menu (frame17, left_side, x, -90) end --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- @@ -2185,7 +2313,7 @@ function window:CreateFrame14() frame14.attributeEnabledSwitch.OnSwitch = function (self, instance, value) instance:AttributeMenu (value) end - window:CreateLineBackground (frame14, "attributeEnabledSwitch", "attributeEnabledLabel", Loc ["STRING_OPTIONS_MENU_ATTRIBUTE_ENABLED_DESC"]) + window:CreateLineBackground2 (frame14, "attributeEnabledSwitch", "attributeEnabledLabel", Loc ["STRING_OPTIONS_MENU_ATTRIBUTE_ENABLED_DESC"]) --anchors g:NewLabel (frame14, _, "$parentAttributeAnchorXLabel", "attributeAnchorXLabel", Loc ["STRING_OPTIONS_MENU_ATTRIBUTE_ANCHORX"], "GameFontHighlightLeft") @@ -2209,8 +2337,8 @@ function window:CreateFrame14() instance:AttributeMenu (nil, nil, amount) end) - window:CreateLineBackground (frame14, "attributeAnchorXSlider", "attributeAnchorXLabel", Loc ["STRING_OPTIONS_MENU_ATTRIBUTE_ANCHORX_DESC"]) - window:CreateLineBackground (frame14, "attributeAnchorYSlider", "attributeAnchorYLabel", Loc ["STRING_OPTIONS_MENU_ATTRIBUTE_ANCHORY_DESC"]) + window:CreateLineBackground2 (frame14, "attributeAnchorXSlider", "attributeAnchorXLabel", Loc ["STRING_OPTIONS_MENU_ATTRIBUTE_ANCHORX_DESC"]) + window:CreateLineBackground2 (frame14, "attributeAnchorYSlider", "attributeAnchorYLabel", Loc ["STRING_OPTIONS_MENU_ATTRIBUTE_ANCHORY_DESC"]) --font local on_select_attribute_font = function (self, instance, fontName) @@ -2235,7 +2363,7 @@ function window:CreateFrame14() frame14.attributeFontDropdown:SetPoint ("left", frame14.attributeFontLabel, "right", 2) - window:CreateLineBackground (frame14, "attributeFontDropdown", "attributeFontLabel", Loc ["STRING_OPTIONS_MENU_ATTRIBUTE_FONT_DESC"]) + window:CreateLineBackground2 (frame14, "attributeFontDropdown", "attributeFontLabel", Loc ["STRING_OPTIONS_MENU_ATTRIBUTE_FONT_DESC"]) --size g:NewLabel (frame14, _, "$parentAttributeTextSizeLabel", "attributeTextSizeLabel", Loc ["STRING_OPTIONS_MENU_ATTRIBUTE_TEXTSIZE"], "GameFontHighlightLeft") @@ -2250,7 +2378,7 @@ function window:CreateFrame14() instance:AttributeMenu (nil, nil, nil, nil, amount) end) - window:CreateLineBackground (frame14, "attributeTextSizeSlider", "attributeTextSizeLabel", Loc ["STRING_OPTIONS_MENU_ATTRIBUTE_TEXTSIZE_DESC"]) + window:CreateLineBackground2 (frame14, "attributeTextSizeSlider", "attributeTextSizeLabel", Loc ["STRING_OPTIONS_MENU_ATTRIBUTE_TEXTSIZE_DESC"]) --color local attribute_text_color_callback = function (button, r, g, b, a) @@ -2261,7 +2389,7 @@ function window:CreateFrame14() frame14.attributeTextColorPick:SetPoint ("left", frame14.attributeTextColorLabel, "right", 2, 0) - window:CreateLineBackground (frame14, "attributeTextColorPick", "attributeTextColorLabel", Loc ["STRING_OPTIONS_MENU_ATTRIBUTE_TEXTCOLOR_DESC"]) + window:CreateLineBackground2 (frame14, "attributeTextColorPick", "attributeTextColorLabel", Loc ["STRING_OPTIONS_MENU_ATTRIBUTE_TEXTCOLOR_DESC"]) --shadow g:NewLabel (frame14, _, "$parentAttributeShadowLabel", "attributeShadowLabel", Loc ["STRING_OPTIONS_MENU_ATTRIBUTE_SHADOW"], "GameFontHighlightLeft") @@ -2270,7 +2398,7 @@ function window:CreateFrame14() frame14.attributeShadowSwitch.OnSwitch = function (self, instance, value) instance:AttributeMenu (nil, nil, nil, nil, nil, nil, nil, value) end - window:CreateLineBackground (frame14, "attributeShadowSwitch", "attributeShadowLabel", Loc ["STRING_OPTIONS_MENU_ATTRIBUTE_SHADOW_DESC"]) + window:CreateLineBackground2 (frame14, "attributeShadowSwitch", "attributeShadowLabel", Loc ["STRING_OPTIONS_MENU_ATTRIBUTE_SHADOW_DESC"]) --side local side_switch_func = function (slider, value) if (value == 2) then return false elseif (value == 1) then return true end end @@ -2283,19 +2411,34 @@ function window:CreateFrame14() instance:AttributeMenu (nil, nil, nil, nil, nil, nil, value) end --frame14.attributeSideSwitch:SetThumbSize (50) - window:CreateLineBackground (frame14, "attributeSideSwitch", "attributeSideLabel", Loc ["STRING_OPTIONS_MENU_ATTRIBUTE_SIDE_DESC"]) + window:CreateLineBackground2 (frame14, "attributeSideSwitch", "attributeSideLabel", Loc ["STRING_OPTIONS_MENU_ATTRIBUTE_SIDE_DESC"]) --frame14.attributeLabel:SetPoint (10, -205) - titulo_attributetext:SetPoint (10, -10) - titulo_attributetext_desc:SetPoint (10, -30) - frame14.attributeEnabledLabel:SetPoint (10, -70) - frame14.attributeAnchorXLabel:SetPoint (10, -95) - frame14.attributeAnchorYLabel:SetPoint (10, -120) - frame14.attributeFontLabel:SetPoint (10, -145) - frame14.attributeTextSizeLabel:SetPoint (10, -170) - frame14.attributeTextColorLabel:SetPoint (10, -195) - frame14.attributeShadowLabel:SetPoint (10, -220) - frame14.attributeSideLabel:SetPoint (10, -245) + + --general anchor + g:NewLabel (frame14, _, "$parentAttributeTextTextAnchor", "TextAnchorLabel", Loc ["STRING_OPTIONS_MENU_ATTRIBUTETEXT_ANCHOR"], "GameFontNormal") + g:NewLabel (frame14, _, "$parentAttributeTextSettingsAnchor", "SettingsAnchorLabel", Loc ["STRING_OPTIONS_MENU_ATTRIBUTESETTINGS_ANCHOR"], "GameFontNormal") + + local x = window.left_start_at + + titulo_attributetext:SetPoint (x, -30) + titulo_attributetext_desc:SetPoint (x, -50) + + local left_side = { + {"TextAnchorLabel", 6, true}, + {"attributeTextColorLabel", 7}, + {"attributeTextSizeLabel", 8}, + {"attributeFontLabel", 9}, + {"attributeShadowLabel", 10}, + {"SettingsAnchorLabel", 1, true}, + {"attributeEnabledLabel", 2}, + {"attributeAnchorXLabel", 3}, + {"attributeAnchorYLabel", 4}, + {"attributeSideLabel", 5}, + } + + window:arrange_menu (frame14, left_side, x, -90) + end @@ -2327,13 +2470,13 @@ function window:CreateFrame1() g:NewLabel (frame1, _, "$parentNickNameLabel", "nicknameLabel", Loc ["STRING_OPTIONS_NICKNAME"], "GameFontHighlightLeft") - g:NewTextEntry (frame1, _, "$parentNicknameEntry", "nicknameEntry", SLIDER_WIDTH, 20, onPressEnter) - frame1.nicknameEntry:SetPoint ("left", frame1.nicknameLabel, "right", 2, 0) - frame1.nicknameEntry.info = Loc ["STRING_OPTIONS_NICKNAME_DESC"] + local box = g:NewTextEntry (frame1, _, "$parentNicknameEntry", "nicknameEntry", SLIDER_WIDTH, 20, onPressEnter) + --box:SetBackdrop ({bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background", edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border", tile = true, + --edgeSize = 10, tileSize = 16, insets = {left = 1, right = 1, top = 0, bottom = 1}}) - window:create_line_background (frame1, frame1.nicknameLabel, frame1.nicknameEntry) - frame1.nicknameEntry:SetHook ("OnEnter", background_on_enter) - frame1.nicknameEntry:SetHook ("OnLeave", background_on_leave) + frame1.nicknameEntry:SetPoint ("left", frame1.nicknameLabel, "right", 2, 0) + + window:CreateLineBackground2 (frame1, "nicknameEntry", "nicknameLabel", Loc ["STRING_OPTIONS_NICKNAME_DESC"]) local avatarcallback = function (textureAvatar, textureAvatarTexCoord, textureBackground, textureBackgroundTexCoord, textureBackgroundColor) _detalhes:SetNicknameBackground (textureBackground, textureBackgroundTexCoord, textureBackgroundColor, true) @@ -2354,11 +2497,8 @@ function window:CreateFrame1() g:NewButton (frame1, _, "$parentAvatarFrame", "chooseAvatarButton", frame1.nicknameLabel:GetStringWidth() + SLIDER_WIDTH + 2, 14, openAtavarPickFrame, nil, nil, nil, Loc ["STRING_OPTIONS_AVATAR"]) frame1.chooseAvatarButton:InstallCustomTexture() - frame1.chooseAvatarButton.info = Loc ["STRING_OPTIONS_AVATAR_DESC"] - window:create_line_background (frame1, frame1.chooseAvatarButton, frame1.chooseAvatarButton) - frame1.chooseAvatarButton:SetHook ("OnEnter", background_on_enter) - frame1.chooseAvatarButton:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame1, "chooseAvatarButton", "chooseAvatarButton", Loc ["STRING_OPTIONS_AVATAR_DESC"]) --> avatar preview g:NewImage (frame1, nil, 128, 64, nil, nil, "avatarPreview", "$parentAvatarPreviewTexture") @@ -2376,14 +2516,12 @@ function window:CreateFrame1() g:NewLabel (frame1, _, "$parentRealmNameLabel", "realmNameLabel", Loc ["STRING_OPTIONS_REALMNAME"], "GameFontHighlightLeft") g:NewSwitch (frame1, _, "$parentRealmNameSlider", "realmNameSlider", 60, 20, _, _, _detalhes.remove_realm_from_name) frame1.realmNameSlider:SetPoint ("left", frame1.realmNameLabel, "right", 2) - frame1.realmNameSlider.info = Loc ["STRING_OPTIONS_REALMNAME_DESC"] + frame1.realmNameSlider.OnSwitch = function (self, _, value) _detalhes.remove_realm_from_name = value end - window:create_line_background (frame1, frame1.realmNameLabel, frame1.realmNameSlider) - frame1.realmNameSlider:SetHook ("OnEnter", background_on_enter) - frame1.realmNameSlider:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame1, "realmNameSlider", "realmNameLabel", Loc ["STRING_OPTIONS_REALMNAME_DESC"]) --> Max Segments @@ -2401,11 +2539,8 @@ function window:CreateFrame1() frame1.segmentsSlider:SetHook ("OnValueChange", function (self, _, amount) --> slider, fixedValue, sliderValue _detalhes.segments_amount = math.floor (amount) end) - frame1.segmentsSlider.info = Loc ["STRING_OPTIONS_MAXSEGMENTS_DESC"] - window:create_line_background (frame1, frame1.segmentsLabel, frame1.segmentsSlider) - frame1.segmentsSlider:SetHook ("OnEnter", background_on_enter) - frame1.segmentsSlider:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame1, "segmentsSlider", "segmentsLabel", Loc ["STRING_OPTIONS_MAXSEGMENTS_DESC"]) --> Use Scroll Bar g:NewLabel (frame1, _, "$parentUseScrollLabel", "scrollLabel", Loc ["STRING_OPTIONS_SCROLLBAR"], "GameFontHighlightLeft") @@ -2430,10 +2565,7 @@ function window:CreateFrame1() _detalhes:AtualizaGumpPrincipal (-1, true) --atualiza todas as instancias end - frame1.scrollSlider.info = Loc ["STRING_OPTIONS_SCROLLBAR_DESC"] - window:create_line_background (frame1, frame1.scrollLabel, frame1.scrollSlider) - frame1.scrollSlider:SetHook ("OnEnter", background_on_enter) - frame1.scrollSlider:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame1, "scrollSlider", "scrollLabel", Loc ["STRING_OPTIONS_SCROLLBAR_DESC"]) --> Max Instances g:NewLabel (frame1, _, "$parentLabelMaxInstances", "maxInstancesLabel", Loc ["STRING_OPTIONS_MAXINSTANCES"], "GameFontHighlightLeft") @@ -2447,11 +2579,8 @@ function window:CreateFrame1() frame1.maxInstancesSlider:SetHook ("OnValueChange", function (self, _, amount) --> slider, fixedValue, sliderValue _detalhes.instances_amount = amount end) - frame1.maxInstancesSlider.info = Loc ["STRING_OPTIONS_MAXINSTANCES_DESC"] - window:create_line_background (frame1, frame1.maxInstancesLabel, frame1.maxInstancesSlider) - frame1.maxInstancesSlider:SetHook ("OnEnter", background_on_enter) - frame1.maxInstancesSlider:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame1, "maxInstancesSlider", "maxInstancesLabel", Loc ["STRING_OPTIONS_MAXINSTANCES_DESC"]) ---> Abbreviation Type g:NewLabel (frame1, _, "$parentDpsAbbreviateLabel", "dpsAbbreviateLabel", Loc ["STRING_OPTIONS_PS_ABBREVIATE"], "GameFontHighlightLeft") @@ -2489,22 +2618,9 @@ function window:CreateFrame1() d:SetBackdropColor (unpack (dropdown_backdrop_onleave)) frame1.dpsAbbreviateDropdown:SetPoint ("left", frame1.dpsAbbreviateLabel, "right", 2, 0) + + window:CreateLineBackground2 (frame1, "dpsAbbreviateDropdown", "dpsAbbreviateLabel", Loc ["STRING_OPTIONS_PS_ABBREVIATE_DESC"]) - frame1.dpsAbbreviateDropdown.info = Loc ["STRING_OPTIONS_PS_ABBREVIATE_DESC"] - - window:create_line_background (frame1, frame1.dpsAbbreviateLabel, frame1.dpsAbbreviateDropdown) - frame1.dpsAbbreviateDropdown:SetHook ("OnEnter", background_on_enter) - frame1.dpsAbbreviateDropdown:SetHook ("OnLeave", background_on_leave) - - titulo_persona:SetPoint (10, -10) - titulo_persona_desc:SetPoint (10, -30) - frame1.nicknameLabel:SetPoint (10, -70) - frame1.chooseAvatarButton:SetPoint (11, -90) - - frame1.avatarPreview:SetPoint (-8, -107) - frame1.avatarPreview2:SetPoint (-8, -109) - frame1.avatarNickname:SetPoint (100, -142) - local avatar = NickTag:GetNicknameAvatar (UnitGUID ("player"), NICKTAG_DEFAULT_AVATAR, true) local background, cords, color = NickTag:GetNicknameBackground (UnitGUID ("player"), NICKTAG_DEFAULT_BACKGROUND, NICKTAG_DEFAULT_BACKGROUND_CORDS, {1, 1, 1, 1}, true) @@ -2519,14 +2635,11 @@ function window:CreateFrame1() g:NewSwitch (frame1, _, "$parentAnimateSlider", "animateSlider", 60, 20, _, _, _detalhes.use_row_animations) -- ltext, rtext, defaultv frame1.animateSlider:SetPoint ("left",frame1.animateLabel, "right", 2, 0) - frame1.animateSlider.info = Loc ["STRING_OPTIONS_ANIMATEBARS_DESC"] frame1.animateSlider.OnSwitch = function (self, _, value) --> slider, fixedValue, sliderValue (false, true) _detalhes.use_row_animations = value end - window:create_line_background (frame1, frame1.animateLabel, frame1.animateSlider) - frame1.animateSlider:SetHook ("OnEnter", background_on_enter) - frame1.animateSlider:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame1, "animateSlider", "animateLabel", Loc ["STRING_OPTIONS_ANIMATEBARS_DESC"]) --> update speed @@ -2556,27 +2669,42 @@ function window:CreateFrame1() end) updateColor (frame1.updatespeedSlider, _detalhes.update_speed) - frame1.updatespeedSlider.info = Loc ["STRING_OPTIONS_WINDOWSPEED_DESC"] - - window:create_line_background (frame1, frame1.updatespeedLabel, frame1.updatespeedSlider) - frame1.updatespeedSlider:SetHook ("OnEnter", background_on_enter) - frame1.updatespeedSlider:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame1, "updatespeedSlider", "updatespeedLabel", Loc ["STRING_OPTIONS_WINDOWSPEED_DESC"]) --> anchors + g:NewLabel (frame1, _, "$parentGeneralAnchor", "GeneralAnchorLabel", Loc ["STRING_OPTIONS_GENERAL_ANCHOR"], "GameFontNormal") + g:NewLabel (frame1, _, "$parentIdentityAnchor", "GeneralIdentityLabel", Loc ["STRING_OPTIONS_AVATAR_ANCHOR"], "GameFontNormal") + local w_start = 10 - titulo_display:SetPoint (10, -200) - titulo_display_desc:SetPoint (10, -220) + titulo_display:SetPoint (window.left_start_at, -30) + titulo_display_desc:SetPoint (window.left_start_at, -50) - frame1.animateLabel:SetPoint (w_start, -260) - frame1.updatespeedLabel:SetPoint (w_start, -285) + local avatar_x_anchor = window.right_start_at - frame1.segmentsLabel:SetPoint (w_start, -310) - frame1.scrollLabel:SetPoint (w_start, -335) - frame1.maxInstancesLabel:SetPoint (w_start, -360) - frame1.dpsAbbreviateLabel:SetPoint (w_start, -385) - frame1.realmNameLabel:SetPoint (w_start, -410) + frame1.GeneralIdentityLabel:SetPoint (avatar_x_anchor, -90) + + frame1.nicknameLabel:SetPoint (avatar_x_anchor, -115) + frame1.chooseAvatarButton:SetPoint (avatar_x_anchor+1, -140) + + frame1.avatarPreview:SetPoint (avatar_x_anchor-8, -157) + frame1.avatarPreview2:SetPoint (avatar_x_anchor-8, -159) + frame1.avatarNickname:SetPoint (avatar_x_anchor+100, -191) + + frame1.realmNameLabel:SetPoint (avatar_x_anchor, -235) + + local left_side = { + {"GeneralAnchorLabel", 1, true}, + {"animateLabel", 2}, + {"updatespeedLabel", 3}, + {"segmentsLabel", 4}, + {"scrollLabel", 5}, + {"maxInstancesLabel", 6}, + {"dpsAbbreviateLabel", 7}, + } + + window:arrange_menu (frame1, left_side, window.left_start_at, window.top_start_at) end @@ -2591,10 +2719,9 @@ function window:CreateFrame2() --> titles local titulo_combattweeks = g:NewLabel (frame2, _, "$parentTituloCombatTweeks", "tituloCombatTweeksLabel", Loc ["STRING_OPTIONS_COMBATTWEEKS"], "GameFontNormal", 16) - titulo_combattweeks:SetPoint (10, -10) local titulo_combattweeks_desc = g:NewLabel (frame2, _, "$parentCombatTweeks2", "tituloCombatTweeks2Label", Loc ["STRING_OPTIONS_COMBATTWEEKS_DESC"], "GameFontNormal", 9, "white") titulo_combattweeks_desc.width = 320 - titulo_combattweeks_desc:SetPoint (10, -30) + --> Frags PVP Mode g:NewLabel (frame2, _, "$parentLabelFragsPvP", "fragsPvpLabel", Loc ["STRING_OPTIONS_PVPFRAGS"], "GameFontHighlightLeft") @@ -2604,11 +2731,8 @@ function window:CreateFrame2() frame2.fragsPvpSlider.OnSwitch = function (self, _, amount) --> slider, fixedValue, sliderValue _detalhes.only_pvp_frags = amount end - frame2.fragsPvpSlider.info = Loc ["STRING_OPTIONS_PVPFRAGS_DESC"] - window:create_line_background (frame2, frame2.fragsPvpLabel, frame2.fragsPvpSlider) - frame2.fragsPvpSlider:SetHook ("OnEnter", background_on_enter) - frame2.fragsPvpSlider:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame2, "fragsPvpSlider", "fragsPvpLabel", Loc ["STRING_OPTIONS_PVPFRAGS_DESC"]) --> Time Type g:NewLabel (frame2, _, "$parentTimeTypeLabel", "timetypeLabel", Loc ["STRING_OPTIONS_TIMEMEASURE"], "GameFontHighlightLeft") @@ -2631,18 +2755,25 @@ function window:CreateFrame2() d:SetBackdropColor (unpack (dropdown_backdrop_onleave)) frame2.timetypeDropdown:SetPoint ("left", frame2.timetypeLabel, "right", 2, 0) - - frame2.timetypeDropdown.info = Loc ["STRING_OPTIONS_TIMEMEASURE_DESC"] - - window:create_line_background (frame2, frame2.timetypeLabel, frame2.timetypeDropdown) - frame2.timetypeDropdown:SetHook ("OnEnter", background_on_enter) - frame2.timetypeDropdown:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame2, "timetypeDropdown", "timetypeLabel", Loc ["STRING_OPTIONS_TIMEMEASURE_DESC"]) --> anchors - - frame2.fragsPvpLabel:SetPoint (10, -75) - frame2.timetypeLabel:SetPoint (10, -100) + --general anchor + g:NewLabel (frame2, _, "$parentGeneralAnchor", "GeneralAnchorLabel", Loc ["STRING_OPTIONS_GENERAL_ANCHOR"], "GameFontNormal") + + local x = window.left_start_at + + titulo_combattweeks:SetPoint (x, -30) + titulo_combattweeks_desc:SetPoint (x, -50) + + local left_side = { + {"GeneralAnchorLabel", 1, true}, + {"fragsPvpLabel", 2}, + {"timetypeLabel", 3}, + } + + window:arrange_menu (frame2, left_side, x, window.top_start_at) end --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- @@ -2667,10 +2798,7 @@ function window:CreateFrame13() info_holder_frame:SetPoint ("topleft", current_profile_label.widget, "topleft") info_holder_frame:SetPoint ("bottomright", current_profile_label2.widget, "bottomright") - info_holder_frame.info = Loc ["STRING_OPTIONS_PROFILES_CURRENT_DESC"] - window:create_line_background (frame13, current_profile_label.widget, info_holder_frame) - info_holder_frame:SetScript ("OnEnter", background_on_enter) - info_holder_frame:SetScript ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame13, info_holder_frame, current_profile_label.widget, Loc ["STRING_OPTIONS_PROFILES_CURRENT_DESC"]) --> select profile local profile_selected = function (_, instance, profile_name) @@ -2697,10 +2825,7 @@ function window:CreateFrame13() local select_profile_label = g:NewLabel (frame13, _, "$parentSelectProfileLabel", "selectProfileLabel", Loc ["STRING_OPTIONS_PROFILES_SELECT"], "GameFontHighlightLeft") select_profile_dropdown:SetPoint ("left", select_profile_label, "right", 2, 0) - select_profile_dropdown.info = Loc ["STRING_OPTIONS_PROFILES_SELECT_DESC"] - window:create_line_background (frame13, select_profile_label, select_profile_dropdown) - select_profile_dropdown:SetHook ("OnEnter", background_on_enter) - select_profile_dropdown:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame13, select_profile_dropdown, select_profile_label, Loc ["STRING_OPTIONS_PROFILES_SELECT_DESC"]) --> new profile local profile_name = g:NewTextEntry (frame13, _, "$parentProfileNameEntry", "profileNameEntry", 120, 20) @@ -2730,10 +2855,7 @@ function window:CreateFrame13() profile_create_button:InstallCustomTexture() profile_create_button:SetPoint ("left", profile_name, "right", 2, 0) - profile_name.info = Loc ["STRING_OPTIONS_PROFILES_CREATE_DESC"] - window:create_line_background (frame13, profile_name_label, profile_name) - profile_name:SetHook ("OnEnter", background_on_enter) - profile_name:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame13, profile_name, profile_name_label, Loc ["STRING_OPTIONS_PROFILES_CREATE_DESC"]) --> copy profile @@ -2772,11 +2894,8 @@ function window:CreateFrame13() local select_profileCopy_label = g:NewLabel (frame13, _, "$parentSelectProfileCopyLabel", "selectProfileCopyLabel", Loc ["STRING_OPTIONS_PROFILES_COPY"], "GameFontHighlightLeft") select_profileCopy_dropdown:SetPoint ("left", select_profileCopy_label, "right", 2, 0) - - select_profileCopy_dropdown.info = Loc ["STRING_OPTIONS_PROFILES_COPY_DESC"] - window:create_line_background (frame13, select_profileCopy_label, select_profileCopy_dropdown) - select_profileCopy_dropdown:SetHook ("OnEnter", background_on_enter) - select_profileCopy_dropdown:SetHook ("OnLeave", background_on_leave) + + window:CreateLineBackground2 (frame13, select_profileCopy_dropdown, select_profileCopy_label, Loc ["STRING_OPTIONS_PROFILES_COPY_DESC"]) --> erase profile local profile_selectedErase = function (_, instance, profile_name) @@ -2814,11 +2933,8 @@ function window:CreateFrame13() local select_profileErase_label = g:NewLabel (frame13, _, "$parentSelectProfileEraseLabel", "selectProfileLabel", Loc ["STRING_OPTIONS_PROFILES_ERASE"], "GameFontHighlightLeft") select_profileErase_dropdown:SetPoint ("left", select_profileErase_label, "right", 2, 0) - - select_profileErase_dropdown.info = Loc ["STRING_OPTIONS_PROFILES_ERASE_DESC"] - window:create_line_background (frame13, select_profileErase_label, select_profileErase_dropdown) - select_profileErase_dropdown:SetHook ("OnEnter", background_on_enter) - select_profileErase_dropdown:SetHook ("OnLeave", background_on_leave) + + window:CreateLineBackground2 (frame13, select_profileErase_dropdown, select_profileErase_label, Loc ["STRING_OPTIONS_PROFILES_ERASE_DESC"]) --> reset profile @@ -2834,23 +2950,31 @@ function window:CreateFrame13() local hiddenlabel = g:NewLabel (frame13, _, "$parentProfileResetButtonLabel", "profileResetButtonLabel", "", "GameFontHighlightLeft") hiddenlabel:SetPoint ("left", profile_reset_button, "left") - profile_reset_button.info = Loc ["STRING_OPTIONS_PROFILES_RESET_DESC"] - window:create_line_background (frame13, hiddenlabel, profile_reset_button) - profile_reset_button:SetHook ("OnEnter", background_on_enter) - profile_reset_button:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame13, profile_reset_button, hiddenlabel, Loc ["STRING_OPTIONS_PROFILES_RESET_DESC"]) --profile_reset_button.button.texture:SetVertexColor (1, .8, 0) --> anchors - titulo_profiles:SetPoint (10, -10) - titulo_profiles_desc:SetPoint (10, -30) + + --general anchor + g:NewLabel (frame13, _, "$parentProfilesAnchor", "ProfileAnchorLabel", Loc ["STRING_OPTIONS_PROFILES_ANCHOR"], "GameFontNormal") - current_profile_label:SetPoint (10, -90) - select_profile_label:SetPoint (10, -125) - profile_name_label:SetPoint (10, -150) - select_profileCopy_label:SetPoint (10, -185) - select_profileErase_label:SetPoint (10, -210) - profile_reset_button:SetPoint (10, -245) + local x = window.left_start_at + + titulo_profiles:SetPoint (x, -30) + titulo_profiles_desc:SetPoint (x, -50) + + local left_side = { + {"ProfileAnchorLabel", 1, true}, + {current_profile_label, 2}, + {select_profile_label, 3}, + {profile_name_label, 4}, + {select_profileCopy_label, 5}, + {select_profileErase_label, 6}, + {profile_reset_button, 7}, + } + + window:arrange_menu (frame13, left_side, x, window.top_start_at) end @@ -2868,9 +2992,9 @@ function window:CreateFrame3() titulo_skin_desc.width = 320 --> Save Load - local titulo_save = g:NewLabel (frame3, _, "$parentTituloPersona", "tituloBarsLabel", Loc ["STRING_OPTIONS_SAVELOAD"], "GameFontNormal", 16) - local titulo_save_desc = g:NewLabel (frame3, _, "$parentTituloPersona2", "tituloBars2Label", Loc ["STRING_OPTIONS_SAVELOAD_DESC"], "GameFontNormal", 9, "white") - titulo_save_desc.width = 320 + -- local titulo_save = g:NewLabel (frame3, _, "$parentTituloPersona", "tituloBarsLabel", Loc ["STRING_OPTIONS_SAVELOAD"], "GameFontNormal", 16) + -- local titulo_save_desc = g:NewLabel (frame3, _, "$parentTituloPersona2", "tituloBars2Label", Loc ["STRING_OPTIONS_SAVELOAD_DESC"], "GameFontNormal", 9, "white") + -- titulo_save_desc.width = 320 --> create functions and frames first: @@ -2941,11 +3065,9 @@ function window:CreateFrame3() d:SetBackdropColor (unpack (dropdown_backdrop_onleave)) g:NewLabel (frame3, _, "$parentSkinLabel", "skinLabel", Loc ["STRING_OPTIONS_INSTANCE_SKIN"], "GameFontHighlightLeft") - - frame3.skinDropdown.info = Loc ["STRING_OPTIONS_INSTANCE_SKIN_DESC"] - window:create_line_background (frame3, frame3.skinLabel, frame3.skinDropdown) - frame3.skinDropdown:SetHook ("OnEnter", background_on_enter) - frame3.skinDropdown:SetHook ("OnLeave", background_on_leave) + + window:CreateLineBackground2 (frame3, "skinDropdown", "skinLabel", Loc ["STRING_OPTIONS_INSTANCE_SKIN_DESC"]) + frame3.skinDropdown:SetPoint ("left", frame3.skinLabel, "right", 2) --> Create New Skin @@ -2992,10 +3114,7 @@ function window:CreateFrame3() g:NewButton (frame3, _, "$parentSaveStyleButton", "saveStyle", 50, 19, saveStyleFunc, nil, nil, nil, Loc ["STRING_OPTIONS_SAVELOAD_SAVE"]) frame3.saveStyle:InstallCustomTexture() - frame3.saveStyleName.info = Loc ["STRING_OPTIONS_SAVELOAD_CREATE_DESC"] - window:create_line_background (frame3, frame3.saveSkinLabel, frame3.saveStyleName) - frame3.saveStyleName:SetHook ("OnEnter", background_on_enter) - frame3.saveStyleName:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame3, "saveStyleName", "saveSkinLabel", Loc ["STRING_OPTIONS_SAVELOAD_CREATE_DESC"]) --> apply to all button local applyToAll = function() @@ -3038,15 +3157,9 @@ function window:CreateFrame3() frame3.toAllStyleLabel:SetPoint ("left", frame3.applyToAll, "left") frame3.makeDefaultLabel:SetPoint ("left", frame3.makeDefault, "left") - frame3.applyToAll.info = Loc ["STRING_OPTIONS_SAVELOAD_APPLYALL_DESC"] - window:create_line_background (frame3, frame3.toAllStyleLabel, frame3.applyToAll) - frame3.applyToAll:SetHook ("OnEnter", background_on_enter) - frame3.applyToAll:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame3, "applyToAll", "toAllStyleLabel", Loc ["STRING_OPTIONS_SAVELOAD_APPLYALL_DESC"]) - frame3.makeDefault.info = Loc ["STRING_OPTIONS_SAVELOAD_STD_DESC"] - window:create_line_background (frame3, frame3.makeDefaultLabel, frame3.makeDefault) - frame3.makeDefault:SetHook ("OnEnter", background_on_enter) - frame3.makeDefault:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame3, "makeDefault", "makeDefaultLabel", Loc ["STRING_OPTIONS_SAVELOAD_STD_DESC"]) --> Load Custom Skin g:NewLabel (frame3, _, "$parentLoadCustomSkinLabel", "loadCustomSkinLabel", Loc ["STRING_OPTIONS_SAVELOAD_LOAD"], "GameFontHighlightLeft") @@ -3109,10 +3222,7 @@ function window:CreateFrame3() frame3.customSkinSelectDropdown:SetPoint ("left", frame3.loadCustomSkinLabel, "right", 2, 0) - frame3.customSkinSelectDropdown.info = Loc ["STRING_OPTIONS_SAVELOAD_LOAD_DESC"] - window:create_line_background (frame3, frame3.loadCustomSkinLabel, frame3.customSkinSelectDropdown) - frame3.customSkinSelectDropdown:SetHook ("OnEnter", background_on_enter) - frame3.customSkinSelectDropdown:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame3, "customSkinSelectDropdown", "loadCustomSkinLabel", Loc ["STRING_OPTIONS_SAVELOAD_LOAD_DESC"]) --> Remove Custom Skin g:NewLabel (frame3, _, "$parentRemoveCustomSkinLabel", "removeCustomSkinLabel", Loc ["STRING_OPTIONS_SAVELOAD_REMOVE"], "GameFontHighlightLeft") @@ -3142,39 +3252,36 @@ function window:CreateFrame3() d:SetBackdropColor (unpack (dropdown_backdrop_onleave)) frame3.customSkinSelectToRemoveDropdown:SetPoint ("left", frame3.removeCustomSkinLabel, "right", 2, 0) - frame3.customSkinSelectToRemoveDropdown.info = Loc ["STRING_OPTIONS_SAVELOAD_LOAD_DESC"] - frame3.customSkinSelectToRemoveDropdown.info = Loc ["STRING_OPTIONS_SAVELOAD_ERASE_DESC"] + window:CreateLineBackground2 (frame3, "customSkinSelectToRemoveDropdown", "removeCustomSkinLabel", Loc ["STRING_OPTIONS_SAVELOAD_ERASE_DESC"]) - window:create_line_background (frame3, frame3.removeCustomSkinLabel, frame3.customSkinSelectToRemoveDropdown) - frame3.customSkinSelectToRemoveDropdown:SetHook ("OnEnter", background_on_enter) - frame3.customSkinSelectToRemoveDropdown:SetHook ("OnLeave", background_on_leave) - + --> Anchors - --title - titulo_skin:SetPoint (10, -10) - titulo_skin_desc:SetPoint (10, -30) - --skin select - frame3.skinLabel:SetPoint (10, -70) + --general anchor + g:NewLabel (frame3, _, "$parentSkinSelectionAnchor", "SkinSelectionAnchorLabel", Loc ["STRING_OPTIONS_SKIN_SELECT_ANCHOR"], "GameFontNormal") + g:NewLabel (frame3, _, "$parentSkinPresetAnchor", "SkinPresetAnchorLabel", Loc ["STRING_OPTIONS_SKIN_PRESETS_ANCHOR"], "GameFontNormal") - --title - titulo_save:SetPoint (10, -115) - titulo_save_desc:SetPoint (10, -135) - - --saving - frame3.saveSkinLabel:SetPoint (10, -170) frame3.saveStyle:SetPoint ("left", frame3.saveStyleName, "right", 2) - --loading - frame3.loadCustomSkinLabel:SetPoint (10, -195) - - --removing - frame3.removeCustomSkinLabel:SetPoint (10, -220) + local x = window.left_start_at - frame3.makeDefault:SetPoint (10, -255) - --frame3.resetToDefaults:SetPoint (10, -270) - frame3.applyToAll:SetPoint (10, -280) + titulo_skin:SetPoint (x, -30) + titulo_skin_desc:SetPoint (x, -50) + local left_side = { + {"SkinSelectionAnchorLabel", 1, true}, + {"skinLabel", 2}, + {"SkinPresetAnchorLabel", 3, true}, + {"saveSkinLabel", 4}, + {"loadCustomSkinLabel", 5}, + {"removeCustomSkinLabel", 6}, + {"makeDefault", 7, true}, + {"applyToAll", 8}, + --{"", 9}, + --{"", 10}, + } + + window:arrange_menu (frame3, left_side, x, -90) end --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- @@ -3189,6 +3296,9 @@ function window:CreateFrame4() local titulo_bars_desc = g:NewLabel (frame4, _, "$parentTituloPersona2", "tituloBars2Label", Loc ["STRING_OPTIONS_BARS_DESC"], "GameFontNormal", 9, "white") titulo_bars_desc.width = 320 + --> general anchor + g:NewLabel (frame4, _, "$parentRowGeneralAnchor", "RowGeneralAnchorLabel", Loc ["STRING_OPTIONS_GENERAL_ANCHOR"], "GameFontNormal") + --> bar height g:NewLabel (frame4, _, "$parentRowHeightLabel", "rowHeightLabel", Loc ["STRING_OPTIONS_BAR_HEIGHT"], "GameFontHighlightLeft") local s = g:NewSlider (frame4, _, "$parentSliderRowHeight", "rowHeightSlider", SLIDER_WIDTH, 20, 10, 30, 1, tonumber (instance.row_info.height)) @@ -3205,7 +3315,7 @@ function window:CreateFrame4() instance:InstanceReset() instance:ReajustaGump() end) - window:CreateLineBackground (frame4, "rowHeightSlider", "rowHeightLabel", Loc ["STRING_OPTIONS_BAR_HEIGHT_DESC"]) + window:CreateLineBackground2 (frame4, "rowHeightSlider", "rowHeightLabel", Loc ["STRING_OPTIONS_BAR_HEIGHT_DESC"]) --> bar grow direction local grow_switch_func = function (slider, value) @@ -3231,7 +3341,7 @@ function window:CreateFrame4() instance:SetBarGrowDirection (value) end frame4.barGrowDirectionSlider.thumb:SetSize (50, 12) - window:CreateLineBackground (frame4, "barGrowDirectionSlider", "barGrowDirectionLabel", Loc ["STRING_OPTIONS_BARGROW_DIRECTION_DESC"]) + window:CreateLineBackground2 (frame4, "barGrowDirectionSlider", "barGrowDirectionLabel", Loc ["STRING_OPTIONS_BARGROW_DIRECTION_DESC"]) -- bar sort direction @@ -3244,21 +3354,20 @@ function window:CreateFrame4() _detalhes:AtualizaGumpPrincipal (-1, true) end frame4.barSortDirectionSlider.thumb:SetSize (50, 12) - window:CreateLineBackground (frame4, "barSortDirectionSlider", "barSortDirectionLabel", Loc ["STRING_OPTIONS_BARSORT_DIRECTION_DESC"]) + window:CreateLineBackground2 (frame4, "barSortDirectionSlider", "barSortDirectionLabel", Loc ["STRING_OPTIONS_BARSORT_DIRECTION_DESC"]) -- spacement g:NewLabel (frame4, _, "$parentBarSpacementLabel", "BarSpacementLabel", Loc ["STRING_OPTIONS_BAR_SPACING"], "GameFontHighlightLeft") - local s = g:NewSlider (frame4, _, "$parentBarSpacementSizeSlider", "BarSpacementSlider", SLIDER_WIDTH, 20, 0, 10, 1, instance.row_info.space.between, true) + local s = g:NewSlider (frame4, _, "$parentBarSpacementSizeSlider", "BarSpacementSlider", SLIDER_WIDTH, 20, 0, 10, 1, instance.row_info.space.between) s:SetThumbSize (50) s:SetBackdrop (slider_backdrop) s:SetBackdropColor (unpack (slider_backdrop_color)) - s.fine_tuning = 0.2 frame4.BarSpacementSlider:SetPoint ("left", frame4.BarSpacementLabel, "right", 2) frame4.BarSpacementSlider:SetHook ("OnValueChange", function (self, instancia, amount) instancia:SetBarSettings (nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, amount) end) - window:CreateLineBackground (frame4, "BarSpacementSlider", "BarSpacementLabel", Loc ["STRING_OPTIONS_BAR_SPACING_DESC"]) + window:CreateLineBackground2 (frame4, "BarSpacementSlider", "BarSpacementLabel", Loc ["STRING_OPTIONS_BAR_SPACING_DESC"]) --> Top Texture --anchor @@ -3287,7 +3396,7 @@ function window:CreateFrame4() d:SetBackdropColor (unpack (dropdown_backdrop_onleave)) frame4.textureDropdown:SetPoint ("left", frame4.textureLabel, "right", 2) - window:CreateLineBackground (frame4, "textureDropdown", "textureLabel", Loc ["STRING_OPTIONS_BAR_TEXTURE_DESC"]) + window:CreateLineBackground2 (frame4, "textureDropdown", "textureLabel", Loc ["STRING_OPTIONS_BAR_TEXTURE_DESC"]) -- row texture color local rowcolor_callback = function (button, r, g, b, a) @@ -3298,7 +3407,7 @@ function window:CreateFrame4() g:NewLabel (frame4, _, "$parentRowColorPickLabel", "rowPickColorLabel", Loc ["STRING_OPTIONS_TEXT_ROWCOLOR2"], "GameFontHighlightLeft") g:NewColorPickButton (frame4, "$parentRowColorPick", "rowColorPick", rowcolor_callback) frame4.rowColorPick:SetPoint ("left", frame4.rowPickColorLabel, "right", 2, 0) - local background = window:CreateLineBackground (frame4, "rowColorPick", "rowPickColorLabel", Loc ["STRING_OPTIONS_BAR_COLOR_DESC"]) + local background = window:CreateLineBackground2 (frame4, "rowColorPick", "rowPickColorLabel", Loc ["STRING_OPTIONS_BAR_COLOR_DESC"]) background:SetSize (50, 16) -- bar texture by class color @@ -3310,7 +3419,7 @@ function window:CreateFrame4() instance:SetBarSettings (nil, nil, value) end frame4.classColorsLabel:SetPoint ("left", frame4.rowColorPick, "right", 3, 0) - window:CreateLineBackground (frame4, "classColorSlider", "classColorsLabel", Loc ["STRING_OPTIONS_BAR_COLORBYCLASS_DESC"]) + window:CreateLineBackground2 (frame4, "classColorSlider", "classColorsLabel", Loc ["STRING_OPTIONS_BAR_COLORBYCLASS_DESC"]) --> Bottom Texture @@ -3341,7 +3450,7 @@ function window:CreateFrame4() d:SetBackdropColor (unpack (dropdown_backdrop_onleave)) frame4.rowBackgroundDropdown:SetPoint ("left", frame4.rowBackgroundLabel, "right", 2) - window:CreateLineBackground (frame4, "rowBackgroundDropdown", "rowBackgroundLabel", Loc ["STRING_OPTIONS_BAR_BTEXTURE_DESC"]) + window:CreateLineBackground2 (frame4, "rowBackgroundDropdown", "rowBackgroundLabel", Loc ["STRING_OPTIONS_BAR_BTEXTURE_DESC"]) --bar background color local rowcolorbackground_callback = function (button, r, g, b, a) @@ -3351,7 +3460,7 @@ function window:CreateFrame4() g:NewLabel (frame4, _, "$parentRowBackgroundColorPickLabel", "rowBackgroundPickLabel", Loc ["STRING_OPTIONS_TEXT_ROWCOLOR"], "GameFontHighlightLeft") frame4.rowBackgroundColorPick:SetPoint ("left", frame4.rowBackgroundPickLabel, "right", 2, 0) - local background = window:CreateLineBackground (frame4, "rowBackgroundColorPick", "rowBackgroundPickLabel", Loc ["STRING_OPTIONS_BAR_BCOLOR_DESC"]) + local background = window:CreateLineBackground2 (frame4, "rowBackgroundColorPick", "rowBackgroundPickLabel", Loc ["STRING_OPTIONS_BAR_BCOLOR_DESC"]) background:SetSize (50, 16) --bar texture by class color @@ -3363,7 +3472,7 @@ function window:CreateFrame4() instance:SetBarSettings (nil, nil, nil, nil, nil, value) end - window:CreateLineBackground (frame4, "rowBackgroundColorByClassSlider", "rowBackgroundColorByClassLabel", Loc ["STRING_OPTIONS_BAR_COLORBYCLASS2_DESC"]) + window:CreateLineBackground2 (frame4, "rowBackgroundColorByClassSlider", "rowBackgroundColorByClassLabel", Loc ["STRING_OPTIONS_BAR_COLORBYCLASS2_DESC"]) frame4.rowBackgroundColorByClassLabel:SetPoint ("left", frame4.rowBackgroundColorPick, "right", 3) @@ -3388,11 +3497,8 @@ function window:CreateFrame4() return true end) - frame4.iconFileEntry.info = Loc ["STRING_OPTIONS_BAR_ICONFILE_DESC"] - window:create_line_background (frame4, frame4.iconFileLabel, frame4.iconFileEntry) - frame4.iconFileEntry:SetHook ("OnEnter", background_on_enter) - frame4.iconFileEntry:SetHook ("OnLeave", background_on_leave) - + window:CreateLineBackground2 (frame4, "iconFileEntry", "iconFileLabel", Loc ["STRING_OPTIONS_BAR_ICONFILE_DESC"]) + frame4.iconFileEntry.text = instance.row_info.icon_file g:NewButton (frame4.iconFileEntry, _, "$parentNoIconButton", "noIconButton", 20, 20, function() @@ -3411,8 +3517,6 @@ function window:CreateFrame4() frame4.noIconButton:SetHighlightTexture ([[Interface\Glues\LOGIN\Glues-CheckBox-Check]] or [[Interface\Buttons\UI-GROUPLOOT-PASS-HIGHLIGHT]]) frame4.noIconButton:SetPushedTexture ([[Interface\Glues\LOGIN\Glues-CheckBox-Check]] or [[Interface\Buttons\UI-GroupLoot-Pass-Up]]) frame4.noIconButton:GetNormalTexture():SetDesaturated (true) - --frame4.noIconButton:GetHighlightTexture() - --frame4.noIconButton:GetPushedTexture() frame4.noIconButton.tooltip = "Clear icon file." --bar start at @@ -3424,32 +3528,125 @@ function window:CreateFrame4() instance:SetBarSettings (nil, nil, nil, nil, nil, nil, nil, nil, nil, value) end - frame4.barStartSlider.info = Loc ["STRING_OPTIONS_BARSTART_DESC"] - window:create_line_background (frame4, frame4.barStartLabel, frame4.barStartSlider) - frame4.barStartSlider:SetHook ("OnEnter", background_on_enter) - frame4.barStartSlider:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame4, "barStartSlider", "barStartLabel", Loc ["STRING_OPTIONS_BARSTART_DESC"]) - --anchors: - titulo_bars:SetPoint (10, -10) - titulo_bars_desc:SetPoint (10, -30) + --> Backdrop + --anchor + g:NewLabel (frame4, _, "$parentBackdropAnchor", "BackdropAnchorLabel", Loc ["STRING_OPTIONS_BAR_BACKDROP_ANCHOR"], "GameFontNormal") - frame4.rowHeightLabel:SetPoint (10, -70) --bar height - frame4.barGrowDirectionLabel:SetPoint (10, -95) --grow direction - frame4.barSortDirectionLabel:SetPoint (10, -120) --sort direction - frame4.BarSpacementLabel:SetPoint (10, -145) --spacement + --enabled + g:NewLabel (frame4, _, "$parentBackdropEnabledLabel", "BackdropEnabledLabel", Loc ["STRING_OPTIONS_BAR_BACKDROP_ENABLED"], "GameFontHighlightLeft") + g:NewSwitch (frame4, _, "$parentBackdropEnabledSlider", "BackdropEnabledSlider", 60, 20, _, _, instance.row_info.backdrop.enabled) + frame4.BackdropEnabledSlider:SetPoint ("left", frame4.BackdropEnabledLabel, "right", 2, -1) + frame4.BackdropEnabledSlider.OnSwitch = function (self, instance, value) + instance:SetBarBackdropSettings (value) + end + window:CreateLineBackground2 (frame4, "BackdropEnabledSlider", "BackdropEnabledLabel", Loc ["STRING_OPTIONS_BAR_BACKDROP_ENABLED_DESC"]) - frame4.rowUpperTextureLabel:SetPoint (10, -180) --anchor - frame4.textureLabel:SetPoint (10, -205) --bar texture - frame4.rowPickColorLabel:SetPoint (10, -230) --color pick + --texture + local onSelectTextureBackdrop = function (_, instance, textureName) + instance:SetBarBackdropSettings (nil, nil, nil, textureName) + end + + local buildTextureBackdropMenu = function() + local textures2 = SharedMedia:HashTable ("border") + local texTable2 = {} + for name, texturePath in pairs (textures2) do + texTable2 [#texTable2+1] = {value = name, label = name, onclick = onSelectTextureBackdrop} + end + table.sort (texTable2, function (t1, t2) return t1.label < t2.label end) + return texTable2 + end - frame4.rowLowerTextureLabel:SetPoint (10, -265) - frame4.rowBackgroundLabel:SetPoint (10, -290) --select background - frame4.rowBackgroundPickLabel:SetPoint (10, -315) --bar color background + g:NewLabel (frame4, _, "$parentBackdropBorderTextureLabel", "BackdropBorderTextureLabel", Loc ["STRING_OPTIONS_BAR_BACKDROP_TEXTURE"], "GameFontHighlightLeft") + local d = g:NewDropDown (frame4, _, "$parentBackdropBorderTextureDropdown", "BackdropBorderTextureDropdown", DROPDOWN_WIDTH, 20, buildTextureBackdropMenu, nil) + d.onenter_backdrop = dropdown_backdrop_onenter + d.onleave_backdrop = dropdown_backdrop_onleave + d:SetBackdrop (dropdown_backdrop) + d:SetBackdropColor (unpack (dropdown_backdrop_onleave)) - frame4.rowIconsLabel:SetPoint (10, -350) - frame4.iconFileLabel:SetPoint (10, -375) - frame4.barStartLabel:SetPoint (10, -400) + frame4.BackdropBorderTextureDropdown:SetPoint ("left", frame4.BackdropBorderTextureLabel, "right", 2) + window:CreateLineBackground2 (frame4, "BackdropBorderTextureDropdown", "BackdropBorderTextureLabel", Loc ["STRING_OPTIONS_BAR_BACKDROP_TEXTURE_DESC"]) + --size + g:NewLabel (frame4, _, "$parentBackdropSizeLabel", "BackdropSizeLabel", Loc ["STRING_OPTIONS_BAR_BACKDROP_SIZE"], "GameFontHighlightLeft") + local s = g:NewSlider (frame4, _, "$parentBackdropSizeHeight", "BackdropSizeSlider", SLIDER_WIDTH, 20, 1, 20, 1, tonumber (instance.row_info.height)) + s:SetBackdrop (slider_backdrop) + s:SetBackdropColor (unpack (slider_backdrop_color)) + s:SetThumbSize (50) + + frame4.BackdropSizeSlider:SetPoint ("left", frame4.BackdropSizeLabel, "right", 2) + frame4.BackdropSizeSlider:SetThumbSize (50) + frame4.BackdropSizeSlider:SetHook ("OnValueChange", function (self, instance, amount) + instance:SetBarBackdropSettings (nil, amount) + end) + window:CreateLineBackground2 (frame4, "BackdropSizeSlider", "BackdropSizeLabel", Loc ["STRING_OPTIONS_BAR_BACKDROP_SIZE_DESC"]) + + --color + local backdropcolor_callback = function (button, r, g, b, a) + _G.DetailsOptionsWindow.instance:SetBarBackdropSettings (nil, nil, {r, g, b, a}) + end + g:NewColorPickButton (frame4, "$parentBackdropColorPick", "BackdropColorPick", backdropcolor_callback) + g:NewLabel (frame4, _, "$parentBackdropColorLabel", "BackdropColorLabel", Loc ["STRING_OPTIONS_BAR_BACKDROP_COLOR"], "GameFontHighlightLeft") + frame4.BackdropColorPick:SetPoint ("left", frame4.BackdropColorLabel, "right", 2, 0) + + local background = window:CreateLineBackground2 (frame4, "BackdropColorPick", "BackdropColorLabel", Loc ["STRING_OPTIONS_BAR_BACKDROP_COLOR_DESC"]) + + --> Anchors: + local x = window.left_start_at + + titulo_bars:SetPoint (x, -30) + titulo_bars_desc:SetPoint (x, -50) + + local left_side = { + --basic + {frame4.RowGeneralAnchorLabel, 1, true}, + {frame4.rowHeightLabel, 2}, + {frame4.barGrowDirectionLabel, 3}, + {frame4.barSortDirectionLabel, 4}, + {frame4.BarSpacementLabel, 5}, + --icon + {frame4.rowIconsLabel, 6, true}, + {frame4.iconFileLabel, 7}, + {frame4.barStartLabel, 8}, + --backdrop + {frame4.BackdropAnchorLabel, 9, true}, + {frame4.BackdropEnabledLabel, 10}, + {frame4.BackdropBorderTextureLabel, 11}, + {frame4.BackdropSizeLabel, 12}, + {frame4.BackdropColorLabel, 13}, + } + + local right_side = { + {frame4.rowUpperTextureLabel, 1, true}, + {frame4.textureLabel, 2}, + {frame4.rowPickColorLabel, 3}, + {frame4.rowLowerTextureLabel, 4, true}, + {frame4.rowBackgroundLabel, 5}, + {frame4.rowBackgroundPickLabel, 6}, + } + + window:arrange_menu (frame4, left_side, x, -90) + window:arrange_menu (frame4, right_side, 360, -90) + + --[[ + frame4.rowHeightLabel:SetPoint (x, -90) --bar height + frame4.barGrowDirectionLabel:SetPoint (x, -125) --grow direction + frame4.barSortDirectionLabel:SetPoint (x, -150) --sort direction + frame4.BarSpacementLabel:SetPoint (x, -175) --spacement + + frame4.rowUpperTextureLabel:SetPoint (x, -210) --anchor + frame4.textureLabel:SetPoint (x, -235) --bar texture + frame4.rowPickColorLabel:SetPoint (x, -260) --color pick + + frame4.rowLowerTextureLabel:SetPoint (x, -295) + frame4.rowBackgroundLabel:SetPoint (x, -320) --select background + frame4.rowBackgroundPickLabel:SetPoint (x, -345) --bar color background + + frame4.rowIconsLabel:SetPoint (x, -380) + frame4.iconFileLabel:SetPoint (x, -405) + frame4.barStartLabel:SetPoint (x, -430) + --]] end --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- @@ -3472,6 +3669,8 @@ function window:CreateFrame5() local fixedColorText = g:NewLabel (frame5, _, "$parentFixedTextColorLabel", "fixedTextColorLabel", Loc ["STRING_OPTIONS_TEXT_FIXEDCOLOR"], "GameFontHighlightLeft") frame5.fixedTextColor:SetPoint ("left", fixedColorText, "right", 2, 0) + window:CreateLineBackground2 (frame5, "fixedTextColor", "fixedTextColorLabel", Loc ["STRING_OPTIONS_TEXT_FIXEDCOLOR_DESC"]) + --> text size local s = g:NewSlider (frame5, _, "$parentSliderFontSize", "fonsizeSlider", SLIDER_WIDTH, 20, 8, 15, 1, tonumber (instance.row_info.font_size)) s:SetBackdrop (slider_backdrop) @@ -3484,11 +3683,9 @@ function window:CreateFrame5() frame5.fonsizeSlider:SetHook ("OnValueChange", function (self, instance, amount) instance:SetBarTextSettings (amount) end) - frame5.fonsizeSlider.info = Loc ["STRING_OPTIONS_TEXT_SIZE_DESC"] - window:create_line_background (frame5, frame5.fonsizeLabel, frame5.fonsizeSlider) - frame5.fonsizeSlider:SetHook ("OnEnter", background_on_enter) - frame5.fonsizeSlider:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame5, "fonsizeSlider", "fonsizeLabel", Loc ["STRING_OPTIONS_TEXT_SIZE_DESC"]) + --> Text Fonts local onSelectFont = function (_, instance, fontName) @@ -3513,11 +3710,8 @@ function window:CreateFrame5() g:NewLabel (frame5, _, "$parentFontLabel", "fontLabel", Loc ["STRING_OPTIONS_TEXT_FONT"], "GameFontHighlightLeft") frame5.fontDropdown:SetPoint ("left", frame5.fontLabel, "right", 2) - - frame5.fontDropdown.info = Loc ["STRING_OPTIONS_TEXT_FONT_DESC"] - window:create_line_background (frame5, frame5.fontLabel, frame5.fontDropdown) - frame5.fontDropdown:SetHook ("OnEnter", background_on_enter) - frame5.fontDropdown:SetHook ("OnLeave", background_on_leave) + + window:CreateLineBackground2 (frame5, "fontDropdown", "fontLabel", Loc ["STRING_OPTIONS_TEXT_FONT_DESC"]) --> left text and right class color g:NewSwitch (frame5, _, "$parentUseClassColorsLeftTextSlider", "classColorsLeftTextSlider", 60, 20, _, _, instance.row_info.textL_class_colors) @@ -3529,10 +3723,7 @@ function window:CreateFrame5() instance:SetBarTextSettings (nil, nil, nil, value) end - frame5.classColorsLeftTextSlider.info = Loc ["STRING_OPTIONS_TEXT_LCLASSCOLOR_DESC"] - window:create_line_background (frame5, frame5.classColorsLeftTextLabel, frame5.classColorsLeftTextSlider) - frame5.classColorsLeftTextSlider:SetHook ("OnEnter", background_on_enter) - frame5.classColorsLeftTextSlider:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame5, "classColorsLeftTextSlider", "classColorsLeftTextLabel", Loc ["STRING_OPTIONS_TEXT_LCLASSCOLOR_DESC"]) --> right text by class color g:NewLabel (frame5, _, "$parentUseClassColorsRightText", "classColorsRightTextLabel", Loc ["STRING_OPTIONS_TEXT_RCLASSCOLOR"], "GameFontHighlightLeft") @@ -3542,26 +3733,18 @@ function window:CreateFrame5() instance:SetBarTextSettings (nil, nil, nil, nil, value) end - frame5.classColorsRightTextSlider.info = Loc ["STRING_OPTIONS_TEXT_RCLASSCOLOR_DESC"] - window:create_line_background (frame5, frame5.classColorsRightTextLabel, frame5.classColorsRightTextSlider) - frame5.classColorsRightTextSlider:SetHook ("OnEnter", background_on_enter) - frame5.classColorsRightTextSlider:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame5, "classColorsRightTextSlider", "classColorsRightTextLabel", Loc ["STRING_OPTIONS_TEXT_RCLASSCOLOR_DESC"]) --> left outline g:NewSwitch (frame5, _, "$parentTextLeftOutlineSlider", "textLeftOutlineSlider", 60, 20, _, _, instance.row_info.textL_outline) - - g:NewLabel (frame5, _, "$parentTextLeftOutlineLabel", "textLeftOutlineLabel", Loc ["STRING_OPTIONS_TEXT_LOUTILINE"], "GameFontHighlightLeft") frame5.textLeftOutlineSlider:SetPoint ("left", frame5.textLeftOutlineLabel, "right", 2) frame5.textLeftOutlineSlider.OnSwitch = function (self, instance, value) instance:SetBarTextSettings (nil, nil, nil, nil, nil, value) end - - frame5.textLeftOutlineSlider.info = Loc ["STRING_OPTIONS_TEXT_LOUTILINE_DESC"] - window:create_line_background (frame5, frame5.textLeftOutlineLabel, frame5.textLeftOutlineSlider) - frame5.textLeftOutlineSlider:SetHook ("OnEnter", background_on_enter) - frame5.textLeftOutlineSlider:SetHook ("OnLeave", background_on_leave) + + window:CreateLineBackground2 (frame5, "textLeftOutlineSlider", "textLeftOutlineLabel", Loc ["STRING_OPTIONS_TEXT_LOUTILINE_DESC"]) --> right outline g:NewSwitch (frame5, _, "$parentTextRightOutlineSlider", "textRightOutlineSlider", 60, 20, _, _, instance.row_info.textR_outline) @@ -3571,11 +3754,8 @@ function window:CreateFrame5() frame5.textRightOutlineSlider.OnSwitch = function (self, instance, value) instance:SetBarTextSettings (nil, nil, nil, nil, nil, nil, value) end - - frame5.textRightOutlineSlider.info = Loc ["STRING_OPTIONS_TEXT_ROUTILINE_DESC"] - window:create_line_background (frame5, frame5.textRightOutlineLabel, frame5.textRightOutlineSlider) - frame5.textRightOutlineSlider:SetHook ("OnEnter", background_on_enter) - frame5.textRightOutlineSlider:SetHook ("OnLeave", background_on_leave) + + window:CreateLineBackground2 (frame5, "textRightOutlineSlider", "textRightOutlineLabel", Loc ["STRING_OPTIONS_TEXT_ROUTILINE_DESC"]) --> percent type local onSelectPercent = function (_, instance, percentType) @@ -3598,13 +3778,8 @@ function window:CreateFrame5() g:NewLabel (frame5, _, "$parentPercentLabel", "percentLabel", Loc ["STRING_OPTIONS_PERCENT_TYPE"], "GameFontHighlightLeft") frame5.percentDropdown:SetPoint ("left", frame5.percentLabel, "right", 2) - - frame5.percentDropdown.info = Loc ["STRING_OPTIONS_PERCENT_TYPE_DESC"] - window:create_line_background (frame5, frame5.percentLabel, frame5.percentDropdown) - frame5.percentDropdown:SetHook ("OnEnter", background_on_enter) - frame5.percentDropdown:SetHook ("OnLeave", background_on_leave) - - + + window:CreateLineBackground2 (frame5, "percentDropdown", "percentLabel", Loc ["STRING_OPTIONS_PERCENT_TYPE_DESC"]) --> right text customization @@ -3615,11 +3790,8 @@ function window:CreateFrame5() frame5.cutomRightTextSlider.OnSwitch = function (self, instance, value) _G.DetailsOptionsWindow.instance:SetBarTextSettings (nil, nil, nil, nil, nil, nil, nil, value) end - - frame5.cutomRightTextSlider.info = Loc ["STRING_OPTIONS_BARRIGHTTEXTCUSTOM_DESC"] - window:create_line_background (frame5, frame5.cutomRightTextLabel, frame5.cutomRightTextSlider) - frame5.cutomRightTextSlider:SetHook ("OnEnter", background_on_enter) - frame5.cutomRightTextSlider:SetHook ("OnLeave", background_on_leave) + + window:CreateLineBackground2 (frame5, "cutomRightTextSlider", "cutomRightTextLabel", Loc ["STRING_OPTIONS_BARRIGHTTEXTCUSTOM_DESC"]) --text entry g:NewLabel (frame5, _, "$parentCutomRightText2Label", "cutomRightTextEntryLabel", Loc ["STRING_OPTIONS_BARRIGHTTEXTCUSTOM2"], "GameFontHighlightLeft") @@ -3627,9 +3799,27 @@ function window:CreateFrame5() frame5.cutomRightTextEntry:SetPoint ("left", frame5.cutomRightTextEntryLabel, "right", 2, -1) --frame5.cutomRightTextEntry.tooltip = "type the customized text" - frame5.cutomRightTextEntry:SetHook ("OnTextChanged", function() + frame5.cutomRightTextEntry:SetHook ("OnTextChanged", function (self, byUser) + if (not frame5.cutomRightTextEntry.text:find ("{func")) then - _G.DetailsOptionsWindow.instance:SetBarTextSettings (nil, nil, nil, nil, nil, nil, nil, nil, frame5.cutomRightTextEntry.text) + + if (frame5.cutomRightTextEntry.changing and not byUser) then + frame5.cutomRightTextEntry.changing = false + return + elseif (frame5.cutomRightTextEntry.changing and byUser) then + frame5.cutomRightTextEntry.changing = false + end + + if (byUser) then + local t = frame5.cutomRightTextEntry.text + t = t:gsub ("||", "|") + _G.DetailsOptionsWindow.instance:SetBarTextSettings (nil, nil, nil, nil, nil, nil, nil, nil, t) + else + local t = frame5.cutomRightTextEntry.text + t = t:gsub ("|", "||") + frame5.cutomRightTextEntry.changing = true + frame5.cutomRightTextEntry.text = t + end end end) @@ -3642,26 +3832,40 @@ function window:CreateFrame5() end) frame5.cutomRightTextEntry:SetHook ("OnEnterPressed", function() - _G.DetailsOptionsWindow.instance:SetBarTextSettings (nil, nil, nil, nil, nil, nil, nil, nil, frame5.cutomRightTextEntry.text) + local t = frame5.cutomRightTextEntry.text + t = t:gsub ("||", "|") + _G.DetailsOptionsWindow.instance:SetBarTextSettings (nil, nil, nil, nil, nil, nil, nil, nil, t) end) frame5.cutomRightTextEntry:SetHook ("OnEscapePressed", function() frame5.cutomRightTextEntry:ClearFocus() return true end) - - frame5.cutomRightTextEntry.info = Loc ["STRING_OPTIONS_BARRIGHTTEXTCUSTOM2_DESC"] - window:create_line_background (frame5, frame5.cutomRightTextEntryLabel, frame5.cutomRightTextEntry) - frame5.cutomRightTextEntry:SetHook ("OnEnter", background_on_enter) - frame5.cutomRightTextEntry:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame5, "cutomRightTextEntry", "cutomRightTextEntryLabel", Loc ["STRING_OPTIONS_BARRIGHTTEXTCUSTOM2_DESC"]) + frame5.cutomRightTextEntry.text = instance.row_info.textR_custom_text + local callback = function (text) + frame5.cutomRightTextEntry.text = text + frame5.cutomRightTextEntry:PressEnter() + end + g:NewButton (frame5.cutomRightTextEntry, _, "$parentOpenTextBarEditorButton", "TextBarEditorButton", 22, 22, function() + DetailsWindowOptionsBarTextEditor:Open (frame5.cutomRightTextEntry.text, callback, _G.DetailsOptionsWindow) + end) + frame5.TextBarEditorButton = frame5.cutomRightTextEntry.TextBarEditorButton + frame5.TextBarEditorButton:SetPoint ("left", frame5.cutomRightTextEntry, "right", 2, 1) + frame5.TextBarEditorButton:SetNormalTexture ([[Interface\HELPFRAME\OpenTicketIcon]]) + frame5.TextBarEditorButton:SetHighlightTexture ([[Interface\HELPFRAME\OpenTicketIcon]]) + frame5.TextBarEditorButton:SetPushedTexture ([[Interface\HELPFRAME\OpenTicketIcon]]) + frame5.TextBarEditorButton:GetNormalTexture():SetDesaturated (true) + frame5.TextBarEditorButton.tooltip = "Row Text Editor" + g:NewButton (frame5.cutomRightTextEntry, _, "$parentResetCustomRightTextButton", "customRightTextButton", 20, 20, function() frame5.cutomRightTextEntry.text = _detalhes.instance_defaults.row_info.textR_custom_text frame5.cutomRightTextEntry:PressEnter() end) frame5.customRightTextButton = frame5.cutomRightTextEntry.customRightTextButton - frame5.customRightTextButton:SetPoint ("left", frame5.cutomRightTextEntry, "right", 2, 1) + frame5.customRightTextButton:SetPoint ("left", frame5.TextBarEditorButton, "right", 0, 0) frame5.customRightTextButton:SetNormalTexture ([[Interface\Glues\LOGIN\Glues-CheckBox-Check]] or [[Interface\Buttons\UI-GroupLoot-Pass-Down]]) frame5.customRightTextButton:SetHighlightTexture ([[Interface\Glues\LOGIN\Glues-CheckBox-Check]] or [[Interface\Buttons\UI-GROUPLOOT-PASS-HIGHLIGHT]]) frame5.customRightTextButton:SetPushedTexture ([[Interface\Glues\LOGIN\Glues-CheckBox-Check]] or [[Interface\Buttons\UI-GroupLoot-Pass-Up]]) @@ -3669,22 +3873,44 @@ function window:CreateFrame5() frame5.customRightTextButton.tooltip = "Reset to Default" --> anchors - titulo_texts:SetPoint (10, -10) - titulo_texts_desc:SetPoint (10, -30) + + --general anchor + g:NewLabel (frame5, _, "$parentRowTextGeneralAnchor", "RowGeneralAnchorLabel", Loc ["STRING_OPTIONS_GENERAL_ANCHOR"], "GameFontNormal") - frame5.fonsizeLabel:SetPoint (10, -70) --text size - frame5.fontLabel:SetPoint (10, -95) --text fontface - frame5.textLeftOutlineLabel:SetPoint (10, -120) --left outline - frame5.textRightOutlineLabel:SetPoint (10, -145) --right outline - frame5.classColorsLeftTextLabel:SetPoint (10, -170) --left color by class - frame5.classColorsRightTextLabel:SetPoint (10, -195) --right color by class - frame5.fixedTextColorLabel:SetPoint (10, -220) - frame5.percentLabel:SetPoint (10, -245) + --left text anchor + g:NewLabel (frame5, _, "$parentLeftTextAnchor", "LeftTextAnchorLabel", Loc ["STRING_OPTIONS_TEXT_LEFT_ANCHOR"], "GameFontNormal") + --right text anchor + g:NewLabel (frame5, _, "$parentRightTextAnchor", "RightTextAnchorLabel", Loc ["STRING_OPTIONS_TEXT_RIGHT_ANCHOR"], "GameFontNormal") + + local x = window.left_start_at + + titulo_texts:SetPoint (x, -30) + titulo_texts_desc:SetPoint (x, -50) + + local left_side = { + {"LeftTextAnchorLabel", 1, true}, + {"textLeftOutlineLabel", 2}, + {"classColorsLeftTextLabel", 3}, + {"RightTextAnchorLabel", 4, true}, + {"textRightOutlineLabel", 5}, + {"classColorsRightTextLabel", 6}, + {"cutomRightTextLabel", 7}, + {"cutomRightTextEntryLabel", 8}, + } + + window:arrange_menu (frame5, left_side, x, window.top_start_at) + + local right_side = { + {"RowGeneralAnchorLabel", 1, true}, + {frame5.fonsizeLabel, 2}, --text size + {frame5.fontLabel, 3},--text fontface + {frame5.fixedTextColorLabel, 4}, + {frame5.percentLabel, 5}, + } + + window:arrange_menu (frame5, right_side, window.right_start_at, window.top_start_at) + - g:NewLabel (frame5, _, "$parentCustomRightTextAnchor", "customRightTextAnchorLabel", Loc ["STRING_OPTIONS_BARRIGHTTEXTCUSTOM_ANCHOR"], "GameFontNormal") - frame5.customRightTextAnchorLabel:SetPoint (10, -280) - frame5.cutomRightTextLabel:SetPoint (10, -305) - frame5.cutomRightTextEntryLabel:SetPoint (10, -330) end @@ -3715,11 +3941,8 @@ function window:CreateFrame6() g:NewLabel (frame6, _, "$parentWindowColorPickLabel", "windowPickColorLabel", Loc ["STRING_OPTIONS_INSTANCE_COLOR"], "GameFontHighlightLeft") frame6.windowColorPick:SetPoint ("left", frame6.windowPickColorLabel, "right", 2, 0) - frame6.windowColorPick.info = Loc ["STRING_OPTIONS_INSTANCE_COLOR_DESC"] - window:create_line_background (frame6, frame6.windowPickColorLabel, frame6.windowColorPick) - frame6.windowColorPick:SetHook ("OnEnter", background_on_enter) - frame6.windowColorPick:SetHook ("OnLeave", background_on_leave) - + window:CreateLineBackground2 (frame6, "windowColorPick", "windowPickColorLabel", Loc ["STRING_OPTIONS_INSTANCE_COLOR_DESC"]) + --> Transparency local s = g:NewSlider (frame6, _, "$parentAlphaSlider", "alphaSlider", SLIDER_WIDTH, 20, 0.02, 1, 0.02, instance.bg_alpha, true) s:SetBackdrop (slider_backdrop) @@ -3737,10 +3960,7 @@ function window:CreateFrame6() g:NewLabel (frame6, _, "$parentWindowBackgroundColorPickLabel", "windowBackgroundPickColorLabel", Loc ["STRING_OPTIONS_INSTANCE_ALPHA2"], "GameFontHighlightLeft") frame6.windowBackgroundColorPick:SetPoint ("left", frame6.windowBackgroundPickColorLabel, "right", 2, 0) - frame6.windowBackgroundColorPick.info = Loc ["STRING_OPTIONS_INSTANCE_ALPHA2_DESC"] - window:create_line_background (frame6, frame6.windowBackgroundPickColorLabel, frame6.windowBackgroundColorPick) - frame6.windowBackgroundColorPick:SetHook ("OnEnter", background_on_enter) - frame6.windowBackgroundColorPick:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame6, "windowBackgroundColorPick", "windowBackgroundPickColorLabel", Loc ["STRING_OPTIONS_INSTANCE_ALPHA2_DESC"]) --> sidebars statusbar g:NewSwitch (frame6, _, "$parentSideBarsSlider", "sideBarsSlider", 60, 20, _, _, instance.show_sidebars) @@ -3761,11 +3981,8 @@ function window:CreateFrame6() return true end) frame6.alphaSlider.thumb:SetSize (30+(120*0.2)+2, 20*1.2) - - frame6.alphaSlider.info = Loc ["STRING_OPTIONS_INSTANCE_ALPHA_DESC"] - window:create_line_background (frame6, frame6.alphaLabel, frame6.alphaSlider) - frame6.alphaSlider:SetHook ("OnEnter", background_on_enter) - frame6.alphaSlider:SetHook ("OnLeave", background_on_leave) + + window:CreateLineBackground2 (frame6, "alphaSlider", "alphaLabel", Loc ["STRING_OPTIONS_INSTANCE_ALPHA_DESC"]) -- stretch button anchor @@ -3793,10 +4010,7 @@ function window:CreateFrame6() end frame6.stretchAnchorSlider.thumb:SetSize (40, 12) - frame6.stretchAnchorSlider.info = Loc ["STRING_OPTIONS_STRETCH_DESC"] - window:create_line_background (frame6, frame6.stretchAnchorLabel, frame6.stretchAnchorSlider) - frame6.stretchAnchorSlider:SetHook ("OnEnter", background_on_enter) - frame6.stretchAnchorSlider:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame6, "stretchAnchorSlider", "stretchAnchorLabel", Loc ["STRING_OPTIONS_STRETCH_DESC"]) --stretch button always on top g:NewSwitch (frame6, _, "$parentStretchAlwaysOnTopSlider", "stretchAlwaysOnTopSlider", 60, 20, _, _, instance.grab_on_top) @@ -3807,11 +4021,8 @@ function window:CreateFrame6() frame6.stretchAlwaysOnTopSlider.OnSwitch = function (self, instance, value) instance:StretchButtonAlwaysOnTop (value) end - - frame6.stretchAlwaysOnTopSlider.info = Loc ["STRING_OPTIONS_STRETCHTOP_DESC"] - window:create_line_background (frame6, frame6.stretchAlwaysOnTopLabel, frame6.stretchAlwaysOnTopSlider) - frame6.stretchAlwaysOnTopSlider:SetHook ("OnEnter", background_on_enter) - frame6.stretchAlwaysOnTopSlider:SetHook ("OnLeave", background_on_leave) + + window:CreateLineBackground2 (frame6, "stretchAlwaysOnTopSlider", "stretchAlwaysOnTopLabel", Loc ["STRING_OPTIONS_STRETCHTOP_DESC"]) -- instance toolbar side g:NewSwitch (frame6, _, "$parentInstanceToolbarSideSlider", "instanceToolbarSideSlider", 80, 20, Loc ["STRING_BOTTOM"], Loc ["STRING_TOP"], instance.toolbar_side, nil, grow_switch_func, grow_return_func) @@ -3826,10 +4037,7 @@ function window:CreateFrame6() end frame6.instanceToolbarSideSlider.thumb:SetSize (50, 12) - frame6.instanceToolbarSideSlider.info = Loc ["STRING_OPTIONS_TOOLBARSIDE_DESC"] - window:create_line_background (frame6, frame6.instanceToolbarSideLabel, frame6.instanceToolbarSideSlider) - frame6.instanceToolbarSideSlider:SetHook ("OnEnter", background_on_enter) - frame6.instanceToolbarSideSlider:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame6, "instanceToolbarSideSlider", "instanceToolbarSideLabel", Loc ["STRING_OPTIONS_TOOLBARSIDE_DESC"]) --> micro displays side g:NewSwitch (frame6, _, "$parentInstanceMicroDisplaysSideSlider", "instanceMicroDisplaysSideSlider", 80, 20, Loc ["STRING_BOTTOM"], Loc ["STRING_TOP"], instance.toolbar_side, nil, grow_switch_func, grow_return_func) @@ -3841,10 +4049,7 @@ function window:CreateFrame6() end frame6.instanceMicroDisplaysSideSlider.thumb:SetSize (50, 12) - frame6.instanceMicroDisplaysSideSlider.info = Loc ["STRING_OPTIONS_MICRODISPLAYSSIDE_DESC"] - window:create_line_background (frame6, frame6.instanceMicroDisplaysSideLabel, frame6.instanceMicroDisplaysSideSlider) - frame6.instanceMicroDisplaysSideSlider:SetHook ("OnEnter", background_on_enter) - frame6.instanceMicroDisplaysSideSlider:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame6, "instanceMicroDisplaysSideSlider", "instanceMicroDisplaysSideLabel", Loc ["STRING_OPTIONS_MICRODISPLAYSSIDE_DESC"]) --> show side bars @@ -3859,10 +4064,7 @@ function window:CreateFrame6() end end - frame6.sideBarsSlider.info = Loc ["STRING_OPTIONS_SHOW_SIDEBARS_DESC"] - window:create_line_background (frame6, frame6.sideBarsLabel, frame6.sideBarsSlider) - frame6.sideBarsSlider:SetHook ("OnEnter", background_on_enter) - frame6.sideBarsSlider:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame6, "sideBarsSlider", "sideBarsLabel", Loc ["STRING_OPTIONS_SHOW_SIDEBARS_DESC"]) -- show statusbar @@ -3877,11 +4079,8 @@ function window:CreateFrame6() end instance:BaseFrameSnap() end - - frame6.statusbarSlider.info = Loc ["STRING_OPTIONS_SHOW_STATUSBAR_DESC"] - window:create_line_background (frame6, frame6.statusbarLabel, frame6.statusbarSlider) - frame6.statusbarSlider:SetHook ("OnEnter", background_on_enter) - frame6.statusbarSlider:SetHook ("OnLeave", background_on_leave) + + window:CreateLineBackground2 (frame6, "statusbarSlider", "statusbarLabel", Loc ["STRING_OPTIONS_SHOW_STATUSBAR_DESC"]) --> backdrop texture local onBackdropSelect = function (_, instance, backdropName) @@ -3903,10 +4102,7 @@ function window:CreateFrame6() g:NewLabel (frame6, _, "$parentBackdropLabel", "backdropLabel", Loc ["STRING_OPTIONS_INSTANCE_BACKDROP"], "GameFontHighlightLeft") frame6.backdropDropdown:SetPoint ("left", frame6.backdropLabel, "right", 2) - frame6.backdropDropdown.info = Loc ["STRING_OPTIONS_INSTANCE_BACKDROP_DESC"] - window:create_line_background (frame6, frame6.backdropLabel, frame6.backdropDropdown) - frame6.backdropDropdown:SetHook ("OnEnter", background_on_enter) - frame6.backdropDropdown:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame6, "backdropDropdown", "backdropLabel", Loc ["STRING_OPTIONS_INSTANCE_BACKDROP_DESC"]) --> frame strata local onStrataSelect = function (_, instance, strataName) @@ -3930,10 +4126,7 @@ function window:CreateFrame6() g:NewLabel (frame6, _, "$parentStrataLabel", "strataLabel", Loc ["STRING_OPTIONS_INSTANCE_STRATA"], "GameFontHighlightLeft") frame6.strataDropdown:SetPoint ("left", frame6.strataLabel, "right", 2) - frame6.strataDropdown.info = Loc ["STRING_OPTIONS_INSTANCE_STRATA_DESC"] - window:create_line_background (frame6, frame6.strataLabel, frame6.strataDropdown) - frame6.strataDropdown:SetHook ("OnEnter", background_on_enter) - frame6.strataDropdown:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame6, "strataDropdown", "strataLabel", Loc ["STRING_OPTIONS_INSTANCE_STRATA_DESC"]) @@ -3947,33 +4140,40 @@ function window:CreateFrame6() g:NewColorPickButton (frame6, "$parentStatusbarColorPick", "statusbarColorPick", statusbar_color_callback) g:NewLabel (frame6, _, "$parentStatusbarColorLabel", "statusbarColorLabel", Loc ["STRING_OPTIONS_INSTANCE_STATUSBARCOLOR"], "GameFontHighlightLeft") frame6.statusbarColorPick:SetPoint ("left", frame6.statusbarColorLabel, "right", 2, 0) - window:CreateLineBackground (frame6, "statusbarColorPick", "statusbarColorLabel", Loc ["STRING_OPTIONS_INSTANCE_STATUSBARCOLOR_DESC"]) + window:CreateLineBackground2 (frame6, "statusbarColorPick", "statusbarColorLabel", Loc ["STRING_OPTIONS_INSTANCE_STATUSBARCOLOR_DESC"]) + --general anchor + g:NewLabel (frame6, _, "$parentAdjustmentsAnchor", "AdjustmentsAnchorLabel", Loc ["STRING_OPTIONS_WINDOW_ANCHOR"], "GameFontNormal") + local x = window.left_start_at + + titulo_instance:SetPoint (x, -30) + titulo_instance_desc:SetPoint (x, -50) + + local left_side = { + {"AdjustmentsAnchorLabel", 1, true}, + {"windowPickColorLabel", 2}, + {"windowBackgroundPickColorLabel", 3}, + {"instanceToolbarSideLabel", 4}, + {"stretchAnchorLabel", 6}, + {"instanceMicroDisplaysSideLabel", 5}, + {"sideBarsLabel", 8}, + {"stretchAlwaysOnTopLabel", 7}, + {"backdropLabel", 9}, + {"strataLabel", 10}, + } + + window:arrange_menu (frame6, left_side, x, window.top_start_at) + + local right_side = { + {"statusbarAnchorLabel", 1, true}, + {"statusbarLabel", 2}, + {"statusbarColorLabel", 3}, + } + + window:arrange_menu (frame6, right_side, window.right_start_at, window.top_start_at) - - --anchors - titulo_instance:SetPoint (10, -10) - titulo_instance_desc:SetPoint (10, -30) - - frame6.windowPickColorLabel:SetPoint (10, -70) --window color - --frame6.alphaLabel:SetPoint (10, -95) --background alpha - frame6.windowBackgroundPickColorLabel:SetPoint (10, -95) --background color - - frame6.instanceToolbarSideLabel:SetPoint (10, -120) - frame6.sideBarsLabel:SetPoint (10, -145) --borders - frame6.stretchAnchorLabel:SetPoint (10, -170) --stretch direction - frame6.instanceMicroDisplaysSideLabel:SetPoint (10, -195) - frame6.backdropLabel:SetPoint (10, -220) - frame6.strataLabel:SetPoint (10, -245) - frame6.stretchAlwaysOnTopLabel:SetPoint (10, -270) - - frame6.statusbarAnchorLabel:SetPoint (10, -305) - frame6.statusbarLabel:SetPoint (10, -330) --statusbar - frame6.statusbarColorLabel:SetPoint (10, -355) - - end --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- @@ -4015,15 +4215,8 @@ function window:CreateFrame7() instance:MenuAnchor (nil, y) end) - frame7.menuAnchorXSlider.info = Loc ["STRING_OPTIONS_MENU_X_DESC"] - window:create_line_background (frame7, frame7.menuAnchorXLabel, frame7.menuAnchorXSlider) - frame7.menuAnchorXSlider:SetHook ("OnEnter", background_on_enter) - frame7.menuAnchorXSlider:SetHook ("OnLeave", background_on_leave) - - frame7.menuAnchorYSlider.info = Loc ["STRING_OPTIONS_MENU_X_DESC"] - window:create_line_background (frame7, frame7.menuAnchorYLabel, frame7.menuAnchorYSlider) - frame7.menuAnchorYSlider:SetHook ("OnEnter", background_on_enter) - frame7.menuAnchorYSlider:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame7, "menuAnchorXSlider", "menuAnchorXLabel", Loc ["STRING_OPTIONS_MENU_X_DESC"]) + window:CreateLineBackground2 (frame7, "menuAnchorYSlider", "menuAnchorYLabel", Loc ["STRING_OPTIONS_MENU_X_DESC"]) function frame7:update_menuanchor_xy (instance) if (instance.toolbar_side == 1) then --top @@ -4060,7 +4253,7 @@ function window:CreateFrame7() instance:LeftMenuAnchorSide (value) end - window:CreateLineBackground (frame7, "pluginMenuAnchorSideSlider", "menuAnchorSideLabel", Loc ["STRING_OPTIONS_MENU_ANCHOR_DESC"]) + window:CreateLineBackground2 (frame7, "pluginMenuAnchorSideSlider", "menuAnchorSideLabel", Loc ["STRING_OPTIONS_MENU_ANCHOR_DESC"]) -- desaturate g:NewSwitch (frame7, _, "$parentDesaturateMenuSlider", "desaturateMenuSlider", 60, 20, _, _, instance.desaturated_menu) @@ -4071,10 +4264,7 @@ function window:CreateFrame7() instance:DesaturateMenu (value) end - frame7.desaturateMenuSlider.info = Loc ["STRING_OPTIONS_DESATURATE_MENU_DESC"] - window:create_line_background (frame7, frame7.desaturateMenuLabel, frame7.desaturateMenuSlider) - frame7.desaturateMenuSlider:SetHook ("OnEnter", background_on_enter) - frame7.desaturateMenuSlider:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame7, "desaturateMenuSlider", "desaturateMenuLabel", Loc ["STRING_OPTIONS_DESATURATE_MENU_DESC"]) -- hide icon g:NewSwitch (frame7, _, "$parentHideIconSlider", "hideIconSlider", 60, 20, _, _, instance.hide_icon) @@ -4085,10 +4275,7 @@ function window:CreateFrame7() instance:HideMainIcon (value) end - frame7.hideIconSlider.info = Loc ["STRING_OPTIONS_HIDE_ICON_DESC"] - window:create_line_background (frame7, frame7.hideIconLabel, frame7.hideIconSlider) - frame7.hideIconSlider:SetHook ("OnEnter", background_on_enter) - frame7.hideIconSlider:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame7, "hideIconSlider", "hideIconLabel", Loc ["STRING_OPTIONS_HIDE_ICON_DESC"]) -- plugin icons direction local grow_switch_func = function (slider, value) @@ -4116,10 +4303,7 @@ function window:CreateFrame7() end frame7.pluginIconsDirectionSlider.thumb:SetSize (40, 12) - frame7.pluginIconsDirectionSlider.info = Loc ["STRING_OPTIONS_PICONS_DIRECTION_DESC"] - window:create_line_background (frame7, frame7.pluginIconsDirectionLabel, frame7.pluginIconsDirectionSlider) - frame7.pluginIconsDirectionSlider:SetHook ("OnEnter", background_on_enter) - frame7.pluginIconsDirectionSlider:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame7, "pluginIconsDirectionSlider", "pluginIconsDirectionLabel", Loc ["STRING_OPTIONS_PICONS_DIRECTION_DESC"]) --> show or hide buttons local label_icons = g:NewLabel (frame7, _, "$parentShowButtonsLabel", "showButtonsLabel", Loc ["STRING_OPTIONS_MENU_SHOWBUTTONS"], "GameFontHighlightLeft") @@ -4185,7 +4369,7 @@ function window:CreateFrame7() icon4:SetPoint ("left", icon3, "right", -2, 0) X4:SetPoint ("center", button4, "center") - window:CreateLineBackground (frame7, "showButtons1Button", "showButtonsLabel", Loc ["STRING_OPTIONS_MENU_SHOWBUTTONS_DESC"]) + window:CreateLineBackground2 (frame7, "showButtons1Button", "showButtonsLabel", Loc ["STRING_OPTIONS_MENU_SHOWBUTTONS_DESC"]) --icon sizes local s = g:NewSlider (frame7, _, "$parentMenuIconSizeSlider", "menuIconSizeSlider", SLIDER_WIDTH, 20, 0.4, 1.6, 0.05, instance.menu_icons_size, true) @@ -4202,10 +4386,8 @@ function window:CreateFrame7() instance:ToolbarMenuButtonsSize (value) end) - frame7.menuIconSizeSlider.info = Loc ["STRING_OPTIONS_MENU_BUTTONSSIZE_DESC"] - window:create_line_background (frame7, frame7.menuIconSizeLabel, frame7.menuIconSizeSlider) - frame7.menuIconSizeSlider:SetHook ("OnEnter", background_on_enter) - frame7.menuIconSizeSlider:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame7, "menuIconSizeSlider", "menuIconSizeLabel", Loc ["STRING_OPTIONS_MENU_BUTTONSSIZE_DESC"]) + --auto hide menus --text anchor on options menu --g:NewLabel (frame7, _, "$parentAutoHideLabelAnchor", "autoHideLabel", Loc ["STRING_OPTIONS_MENU_AUTOHIDE_ANCHOR"], "GameFontNormal") @@ -4218,27 +4400,35 @@ function window:CreateFrame7() --do something instance:SetAutoHideMenu (value) end - window:CreateLineBackground (frame7, "autoHideLeftMenuSwitch", "autoHideLeftMenuLabel", Loc ["STRING_OPTIONS_MENU_AUTOHIDE_DESC"]) + window:CreateLineBackground2 (frame7, "autoHideLeftMenuSwitch", "autoHideLeftMenuLabel", Loc ["STRING_OPTIONS_MENU_AUTOHIDE_DESC"]) --right - --> anchors - titulo_toolbar:SetPoint (10, -10) - titulo_toolbar_desc:SetPoint (10, -30) - frame7.menuAnchorXLabel:SetPoint (10, -70) - frame7.menuAnchorYLabel:SetPoint (10, -95) - frame7.menuAnchorSideLabel:SetPoint (10, -120) - frame7.desaturateMenuLabel:SetPoint (10, -145) - frame7.hideIconLabel:SetPoint (10, -170) - frame7.pluginIconsDirectionLabel:SetPoint (10, -195) - label_icons:SetPoint (10, -220) - frame7.menuIconSizeLabel:SetPoint (10, -245) - - --frame7.autoHideLabel:SetPoint (10, -280) - frame7.autoHideLeftMenuLabel:SetPoint (10, -270) - --frame7.autoHideRightMenuLabel:SetPoint (10, -330) + --> Anchors + + --general anchor + g:NewLabel (frame7, _, "$parentLeftMenuAnchor", "LeftMenuAnchorLabel", Loc ["STRING_OPTIONS_LEFT_MENU_ANCHOR"], "GameFontNormal") + local x = window.left_start_at + titulo_toolbar:SetPoint (x, -30) + titulo_toolbar_desc:SetPoint (x, -50) + + local left_side = { + {"LeftMenuAnchorLabel", 1, true}, + {"menuAnchorXLabel", 2}, + {"menuAnchorYLabel", 3}, + {"menuAnchorSideLabel", 4}, + {"desaturateMenuLabel", 5}, + {"hideIconLabel", 6}, + {"pluginIconsDirectionLabel", 7}, + {label_icons, 8}, + {"menuIconSizeLabel", 9}, + {"autoHideLeftMenuLabel", 10}, + } + + window:arrange_menu (frame7, left_side, x, -90) + end @@ -4279,16 +4469,9 @@ function window:CreateFrame8() frame8.menuAnchorYSlider:SetHook ("OnValueChange", function (self, instance, y) instance:Menu2Anchor (nil, y) end) - - frame8.menuAnchorXSlider.info = Loc ["STRING_OPTIONS_MENU2_X_DESC"] - window:create_line_background (frame8, frame8.menuAnchorXLabel, frame8.menuAnchorXSlider) - frame8.menuAnchorXSlider:SetHook ("OnEnter", background_on_enter) - frame8.menuAnchorXSlider:SetHook ("OnLeave", background_on_leave) - - frame8.menuAnchorYSlider.info = Loc ["STRING_OPTIONS_MENU2_X_DESC"] - window:create_line_background (frame8, frame8.menuAnchorYLabel, frame8.menuAnchorYSlider) - frame8.menuAnchorYSlider:SetHook ("OnEnter", background_on_enter) - frame8.menuAnchorYSlider:SetHook ("OnLeave", background_on_leave) + + window:CreateLineBackground2 (frame8, "menuAnchorXSlider", "menuAnchorXLabel", Loc ["STRING_OPTIONS_MENU2_X_DESC"]) + window:CreateLineBackground2 (frame8, "menuAnchorYSlider", "menuAnchorYLabel", Loc ["STRING_OPTIONS_MENU2_X_DESC"]) function frame8:update_menuanchor_xy (instance) if (instance.toolbar_side == 1) then --top @@ -4309,10 +4492,7 @@ function window:CreateFrame8() instance:DesaturateMenu2 (value) end - frame8.desaturateMenuSlider.info = Loc ["STRING_OPTIONS_DESATURATE_MENU_DESC"] - window:create_line_background (frame8, frame8.desaturateMenuLabel, frame8.desaturateMenuSlider) - frame8.desaturateMenuSlider:SetHook ("OnEnter", background_on_enter) - frame8.desaturateMenuSlider:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame8, "desaturateMenuSlider", "desaturateMenuLabel", Loc ["STRING_OPTIONS_DESATURATE_MENU_DESC"]) --> show or hide buttons local label_icons = g:NewLabel (frame8, _, "$parentShowButtonsLabel", "showButtonsLabel", Loc ["STRING_OPTIONS_MENU_SHOWBUTTONS"], "GameFontHighlightLeft") @@ -4371,7 +4551,7 @@ function window:CreateFrame8() icon3:SetPoint ("center", button3, "center") X3:SetPoint ("center", button3, "center") - window:CreateLineBackground (frame8, "showButtons1Button", "showButtonsLabel", Loc ["STRING_OPTIONS_MENU_SHOWBUTTONS_DESC"]) + window:CreateLineBackground2 (frame8, "showButtons1Button", "showButtonsLabel", Loc ["STRING_OPTIONS_MENU_SHOWBUTTONS_DESC"]) --icon sizes local s = g:NewSlider (frame8, _, "$parentMenuIconSizeSlider", "menuIconSizeSlider", SLIDER_WIDTH, 20, 0.4, 1.6, 0.05, instance.menu_icons_size, true) @@ -4388,10 +4568,7 @@ function window:CreateFrame8() instance:ToolbarMenu2ButtonsSize (value) end) - frame8.menuIconSizeSlider.info = Loc ["STRING_OPTIONS_MENU_BUTTONSSIZE_DESC"] - window:create_line_background (frame8, frame8.menuIconSizeLabel, frame8.menuIconSizeSlider) - frame8.menuIconSizeSlider:SetHook ("OnEnter", background_on_enter) - frame8.menuIconSizeSlider:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame8, "menuIconSizeSlider", "menuIconSizeLabel", Loc ["STRING_OPTIONS_MENU_BUTTONSSIZE_DESC"]) --> instance button --text size @@ -4407,10 +4584,7 @@ function window:CreateFrame8() g:NewLabel (frame8, _, "$parentInstanceTextSizeLabel", "instanceTextSizeLabel", Loc ["STRING_OPTIONS_INSTANCE_TEXTSIZE"], "GameFontHighlightLeft") frame8.instanceTextSizeSlider:SetPoint ("left", frame8.instanceTextSizeLabel, "right", 2) - frame8.instanceTextSizeSlider.info = Loc ["STRING_OPTIONS_INSTANCE_TEXTSIZE_DESC"] - window:create_line_background (frame8, frame8.instanceTextSizeLabel, frame8.instanceTextSizeSlider) - frame8.instanceTextSizeSlider:SetHook ("OnEnter", background_on_enter) - frame8.instanceTextSizeSlider:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame8, "instanceTextSizeSlider", "instanceTextSizeLabel", Loc ["STRING_OPTIONS_INSTANCE_TEXTSIZE_DESC"]) --text face local instance_text_color_onselectfont = function (_, instance, fontName) @@ -4434,10 +4608,7 @@ function window:CreateFrame8() g:NewLabel (frame8, _, "$parentInstanceTextFontLabel", "instanceTextFontLabel", Loc ["STRING_OPTIONS_INSTANCE_TEXTFONT"], "GameFontHighlightLeft") frame8.instanceTextFontDropdown:SetPoint ("left", frame8.instanceTextFontLabel, "right", 2) - frame8.instanceTextFontDropdown.info = Loc ["STRING_OPTIONS_INSTANCE_TEXTCOLOR_DESC"] - window:create_line_background (frame8, frame8.instanceTextFontLabel, frame8.instanceTextFontDropdown) - frame8.instanceTextFontDropdown:SetHook ("OnEnter", background_on_enter) - frame8.instanceTextFontDropdown:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame8, "instanceTextFontDropdown", "instanceTextFontLabel", Loc ["STRING_OPTIONS_INSTANCE_TEXTCOLOR_DESC"]) -- text color local instance_textcolor_callback = function (button, r, g, b, a) @@ -4447,10 +4618,7 @@ function window:CreateFrame8() g:NewLabel (frame8, _, "$parentInstanceTextLabel", "instanceTextColorPickLabel", Loc ["STRING_OPTIONS_INSTANCE_TEXTCOLOR"], "GameFontHighlightLeft") frame8.instanceTextColorPick:SetPoint ("left", frame8.instanceTextColorPickLabel, "right", 2, 0) - frame8.instanceTextColorPick.info = Loc ["STRING_OPTIONS_RESET_OVERLAY_DESC"] - window:create_line_background (frame8, frame8.instanceTextColorPickLabel, frame8.instanceTextColorPick) - frame8.instanceTextColorPick:SetHook ("OnEnter", background_on_enter) - frame8.instanceTextColorPick:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame8, "instanceTextColorPick", "instanceTextColorPickLabel", Loc ["STRING_OPTIONS_RESET_OVERLAY_DESC"]) --text shadow g:NewLabel (frame8, _, "$parentInstanceTextShadowLabel", "instanceTextShadowLabel", Loc ["STRING_OPTIONS_MENU_ATTRIBUTE_SHADOW"], "GameFontHighlightLeft") @@ -4459,7 +4627,7 @@ function window:CreateFrame8() frame8.instanceTextShadowSwitch.OnSwitch = function (self, instance, value) instance:ToolbarMenu2InstanceButtonSettings (nil, nil, nil, value) end - window:CreateLineBackground (frame8, "instanceTextShadowSwitch", "instanceTextShadowLabel", Loc ["STRING_OPTIONS_MENU_ATTRIBUTE_SHADOW_DESC"]) + window:CreateLineBackground2 (frame8, "instanceTextShadowSwitch", "instanceTextShadowLabel", Loc ["STRING_OPTIONS_MENU_ATTRIBUTE_SHADOW_DESC"]) --> auto hide menu g:NewLabel (frame8, _, "$parentAutoHideRightMenuLabel", "autoHideRightMenuLabel", Loc ["STRING_OPTIONS_MENU_AUTOHIDE_RIGHT"], "GameFontHighlightLeft") @@ -4469,27 +4637,42 @@ function window:CreateFrame8() --do something instance:SetAutoHideMenu (nil, value) end - window:CreateLineBackground (frame8, "autoHideRightMenuSwitch", "autoHideRightMenuLabel", Loc ["STRING_OPTIONS_MENU_AUTOHIDE_DESC"]) + window:CreateLineBackground2 (frame8, "autoHideRightMenuSwitch", "autoHideRightMenuLabel", Loc ["STRING_OPTIONS_MENU_AUTOHIDE_DESC"]) - --> anchors - titulo_toolbar2:SetPoint (10, -10) - titulo_toolbar2_desc:SetPoint (10, -30) - - frame8.menuAnchorXLabel:SetPoint (10, -70) - frame8.menuAnchorYLabel:SetPoint (10, -95) - frame8.desaturateMenuLabel:SetPoint (10, -120) - frame8.showButtonsLabel:SetPoint (10, -145) - frame8.menuIconSizeLabel:SetPoint (10, -170) - frame8.autoHideRightMenuLabel:SetPoint (10, -195) + --> Anchors + + --general anchor + g:NewLabel (frame8, _, "$parentRightMenuAnchor", "RightMenuAnchorLabel", Loc ["STRING_OPTIONS_LEFT_MENU_ANCHOR"], "GameFontNormal") + local x = window.left_start_at + + titulo_toolbar2:SetPoint (x, -30) + titulo_toolbar2_desc:SetPoint (x, -50) + + local left_side = { + {"RightMenuAnchorLabel", 1, true}, + {"menuAnchorXLabel", 2}, + {"menuAnchorYLabel", 3}, + {"desaturateMenuLabel", 4}, + {"showButtonsLabel", 5}, + {"menuIconSizeLabel", 6}, + {"autoHideRightMenuLabel", 7}, + } + + window:arrange_menu (frame8, left_side, x, -90) + g:NewLabel (frame8, _, "$parentInstanceButtonAnchor", "instanceAnchorLabel", Loc ["STRING_OPTIONS_INSTANCE_BUTTON_ANCHOR"], "GameFontNormal") - frame8.instanceAnchorLabel:SetPoint (10, -230) - frame8.instanceTextColorPickLabel:SetPoint (10, -255) - frame8.instanceTextFontLabel:SetPoint (10, -280) - frame8.instanceTextSizeLabel:SetPoint (10, -305) - frame8.instanceTextShadowLabel:SetPoint (10, -330) + local right_menu = { + {"instanceAnchorLabel", 1, true}, + {"instanceTextColorPickLabel", 2}, + {"instanceTextFontLabel", 3}, + {"instanceTextSizeLabel", 4}, + {"instanceTextShadowLabel", 5}, + } + window:arrange_menu (frame8, right_menu, window.right_start_at, -90) + end --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- @@ -4801,55 +4984,42 @@ function window:CreateFrame9() -- frame9.editImage:InstallCustomTexture() - frame9.useBackgroundSlider.info = Loc ["STRING_OPTIONS_WP_ENABLE_DESC"] - window:create_line_background (frame9, frame9.enablewallpaperLabel, frame9.useBackgroundSlider) - frame9.useBackgroundSlider:SetHook ("OnEnter", background_on_enter) - frame9.useBackgroundSlider:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame9, "useBackgroundSlider", "enablewallpaperLabel", Loc ["STRING_OPTIONS_WP_ENABLE_DESC"]) - frame9.anchorDropdown.info = Loc ["STRING_OPTIONS_WP_ALIGN_DESC"] - window:create_line_background (frame9, frame9.anchorLabel, frame9.anchorDropdown) - frame9.anchorDropdown:SetHook ("OnEnter", background_on_enter) - frame9.anchorDropdown:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame9, "anchorDropdown", "anchorLabel", Loc ["STRING_OPTIONS_WP_ALIGN_DESC"]) - frame9.editImage.info = Loc ["STRING_OPTIONS_WP_EDIT_DESC"] - window:create_line_background (frame9, frame9.editImage, frame9.editImage) - frame9.editImage:SetHook ("OnEnter", background_on_enter) - frame9.editImage:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame9, "editImage", "editImage", Loc ["STRING_OPTIONS_WP_EDIT_DESC"]) - frame9.backgroundDropdown.info = Loc ["STRING_OPTIONS_WP_GROUP_DESC"] - window:create_line_background (frame9, frame9.wallpapergroupLabel, frame9.backgroundDropdown) - frame9.backgroundDropdown:SetHook ("OnEnter", background_on_enter) - frame9.backgroundDropdown:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame9, "backgroundDropdown", "wallpapergroupLabel", Loc ["STRING_OPTIONS_WP_GROUP_DESC"]) - frame9.backgroundDropdown2.info = Loc ["STRING_OPTIONS_WP_GROUP2_DESC"] - window:create_line_background (frame9, frame9.selectwallpaperLabel, frame9.backgroundDropdown2) - frame9.backgroundDropdown2:SetHook ("OnEnter", background_on_enter) - frame9.backgroundDropdown2:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame9, "backgroundDropdown2", "selectwallpaperLabel", Loc ["STRING_OPTIONS_WP_GROUP2_DESC"]) g:NewLabel (frame9, _, "$parentWallpaperPreviewAnchor", "wallpaperPreviewAnchorLabel", "Preview:", "GameFontNormal") --128 64 - local icon1 = g:NewImage (frame9, nil, 128, 64, "border", nil, nil, "$parentIcon1") + local icon1 = g:NewImage (frame9, nil, 128, 64, "artwork", nil, nil, "$parentIcon1") icon1:SetTexture ("Interface\\AddOns\\Details\\images\\icons") icon1:SetPoint ("topleft", frame9.wallpaperPreviewAnchorLabel.widget, "bottomleft", 0, -5) - icon1:SetDrawLayer ("artwork", 0) + icon1:SetDrawLayer ("artwork", 1) icon1:SetTexCoord (0.337890625, 0.5859375, 0.59375, 0.716796875-0.0009765625) --173 304 300 367 - local icon2 = g:NewImage (frame9, nil, 128, 64, "border", nil, nil, "$parentIcon2") + + local icon2 = g:NewImage (frame9, nil, 128, 64, "artwork", nil, nil, "$parentIcon2") icon2:SetTexture ("Interface\\AddOns\\Details\\images\\icons") icon2:SetPoint ("left", icon1.widget, "right") - icon2:SetDrawLayer ("artwork", 0) + icon2:SetDrawLayer ("artwork", 1) icon2:SetTexCoord (0.337890625, 0.5859375, 0.59375, 0.716796875-0.0009765625) --173 304 300 367 - local icon3 = g:NewImage (frame9, nil, 128, 64, "border", nil, nil, "$parentIcon3") + local icon3 = g:NewImage (frame9, nil, 128, 64, "artwork", nil, nil, "$parentIcon3") icon3:SetTexture ("Interface\\AddOns\\Details\\images\\icons") icon3:SetPoint ("top", icon1.widget, "bottom") - icon3:SetDrawLayer ("artwork", 0) + icon3:SetDrawLayer ("artwork", 1) icon3:SetTexCoord (0.337890625, 0.5859375, 0.59375+0.0009765625, 0.716796875) --173 304 300 367 - local icon4 = g:NewImage (frame9, nil, 128, 64, "border", nil, nil, "$parentIcon4") + + local icon4 = g:NewImage (frame9, nil, 128, 64, "artwork", nil, nil, "$parentIcon4") icon4:SetTexture ("Interface\\AddOns\\Details\\images\\icons") icon4:SetPoint ("left", icon3.widget, "right") - icon4:SetDrawLayer ("artwork", 0) + icon4:SetDrawLayer ("artwork", 1) icon4:SetTexCoord (0.337890625, 0.5859375, 0.59375+0.0009765625, 0.716796875) --173 304 300 367 icon1:SetVertexColor (.15, .15, .15, 1) @@ -4858,11 +5028,12 @@ function window:CreateFrame9() icon4:SetVertexColor (.15, .15, .15, 1) local preview = frame9:CreateTexture (nil, "overlay") - preview:SetDrawLayer ("overlay", 1) + preview:SetDrawLayer ("artwork", 3) preview:SetSize (256, 128) preview:SetPoint ("topleft", frame9.wallpaperPreviewAnchorLabel.widget, "bottomleft", 0, -5) local w, h = 20, 20 + local L1 = frame9:CreateTexture (nil, "overlay") L1:SetPoint ("topleft", preview, "topleft") L1:SetTexture ("Interface\\AddOns\\Details\\images\\icons") @@ -4880,19 +5051,19 @@ function window:CreateFrame9() L2:SetVertexColor (1, 1, 1, .8) local L3 = frame9:CreateTexture (nil, "overlay") - L3:SetPoint ("bottomright", preview, "bottomright") + L3:SetPoint ("bottomright", preview, "bottomright", 0, 0) L3:SetTexture ("Interface\\AddOns\\Details\\images\\icons") - L3:SetTexCoord (0.234375, 0.13671875+0.0009765625, 0.1953125+0.0009765625, 0.29296875) + L3:SetTexCoord (0.234375, 0.13671875-0.0009765625, 0.1953125+0.0009765625, 0.29296875) L3:SetSize (w, h) - L3:SetDrawLayer ("overlay", 2) + L3:SetDrawLayer ("overlay", 5) L3:SetVertexColor (1, 1, 1, .8) local L4 = frame9:CreateTexture (nil, "overlay") - L4:SetPoint ("topright", preview, "topright") + L4:SetPoint ("topright", preview, "topright", 0, 0) L4:SetTexture ("Interface\\AddOns\\Details\\images\\icons") - L4:SetTexCoord (0.234375, 0.13671875+0.0009765625, 0.29296875, 0.1953125+0.0009765625) + L4:SetTexCoord (0.234375, 0.13671875-0.0009765625, 0.29296875, 0.1953125+0.0009765625) L4:SetSize (w, h) - L4:SetDrawLayer ("overlay", 2) + L4:SetDrawLayer ("overlay", 5) L4:SetVertexColor (1, 1, 1, .8) function window:update_wallpaper_info() @@ -4937,26 +5108,39 @@ function window:CreateFrame9() g:NewLabel (frame9, _, "$parentWallpaperCurrentAnchor", "wallpaperCurrentAnchorLabel", "Current:", "GameFontNormal") g:NewLabel (frame9, _, "$parentWallpaperCurrentLabel", "wallpaperCurrentLabel", "", "GameFontHighlightSmall") - --anchors + --> Anchors - titulo_wallpaper:SetPoint (10, -10) - titulo_wallpaper_desc:SetPoint (10, -30) - - frame9.enablewallpaperLabel:SetPoint (10, -70) - - frame9.wallpapergroupLabel:SetPoint (10, -95) - frame9.selectwallpaperLabel:SetPoint (10, -120) - frame9.backgroundDropdown:SetPoint ("left", frame9.wallpapergroupLabel, "right", 2, 0) frame9.backgroundDropdown2:SetPoint ("left", frame9.selectwallpaperLabel, "right", 2, 0) - frame9.anchorLabel:SetPoint (10, -145) - frame9.editImage:SetPoint (10, -170) + --general anchor + g:NewLabel (frame9, _, "$parentWallpaperAnchor", "WallpaperAnchorLabel", Loc ["STRING_OPTIONS_WALLPAPER_ANCHOR"], "GameFontNormal") - frame9.wallpaperPreviewAnchorLabel:SetPoint (10, -210) + local x = window.left_start_at - frame9.wallpaperCurrentAnchorLabel:SetPoint (10, -380) - frame9.wallpaperCurrentLabel:SetPoint (10, -400) + titulo_wallpaper:SetPoint (x, -30) + titulo_wallpaper_desc:SetPoint (x, -50) + + local left_side = { + {"WallpaperAnchorLabel", 1, true}, + {"enablewallpaperLabel", 2}, + {"wallpapergroupLabel", 3}, + {"selectwallpaperLabel", 4}, + {"anchorLabel", 5}, + {"editImage", 6}, + {"wallpaperCurrentAnchorLabel", 7, true}, + {"wallpaperCurrentLabel", 8}, + + } + + window:arrange_menu (frame9, left_side, x, -90) + + local right_side = { + {"wallpaperPreviewAnchorLabel", 1, true}, + --{"", 2}, + } + window:arrange_menu (frame9, right_side, window.right_start_at, -90) + --> wallpaper settings @@ -5014,7 +5198,7 @@ function window:CreateFrame10() return true end) - frame10.memorySlider.info = Loc ["STRING_OPTIONS_MEMORYT_DESC"] + frame10.memorySlider.thumb:SetSize (40, 12) frame10.memorySlider.thumb:SetTexture ([[Interface\Buttons\UI-Listbox-Highlight2]]) frame10.memorySlider.thumb:SetVertexColor (.2, .2, .2, .9) @@ -5023,9 +5207,7 @@ function window:CreateFrame10() frame10.memorySlider:SetValue (2) frame10.memorySlider:SetValue (t) - window:create_line_background (frame10, frame10.memoryLabel, frame10.memorySlider) - frame10.memorySlider:SetHook ("OnEnter", background_on_enter) - frame10.memorySlider:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame10, "memorySlider", "memoryLabel", Loc ["STRING_OPTIONS_MEMORYT_DESC"]) --------------- Max Segments Saved g:NewLabel (frame10, _, "$parentLabelSegmentsSave", "segmentsSaveLabel", Loc ["STRING_OPTIONS_SEGMENTSSAVE"], "GameFontHighlightLeft") @@ -5035,11 +5217,8 @@ function window:CreateFrame10() frame10.segmentsSliderToSave:SetHook ("OnValueChange", function (self, _, amount) --> slider, fixedValue, sliderValue _detalhes.segments_amount_to_save = math.floor (amount) end) - frame10.segmentsSliderToSave.info = Loc ["STRING_OPTIONS_SEGMENTSSAVE_DESC"] - - window:create_line_background (frame10, frame10.segmentsSaveLabel, frame10.segmentsSliderToSave) - frame10.segmentsSliderToSave:SetHook ("OnEnter", background_on_enter) - frame10.segmentsSliderToSave:SetHook ("OnLeave", background_on_leave) + + window:CreateLineBackground2 (frame10, "segmentsSliderToSave", "segmentsSaveLabel", Loc ["STRING_OPTIONS_SEGMENTSSAVE_DESC"]) --------------- Panic Mode g:NewLabel (frame10, _, "$parentPanicModeLabel", "panicModeLabel", Loc ["STRING_OPTIONS_PANIMODE"], "GameFontHighlightLeft") @@ -5049,11 +5228,8 @@ function window:CreateFrame10() frame10.panicModeSlider.OnSwitch = function (self, _, value) --> slider, fixedValue, sliderValue _detalhes.segments_panic_mode = value end - frame10.panicModeSlider.info = Loc ["STRING_OPTIONS_PANIMODE_DESC"] - window:create_line_background (frame10, frame10.panicModeLabel, frame10.panicModeSlider) - frame10.panicModeSlider:SetHook ("OnEnter", background_on_enter) - frame10.panicModeSlider:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame10, "panicModeSlider", "panicModeLabel", Loc ["STRING_OPTIONS_PANIMODE_DESC"]) --------------- Animate Rows @@ -5064,14 +5240,11 @@ function window:CreateFrame10() -- g:NewSwitch (frame10, _, "$parentClearAnimateScrollSlider", "animatescrollSlider", 60, 20, _, _, _detalhes.animate_scroll) -- ltext, rtext, defaultv frame10.animatescrollSlider:SetPoint ("left", frame10.animatescrollLabel, "right", 2, 0) - frame10.animatescrollSlider.info = Loc ["STRING_OPTIONS_ANIMATESCROLL_DESC"] frame10.animatescrollSlider.OnSwitch = function (self, _, value) --> slider, fixedValue, sliderValue _detalhes.animate_scroll = value end - window:create_line_background (frame10, frame10.animatescrollLabel, frame10.animatescrollSlider) - frame10.animatescrollSlider:SetHook ("OnEnter", background_on_enter) - frame10.animatescrollSlider:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame10, "animatescrollSlider", "animatescrollLabel", Loc ["STRING_OPTIONS_ANIMATESCROLL_DESC"]) --------------- Update Speed @@ -5085,21 +5258,28 @@ function window:CreateFrame10() frame10.removeTrashSlider.OnSwitch = function (self, _, amount) _detalhes.trash_auto_remove = amount end - frame10.removeTrashSlider.info = Loc ["STRING_OPTIONS_CLEANUP_DESC"] - window:create_line_background (frame10, frame10.eraseTrashLabel, frame10.removeTrashSlider) - frame10.removeTrashSlider:SetHook ("OnEnter", background_on_enter) - frame10.removeTrashSlider:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame10, "removeTrashSlider", "eraseTrashLabel", Loc ["STRING_OPTIONS_CLEANUP_DESC"]) - titulo_performance_general:SetPoint (10, -10) - titulo_performance_general_desc:SetPoint (10, -30) - frame10.memoryLabel:SetPoint (10, -70) - frame10.segmentsSaveLabel:SetPoint (10, -95) - frame10.panicModeLabel:SetPoint (10, -120) - --frame10.animateLabel:SetPoint (10, -145) - --frame10.animatescrollLabel:SetPoint (10, -170) - --frame10.updatespeedLabel:SetPoint (10, -170) - frame10.eraseTrashLabel:SetPoint (10, -145) + --> Anchors + + --general anchor + g:NewLabel (frame10, _, "$parentPerformanceAnchor", "PerformanceAnchorLabel", Loc ["STRING_OPTIONS_PERFORMANCE_ANCHOR"], "GameFontNormal") + + local x = window.left_start_at + + titulo_performance_general:SetPoint (x, -30) + titulo_performance_general_desc:SetPoint (x, -50) + + local left_side = { + {"PerformanceAnchorLabel", 1, true}, + {"memoryLabel", 2}, + {"segmentsSaveLabel", 3}, + {"panicModeLabel", 4}, + {"eraseTrashLabel", 5}, + } + + window:arrange_menu (frame10, left_side, x, -90) end @@ -5153,68 +5333,54 @@ function window:CreateFrame11() g:NewSwitch (frame11, _, "$parentCaptureDamageSlider", "damageCaptureSlider", 60, 20, _, _, _detalhes.capture_real ["damage"]) frame11.damageCaptureSlider:SetPoint ("left", frame11.damageCaptureLabel, "right", 2) - frame11.damageCaptureSlider.info = Loc ["STRING_OPTIONS_CDAMAGE_DESC"] frame11.damageCaptureSlider.OnSwitch = function (self, _, value) _detalhes:CaptureSet (value, "damage", true) switch_icon_color (frame11.damageCaptureImage, value) end switch_icon_color (frame11.damageCaptureImage, _detalhes.capture_real ["damage"]) - window:create_line_background (frame11, frame11.damageCaptureLabel, frame11.damageCaptureSlider) - frame11.damageCaptureSlider:SetHook ("OnEnter", background_on_enter) - frame11.damageCaptureSlider:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame11, "damageCaptureSlider", "damageCaptureLabel", Loc ["STRING_OPTIONS_CDAMAGE_DESC"]) g:NewSwitch (frame11, _, "$parentCaptureHealSlider", "healCaptureSlider", 60, 20, _, _, _detalhes.capture_real ["heal"]) frame11.healCaptureSlider:SetPoint ("left", frame11.healCaptureLabel, "right", 2) - frame11.healCaptureSlider.info = Loc ["STRING_OPTIONS_CHEAL_DESC"] frame11.healCaptureSlider.OnSwitch = function (self, _, value) _detalhes:CaptureSet (value, "heal", true) switch_icon_color (frame11.healCaptureImage, value) end switch_icon_color (frame11.healCaptureImage, _detalhes.capture_real ["heal"]) - window:create_line_background (frame11, frame11.healCaptureLabel, frame11.healCaptureSlider) - frame11.healCaptureSlider:SetHook ("OnEnter", background_on_enter) - frame11.healCaptureSlider:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame11, "healCaptureSlider", "healCaptureLabel", Loc ["STRING_OPTIONS_CHEAL_DESC"]) g:NewSwitch (frame11, _, "$parentCaptureEnergySlider", "energyCaptureSlider", 60, 20, _, _, _detalhes.capture_real ["energy"]) frame11.energyCaptureSlider:SetPoint ("left", frame11.energyCaptureLabel, "right", 2) - frame11.energyCaptureSlider.info = Loc ["STRING_OPTIONS_CENERGY_DESC"] + frame11.energyCaptureSlider.OnSwitch = function (self, _, value) _detalhes:CaptureSet (value, "energy", true) switch_icon_color (frame11.energyCaptureImage, value) end switch_icon_color (frame11.energyCaptureImage, _detalhes.capture_real ["energy"]) - window:create_line_background (frame11, frame11.energyCaptureLabel, frame11.energyCaptureSlider) - frame11.energyCaptureSlider:SetHook ("OnEnter", background_on_enter) - frame11.energyCaptureSlider:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame11, "energyCaptureSlider", "energyCaptureLabel", Loc ["STRING_OPTIONS_CENERGY_DESC"]) g:NewSwitch (frame11, _, "$parentCaptureMiscSlider", "miscCaptureSlider", 60, 20, _, _, _detalhes.capture_real ["miscdata"]) frame11.miscCaptureSlider:SetPoint ("left", frame11.miscCaptureLabel, "right", 2) - frame11.miscCaptureSlider.info = Loc ["STRING_OPTIONS_CMISC_DESC"] frame11.miscCaptureSlider.OnSwitch = function (self, _, value) _detalhes:CaptureSet (value, "miscdata", true) switch_icon_color (frame11.miscCaptureImage, value) end switch_icon_color (frame11.miscCaptureImage, _detalhes.capture_real ["miscdata"]) - window:create_line_background (frame11, frame11.miscCaptureLabel, frame11.miscCaptureSlider) - frame11.miscCaptureSlider:SetHook ("OnEnter", background_on_enter) - frame11.miscCaptureSlider:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame11, "miscCaptureSlider", "miscCaptureLabel", Loc ["STRING_OPTIONS_CMISC_DESC"]) g:NewSwitch (frame11, _, "$parentCaptureAuraSlider", "auraCaptureSlider", 60, 20, _, _, _detalhes.capture_real ["aura"]) frame11.auraCaptureSlider:SetPoint ("left", frame11.auraCaptureLabel, "right", 2) - frame11.auraCaptureSlider.info = Loc ["STRING_OPTIONS_CAURAS_DESC"] frame11.auraCaptureSlider.OnSwitch = function (self, _, value) _detalhes:CaptureSet (value, "aura", true) switch_icon_color (frame11.auraCaptureImage, value) end switch_icon_color (frame11.auraCaptureImage, _detalhes.capture_real ["aura"]) - window:create_line_background (frame11, frame11.auraCaptureLabel, frame11.auraCaptureSlider) - frame11.auraCaptureSlider:SetHook ("OnEnter", background_on_enter) - frame11.auraCaptureSlider:SetHook ("OnLeave", background_on_leave) + window:CreateLineBackground2 (frame11, "auraCaptureSlider", "auraCaptureLabel", Loc ["STRING_OPTIONS_CAURAS_DESC"]) --------------- Cloud Capture @@ -5222,24 +5388,35 @@ function window:CreateFrame11() g:NewSwitch (frame11, _, "$parentCloudAuraSlider", "cloudCaptureSlider", 60, 20, _, _, _detalhes.cloud_capture) frame11.cloudCaptureSlider:SetPoint ("left", frame11.cloudCaptureLabel, "right", 2) - frame11.cloudCaptureSlider.info = Loc ["STRING_OPTIONS_CLOUD_DESC"] frame11.cloudCaptureSlider.OnSwitch = function (self, _, value) _detalhes.cloud_capture = value end - window:create_line_background (frame11, frame11.cloudCaptureLabel, frame11.cloudCaptureSlider) - frame11.cloudCaptureSlider:SetHook ("OnEnter", background_on_enter) - frame11.cloudCaptureSlider:SetHook ("OnLeave", background_on_leave) - - titulo_performance_captures:SetPoint (10, -10) - titulo_performance_captures_desc:SetPoint (10, -30) - frame11.damageCaptureImage:SetPoint (10, -70) - frame11.healCaptureImage:SetPoint (10, -95) - frame11.energyCaptureImage:SetPoint (10, -120) - frame11.miscCaptureImage:SetPoint (10, -145) - frame11.auraCaptureImage:SetPoint (10, -170) - frame11.cloudCaptureLabel:SetPoint (10, -200) + window:CreateLineBackground2 (frame11, "cloudCaptureSlider", "cloudCaptureLabel", Loc ["STRING_OPTIONS_CLOUD_DESC"] ) + + --> Anchors + --general anchor + g:NewLabel (frame11, _, "$parentDataCollectAnchor", "DataCollectAnchorLabel", Loc ["STRING_OPTIONS_DATACOLLECT_ANCHOR"], "GameFontNormal") + + local x = window.left_start_at + + titulo_performance_captures:SetPoint (x, -30) + titulo_performance_captures_desc:SetPoint (x, -50) + + local left_side = { + {"DataCollectAnchorLabel", 1, true}, + {"damageCaptureImage", 2}, + {"healCaptureImage", 3}, + {"energyCaptureImage", 4}, + {"miscCaptureImage", 5}, + {"auraCaptureImage", 6}, + {"cloudCaptureLabel", 7, true}, + } + + window:arrange_menu (frame11, left_side, x, -90) + + -- end window.creating = nil end @@ -5576,6 +5753,14 @@ function window:update_all (editing_instance) _G.DetailsOptionsWindow4BarStartSlider.MyObject:SetFixedParameter (editing_instance) _G.DetailsOptionsWindow4BarStartSlider.MyObject:SetValue (editing_instance.row_info.start_after_icon) + _G.DetailsOptionsWindow4BackdropBorderTextureDropdown.MyObject:SetFixedParameter (editing_instance) + _G.DetailsOptionsWindow4BackdropEnabledSlider.MyObject:SetFixedParameter (editing_instance) + _G.DetailsOptionsWindow4BackdropSizeHeight.MyObject:SetFixedParameter (editing_instance) + _G.DetailsOptionsWindow4BackdropBorderTextureDropdown.MyObject:Select (editing_instance.row_info.backdrop.texture) + _G.DetailsOptionsWindow4BackdropEnabledSlider.MyObject:SetValue (editing_instance.row_info.backdrop.enabled) + _G.DetailsOptionsWindow4BackdropSizeHeight.MyObject:SetValue (editing_instance.row_info.backdrop.size) + _G.DetailsOptionsWindow4BackdropColorPick.MyObject:SetColor (unpack (editing_instance.row_info.backdrop.color)) + --> window 5 _G.DetailsOptionsWindow5PercentDropdown.MyObject:SetFixedParameter (editing_instance) @@ -5583,7 +5768,10 @@ function window:update_all (editing_instance) _G.DetailsOptionsWindow5CutomRightTextSlider.MyObject:SetFixedParameter (editing_instance) _G.DetailsOptionsWindow5CutomRightTextSlider.MyObject:SetValue (editing_instance.row_info.textR_enable_custom_text) - _G.DetailsOptionsWindow5CutomRightTextEntry.MyObject:SetText (editing_instance.row_info.textR_custom_text) + + local text = editing_instance.row_info.textR_custom_text + --text = text:gsub ("|", "||") + _G.DetailsOptionsWindow5CutomRightTextEntry.MyObject:SetText (text) --> window 6 _G.DetailsOptionsWindow6BackdropDropdown.MyObject:SetFixedParameter (editing_instance) @@ -5714,7 +5902,12 @@ function window:update_all (editing_instance) local autoswitch = instance.auto_switch_to if (autoswitch) then if (autoswitch [1] == "raid") then - _G.DetailsOptionsWindow18AutoSwitchDropdown.MyObject:Select (autoswitch[2]) + local plugin_object = _detalhes:GetPlugin (autoswitch[2]) + if (plugin_object) then + _G.DetailsOptionsWindow18AutoSwitchDropdown.MyObject:Select (plugin_object.__name) + else + _G.DetailsOptionsWindow18AutoSwitchDropdown.MyObject:Select (1, true) + end else _G.DetailsOptionsWindow18AutoSwitchDropdown.MyObject:Select (autoswitch[3]+1, true) end diff --git a/gumps/janela_principal.lua b/gumps/janela_principal.lua index 825d7064..bb44b36b 100644 --- a/gumps/janela_principal.lua +++ b/gumps/janela_principal.lua @@ -1151,6 +1151,7 @@ local function resize_scripts (resizer, instancia, scrollbar, side, baseframe) _G.GameCooltip:SetType ("tooltip") _G.GameCooltip:AddFromTable (resizeTooltip) _G.GameCooltip:SetOption ("NoLastSelectedBar", true) + _G.GameCooltip:SetWallpaper (1, [[Interface\SPELLBOOK\Spellbook-Page-1]], {.6, 0.1, 0, 0.64453125}, {1, 1, 1, 0.1}, true) _G.GameCooltip:SetOwner (resizer) _G.GameCooltip:ShowCooltip() end @@ -2467,6 +2468,7 @@ function gump:CriaNovaBarra (instancia, index) local rowframe = instancia.rowframe local esta_barra = CreateFrame ("button", "DetailsBarra_"..instancia.meu_id.."_"..index, rowframe) + esta_barra.row_id = index esta_barra.instance_id = instancia.meu_id local y = instancia.row_height*(index-1) @@ -2476,9 +2478,7 @@ function gump:CriaNovaBarra (instancia, index) esta_barra:SetPoint ("topleft", baseframe, "topleft", instancia.row_info.space.left, y) elseif (instancia.bars_grow_direction == 2) then - --y = y*-1 esta_barra:SetPoint ("bottomleft", baseframe, "bottomleft", instancia.row_info.space.left, y + 2) - end esta_barra:SetHeight (instancia.row_info.height) --> altura determinada pela instância @@ -2493,7 +2493,19 @@ function gump:CriaNovaBarra (instancia, index) esta_barra:RegisterForClicks ("LeftButtonDown", "RightButtonDown") esta_barra.statusbar = CreateFrame ("StatusBar", "DetailsBarra_Statusbar_"..instancia.meu_id.."_"..index, esta_barra) - --esta_barra.statusbar:SetAllPoints (esta_barra) + + esta_barra.border = CreateFrame ("Frame", "DetailsBarra_Border_" .. instancia.meu_id .. "_" .. index, esta_barra.statusbar) + esta_barra.border:SetFrameLevel (esta_barra.statusbar:GetFrameLevel()+1) + esta_barra.border:SetAllPoints (esta_barra) + + local backdrop = instancia.row_info.backdrop.enabled + if (backdrop) then + esta_barra.border:SetBackdrop ({edgeFile = SharedMedia:Fetch ("border", instancia.row_info.backdrop.texture), edgeSize = instancia.row_info.backdrop.size}) + esta_barra.border:SetBackdropBorderColor (_unpack (instancia.row_info.backdrop.color)) + end + + esta_barra.border:SetBackdrop ({edgeFile = [[Interface\AddOns\Details\images\border_2]], edgeSize = 12}) + esta_barra.border:SetBackdropBorderColor (0, 0, 0, 1) esta_barra.textura = esta_barra.statusbar:CreateTexture (nil, "artwork") esta_barra.textura:SetHorizTile (false) @@ -2627,6 +2639,31 @@ function _detalhes:SetBarTextSettings (size, font, fixedcolor, leftcolorbyclass, self:InstanceRefreshRows() end +function _detalhes:SetBarBackdropSettings (enabled, size, color, texture) + + if (type (enabled) ~= "boolean") then + enabled = self.row_info.backdrop.enabled + end + if (not size) then + size = self.row_info.backdrop.size + end + if (not color) then + color = self.row_info.backdrop.color + end + if (not texture) then + texture = self.row_info.backdrop.texture + end + + self.row_info.backdrop.enabled = enabled + self.row_info.backdrop.size = size + self.row_info.backdrop.color = color + self.row_info.backdrop.texture = texture + + self:InstanceReset() + self:InstanceRefreshRows() + self:ReajustaGump() +end + function _detalhes:SetBarSettings (height, texture, colorclass, fixedcolor, backgroundtexture, backgroundcolorclass, backgroundfixedcolor, alpha, iconfile, barstart, spacement) --> bar start @@ -2752,6 +2789,14 @@ function _detalhes:InstanceRefreshRows (instancia) local custom_right_text_enabled = self.row_info.textR_enable_custom_text local custom_right_text = self.row_info.textR_custom_text + --backdrop + local backdrop = self.row_info.backdrop.enabled + local backdrop_color + if (backdrop) then + backdrop = {edgeFile = SharedMedia:Fetch ("border", self.row_info.backdrop.texture), edgeSize = self.row_info.backdrop.size} + backdrop_color = self.row_info.backdrop.color + end + -- do it for _, row in _ipairs (self.barras) do @@ -2829,6 +2874,14 @@ function _detalhes:InstanceRefreshRows (instancia) _detalhes:SetFontFace (row.texto_esquerdo, self.row_info.font_face_file or "GameFontHighlight") _detalhes:SetFontFace (row.texto_direita, self.row_info.font_face_file or "GameFontHighlight") + --backdrop + if (backdrop) then + row.border:SetBackdrop (backdrop) + row.border:SetBackdropBorderColor (_unpack (backdrop_color)) + else + row.border:SetBackdrop (nil) + end + end self:SetBarGrowDirection() @@ -3626,7 +3679,7 @@ local parameters_table = {} local on_leave_menu = function (self, elapsed) parameters_table[2] = parameters_table[2] + elapsed if (parameters_table[2] > 0.3) then - if (not _G.GameCooltip.mouseOver and not _G.GameCooltip.buttonOver) then + if (not _G.GameCooltip.mouseOver and not _G.GameCooltip.buttonOver and (not _G.GameCooltip:GetOwner() or _G.GameCooltip:GetOwner() == self)) then _G.GameCooltip:ShowMe (false) end self:SetScript ("OnUpdate", nil) @@ -4072,12 +4125,12 @@ function _detalhes:ChangeSkin (skin_name) end elseif (self.modo == 4) then - if (_detalhes.RaidTables.Plugins [1] and _detalhes.RaidTables.Mode) then - local plugin_index = _detalhes.RaidTables.Mode - if (plugin_index and _detalhes.RaidTables.Menu [plugin_index]) then - self:ChangeIcon (_detalhes.RaidTables.Menu [plugin_index] [2]) - end - end + --if (_detalhes.RaidTables.Plugins [1] and _detalhes.RaidTables.Mode) then + -- local plugin_index = _detalhes.RaidTables.Mode + -- if (plugin_index and _detalhes.RaidTables.Menu [plugin_index]) then + --self:ChangeIcon (_detalhes.RaidTables.Menu [plugin_index] [2]) + -- end + --end end else local icon_anchor = this_skin.icon_anchor_main --> ancora do icone do canto direito superior @@ -4102,6 +4155,7 @@ function _detalhes:ChangeSkin (skin_name) ----------> call widgets handlers self:SetBarSettings (self.row_info.height) + self:SetBarBackdropSettings() --> update toolbar self:ToolbarSide() @@ -4336,11 +4390,13 @@ function _detalhes:AttributeMenu (enabled, pos_x, pos_y, font, size, color, side function self.menu_attribute_string:OnEvent (instance, attribute, subAttribute) if (instance == label.owner_instance) then - label.text = _detalhes:GetSubAttributeName (attribute, subAttribute) + local sName = instance:GetInstanceAttributeText() + label.text = sName end end _detalhes:RegisterEvent (self.menu_attribute_string, "DETAILS_INSTANCE_CHANGEATTRIBUTE", self.menu_attribute_string.OnEvent) + _detalhes:RegisterEvent (self.menu_attribute_string, "DETAILS_INSTANCE_CHANGEMODE", self.menu_attribute_string.OnEvent) end @@ -5057,10 +5113,44 @@ end --> reset button functions local reset_button_onenter = function (self) + OnEnterMainWindow (self.instance, self) + GameCooltip.buttonOver = true + self.instance.baseframe.cabecalho.button_mouse_over = true + + GameCooltip:Reset() + GameCooltip:SetOption ("ButtonsYMod", -2) + GameCooltip:SetOption ("YSpacingMod", 0) + GameCooltip:SetOption ("TextHeightMod", 0) + GameCooltip:SetOption ("IgnoreButtonAutoHeight", false) + + GameCooltip:AddLine (Loc ["STRING_ERASE_DATA"], nil, 1, "white", nil, 10, SharedMedia:Fetch ("font", "Friz Quadrata TT")) + --GameCooltip:AddIcon ([[Interface\Buttons\UI-MinusButton-Up]], 1, 1) + GameCooltip:AddIcon ([[Interface\PetBattles\DeadPetIcon]], 1, 1) + GameCooltip:AddMenu (1, _detalhes.tabela_historico.resetar) + + GameCooltip:SetWallpaper (1, [[Interface\SPELLBOOK\Spellbook-Page-1]], {.6, 0.1, 0, 0.64453125}, {1, 1, 1, 0.1}, true) + + show_anti_overlap (self.instance, self, "top") + + GameCooltip:ShowCooltip (self, "menu") end + local reset_button_onleave = function (self) OnLeaveMainWindow (self.instance, self) + + hide_anti_overlap (self.instance.baseframe.anti_menu_overlap) + + GameCooltip.buttonOver = false + self.instance.baseframe.cabecalho.button_mouse_over = false + + if (GameCooltip.active) then + parameters_table [2] = 0 + self:SetScript ("OnUpdate", on_leave_menu) + else + self:SetScript ("OnUpdate", nil) + end + end ------------------------------------------------------------------------------------------------------------------------------------------------------------------ @@ -5235,12 +5325,6 @@ function gump:CriaCabecalho (baseframe, instancia) {icon = [[Interface\AddOns\Details\images\modo_icones]], l = 32/256*2, r = 32/256*3, t = 0, b = 1, width = 20, height = 20}, {text = Loc ["STRING_HELP_MODEALL"], type = 2}, {icon = [[Interface\TUTORIALFRAME\TutorialFrame-QuestionMark]], type = 2, width = 16, height = 16, l = 8/64, r = 1 - (8/64), t = 8/64, b = 1 - (8/64)}, - - {text = Loc ["STRING_MODE_SELF"]}, -- .. " (|cffa0a0a0" .. Loc ["STRING_MODE_PLUGINS"] .. "|r)" - {func = instancia.AlteraModo, param1 = 1}, - {icon = [[Interface\AddOns\Details\images\modo_icones]], l = 0, r = 32/256, t = 0, b = 1, width = 20, height = 20}, - {text = Loc ["STRING_HELP_MODESELF"], type = 2}, - {icon = [[Interface\TUTORIALFRAME\TutorialFrame-QuestionMark]], type = 2, width = 16, height = 16, l = 8/64, r = 1 - (8/64), t = 8/64, b = 1 - (8/64)}, {text = Loc ["STRING_MODE_RAID"]}, -- .. " (|cffa0a0a0" .. Loc ["STRING_MODE_PLUGINS"] .. "|r)" {func = instancia.AlteraModo, param1 = 4}, @@ -5248,6 +5332,12 @@ function gump:CriaCabecalho (baseframe, instancia) {text = Loc ["STRING_HELP_MODERAID"], type = 2}, {icon = [[Interface\TUTORIALFRAME\TutorialFrame-QuestionMark]], type = 2, width = 16, height = 16, l = 8/64, r = 1 - (8/64), t = 8/64, b = 1 - (8/64)}, + {text = Loc ["STRING_MODE_SELF"]}, -- .. " (|cffa0a0a0" .. Loc ["STRING_MODE_PLUGINS"] .. "|r)" + {func = instancia.AlteraModo, param1 = 1}, + {icon = [[Interface\AddOns\Details\images\modo_icones]], l = 0, r = 32/256, t = 0, b = 1, width = 20, height = 20}, + {text = Loc ["STRING_HELP_MODESELF"], type = 2}, + {icon = [[Interface\TUTORIALFRAME\TutorialFrame-QuestionMark]], type = 2, width = 16, height = 16, l = 8/64, r = 1 - (8/64), t = 8/64, b = 1 - (8/64)}, + {text = Loc ["STRING_OPTIONS_WINDOW"]}, {func = _detalhes.OpenOptionsWindow}, {icon = [[Interface\AddOns\Details\images\modo_icones]], l = 32/256*4, r = 32/256*5, t = 0, b = 1, width = 20, height = 20}, @@ -5273,13 +5363,13 @@ function gump:CriaCabecalho (baseframe, instancia) local checked if (instancia.modo == 1) then - checked = 3 + checked = 4 elseif (instancia.modo == 2) then checked = 1 elseif (instancia.modo == 3) then checked = 2 elseif (instancia.modo == 4) then - checked = 4 + checked = 3 end parameters_table [1] = instancia @@ -5419,8 +5509,18 @@ function gump:CriaCabecalho (baseframe, instancia) local BuildAttributeMenu = function() if (_detalhes.solo and _detalhes.solo == instancia.meu_id) then return _detalhes:MontaSoloOption (instancia) - elseif (_detalhes.raid and _detalhes.raid == instancia.meu_id) then - return _detalhes:MontaRaidOption (instancia) + elseif (instancia:IsRaidMode()) then + local have_plugins = _detalhes:MontaRaidOption (instancia) + if (not have_plugins) then + GameCooltip:SetType ("tooltip") + GameCooltip:SetOption ("ButtonsYMod", 0) + GameCooltip:SetOption ("YSpacingMod", 0) + GameCooltip:SetOption ("TextHeightMod", 0) + GameCooltip:SetOption ("IgnoreButtonAutoHeight", false) + GameCooltip:AddLine ("All raid plugins already\nin use or disabled.", nil, 1, "white", nil, 10, SharedMedia:Fetch ("font", "Friz Quadrata TT")) + GameCooltip:AddIcon ([[Interface\GROUPFRAME\UI-GROUP-ASSISTANTICON]], 1, 1) + GameCooltip:SetWallpaper (1, [[Interface\SPELLBOOK\Spellbook-Page-1]], {.6, 0.1, 0, 0.64453125}, {1, 1, 1, 0.1}, true) + end else return _detalhes:MontaAtributosOption (instancia) end @@ -5475,19 +5575,46 @@ function gump:CriaCabecalho (baseframe, instancia) self:GetNormalTexture():SetDesaturated (false) end + GameCooltip.buttonOver = true + baseframe.cabecalho.button_mouse_over = true + GameCooltip:Reset() - GameCooltip:AddLine (Loc ["STRING_REPORT_BUTTON_TOOLTIP"]) - GameCooltip:SetOwner (baseframe.cabecalho.report.widget) + GameCooltip:SetOption ("ButtonsYMod", -3) + GameCooltip:SetOption ("YSpacingMod", 0) + GameCooltip:SetOption ("TextHeightMod", 0) + GameCooltip:SetOption ("IgnoreButtonAutoHeight", false) + + GameCooltip:AddLine ("Report Results", nil, 1, "white", nil, 10, SharedMedia:Fetch ("font", "Friz Quadrata TT")) + GameCooltip:AddIcon ([[Interface\Addons\Details\Images\report_button]], 1, 1, 12, 19) + GameCooltip:AddMenu (1, _detalhes.Reportar, instancia) + GameCooltip:SetWallpaper (1, [[Interface\SPELLBOOK\Spellbook-Page-1]], {.6, 0.1, 0, 0.64453125}, {1, 1, 1, 0.1}, true) - GameCooltip:Show() + + show_anti_overlap (instancia, self, "top") + + GameCooltip:ShowCooltip (self, "menu") end) baseframe.cabecalho.report:SetScript ("OnLeave", function (self) + OnLeaveMainWindow (instancia, self, 3) + + hide_anti_overlap (instancia.baseframe.anti_menu_overlap) + + GameCooltip.buttonOver = false + baseframe.cabecalho.button_mouse_over = false + if (instancia.desaturated_menu) then self:GetNormalTexture():SetDesaturated (true) end - GameCooltip:Hide() + + if (GameCooltip.active) then + parameters_table [2] = 0 + self:SetScript ("OnUpdate", on_leave_menu) + else + self:SetScript ("OnUpdate", nil) + end + end) --> NOVA INSTANCIA ---------------------------------------------------------------------------------------------------------------------------------------------------- @@ -5517,7 +5644,7 @@ function gump:CriaCabecalho (baseframe, instancia) --> Build Menu Function local BuildClosedInstanceMenu = function() - local ClosedInstances = {} + local ClosedInstances = 0 for index = 1, math.min (#_detalhes.tabela_instancias, _detalhes.instances_amount), 1 do @@ -5528,6 +5655,7 @@ function gump:CriaCabecalho (baseframe, instancia) --> pegar o que ela ta mostrando local atributo = _this_instance.atributo local sub_atributo = _this_instance.sub_atributo + ClosedInstances = ClosedInstances + 1 if (atributo == 5) then --> custom @@ -5554,11 +5682,15 @@ function gump:CriaCabecalho (baseframe, instancia) elseif (modo == 4) then --raid - atributo = _detalhes.RaidTables.Mode or 1 - local RaidInfo = _detalhes.RaidTables.Menu [atributo] - if (RaidInfo) then - CoolTip:AddMenu (1, OnClickNovoMenu, index, nil, nil, "#".. index .. " " .. RaidInfo [1], _, true) - CoolTip:AddIcon (RaidInfo [2], 1, 1, 20, 20, 0, 1, 0, 1) + local plugin_name = _this_instance.current_raid_plugin or _this_instance.last_raid_plugin + if (plugin_name) then + local plugin_object = _detalhes:GetPlugin (plugin_name) + if (plugin_object) then + CoolTip:AddMenu (1, OnClickNovoMenu, index, nil, nil, "#".. index .. " " .. plugin_object.__name, _, true) + CoolTip:AddIcon (plugin_object.__icon, 1, 1, 20, 20, 0, 1, 0, 1) + else + CoolTip:AddMenu (1, OnClickNovoMenu, index, nil, nil, "#".. index .. " Unknown Plugin", _, true) + end else CoolTip:AddMenu (1, OnClickNovoMenu, index, nil, nil, "#".. index .. " Unknown Plugin", _, true) end @@ -5575,6 +5707,11 @@ function gump:CriaCabecalho (baseframe, instancia) end end + if (ClosedInstances == 0) then + CoolTip:AddMenu (1, _detalhes.CriarInstancia, true, nil, nil, Loc ["STRING_NOCLOSED_INSTANCES"], _, true) + CoolTip:AddIcon ([[Interface\Buttons\UI-AttributeButton-Encourage-Up]], 1, 1, 16, 16) + end + GameCooltip:SetWallpaper (1, [[Interface\SPELLBOOK\Spellbook-Page-1]], {.6, 0.1, 0, 0.64453125}, {1, 1, 1, 0.1}, true) return ClosedInstances @@ -5593,12 +5730,12 @@ function gump:CriaCabecalho (baseframe, instancia) --> a hook for OnLeaveScript OnLeaveFunc = function() OnLeaveMainWindow (instancia, baseframe.cabecalho.novo, 3) end, --> default message if there is no option avaliable - Default = Loc ["STRING_NOCLOSED_INSTANCES"], + Default = Loc ["STRING_NOCLOSED_INSTANCES"], --> instancia is the first parameter sent after click, before parameters FixedValue = instancia, Options = function() if (instancia.toolbar_side == 1) then --top - return {TextSize = 10, NoLastSelectedBar = true} + return {TextSize = 10, NoLastSelectedBar = true, ButtonsYMod = -2} elseif (instancia.toolbar_side == 2) then --bottom return {HeightAnchorMod = -7, TextSize = 10, NoLastSelectedBar = true} end diff --git a/gumps/janela_report.lua b/gumps/janela_report.lua index 4f7cdbb1..f4689f33 100644 --- a/gumps/janela_report.lua +++ b/gumps/janela_report.lua @@ -137,12 +137,16 @@ local _UISpecialFrames = UISpecialFrames --> wow api locals --> internal details report functions ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - function _detalhes:Reportar (param2, options) + function _detalhes:Reportar (param2, options, arg3) if (not _detalhes.janela_report) then _detalhes.janela_report = gump:CriaJanelaReport() end + if (options.meu_id) then + self = options + end + --> trabalha com as opções: if (options and options._no_current) then _G ["Details_Report_CB_1"]:Disable() @@ -163,7 +167,7 @@ local _UISpecialFrames = UISpecialFrames --> wow api locals _detalhes.janela_report.slider:Enable() _detalhes.janela_report.slider.lockTexture:Hide() _detalhes.janela_report.slider.amt:Show() - + if (options) then _detalhes.janela_report.enviar:SetScript ("OnClick", function() self:monta_relatorio (param2, options._custom) end) else diff --git a/images/border_1.tga b/images/border_1.tga new file mode 100644 index 00000000..0f84fce6 Binary files /dev/null and b/images/border_1.tga differ diff --git a/images/border_2.tga b/images/border_2.tga new file mode 100644 index 00000000..22b2c534 Binary files /dev/null and b/images/border_2.tga differ diff --git a/images/options_window.tga b/images/options_window.tga index a427cf90..d1d57d33 100644 Binary files a/images/options_window.tga and b/images/options_window.tga differ diff --git a/plugins/Details_EncounterDetails/frames.lua b/plugins/Details_EncounterDetails/frames.lua index 5ab5dd8b..b83a3761 100644 --- a/plugins/Details_EncounterDetails/frames.lua +++ b/plugins/Details_EncounterDetails/frames.lua @@ -375,7 +375,6 @@ Message: ..\AddOns\Details_EncounterDetails\frames.lua line 156: GameCooltip:SetOption ("TextSize", 9.5) GameCooltip:SetOption ("IconSize", 12) GameCooltip:SetOption ("HeightAnchorMod", -15) - GameCooltip:SetOption ("TextHeightMod", -2) GameCooltip:ShowCooltip (frame, "tooltip") end diff --git a/plugins/Details_TimeAttack/Details_TimeAttack.lua b/plugins/Details_TimeAttack/Details_TimeAttack.lua index 932339b4..a6b7000e 100644 --- a/plugins/Details_TimeAttack/Details_TimeAttack.lua +++ b/plugins/Details_TimeAttack/Details_TimeAttack.lua @@ -347,7 +347,6 @@ local function CreatePluginFrames (data) GameCooltip:AddLine (string.format ("%.1f", TimeObject.FinishIlevel)) GameCooltip:AddIcon ("Interface\\TARGETINGFRAME\\PetBadge-Humanoid") - GameCooltip:SetOption ("TextHeightMod", -4) GameCooltip:ShowCooltip (self.background, "tooltip") else --> history @@ -368,7 +367,6 @@ local function CreatePluginFrames (data) GameCooltip:AddLine (string.format ("%.1f", TimeObject.ItemLevel)) GameCooltip:AddIcon ("Interface\\TARGETINGFRAME\\PetBadge-Humanoid") - GameCooltip:SetOption ("TextHeightMod", -4) GameCooltip:ShowCooltip (self.background, "tooltip") end end diff --git a/plugins/Details_TinyThreat/Details_TinyThreat.lua b/plugins/Details_TinyThreat/Details_TinyThreat.lua index 77274936..dacc5995 100644 --- a/plugins/Details_TinyThreat/Details_TinyThreat.lua +++ b/plugins/Details_TinyThreat/Details_TinyThreat.lua @@ -56,7 +56,7 @@ local function CreatePluginFrames (data) ThreatMeter:Cancel() elseif (event == "SHOW") then - instance = _detalhes.RaidTables.instancia + instance = ThreatMeter:GetInstance (ThreatMeter.instance_id) ThreatMeter.RowWidth = instance.baseframe:GetWidth()-6 @@ -507,7 +507,7 @@ function ThreatMeter:OnEvent (_, event, ...) local MINIMAL_DETAILS_VERSION_REQUIRED = 1 --> Install - local install, saveddata = _G._detalhes:InstallPlugin ("TANK", Loc ["STRING_PLUGIN_NAME"], "Interface\\Icons\\Ability_Paladin_ShieldofVengeance", ThreatMeter, "DETAILS_PLUGIN_TINY_THREAT", MINIMAL_DETAILS_VERSION_REQUIRED, "Details! Team", "v1.04") + local install, saveddata = _G._detalhes:InstallPlugin ("RAID", Loc ["STRING_PLUGIN_NAME"], "Interface\\Icons\\Ability_Paladin_ShieldofVengeance", ThreatMeter, "DETAILS_PLUGIN_TINY_THREAT", MINIMAL_DETAILS_VERSION_REQUIRED, "Details! Team", "v1.05") if (type (install) == "table" and install.error) then print (install.error) end diff --git a/plugins/Details_Vanguard/Details_Vanguard.lua b/plugins/Details_Vanguard/Details_Vanguard.lua index d04a707b..93e84e6b 100644 --- a/plugins/Details_Vanguard/Details_Vanguard.lua +++ b/plugins/Details_Vanguard/Details_Vanguard.lua @@ -66,7 +66,8 @@ local function CreatePluginFrames (data) elseif (event == "SHOW") then --> plugin shown, enabled - instancia = _detalhes.RaidTables.instancia + instancia = Vanguard:GetInstance (Vanguard.instance_id) + for index, tankframe in _ipairs (Vanguard.TankFrames) do DetailsFrameWork:RegisterForDetailsMove (tankframe.Frame.frame, instancia) end @@ -85,7 +86,7 @@ local function CreatePluginFrames (data) Vanguard:IdentifyTanks() if (Vanguard:IsInCombat()) then - instancia = _detalhes.RaidTables.instancia + instancia = Vanguard:GetInstance (Vanguard.instance_id) _combat_object = _detalhes.tabela_vigente _track_player_object = nil _track_player_name = nil @@ -101,7 +102,8 @@ local function CreatePluginFrames (data) elseif (event == "COMBAT_PLAYER_ENTER") then --> a new combat has been started - instancia = _detalhes.RaidTables.instancia + --instancia = _detalhes.RaidTables.instancia + instancia = Vanguard:GetInstance (Vanguard.instance_id) _combat_object = select (1, ...) _track_player_object = nil _track_player_name = nil @@ -127,7 +129,7 @@ local function CreatePluginFrames (data) _combat_object = select (1, ...) Vanguard.Running = false - VanguardFrame:SetScript ("OnUpdate", onupdate) + VanguardFrame:SetScript ("OnUpdate", nil) Vanguard:ResetBars() Vanguard:ResetDamage() @@ -1190,6 +1192,11 @@ local function CreatePluginFrames (data) end end + if (not _track_player_object) then + _detalhes:ScheduleTimer ("VanguardWait", 1) + return + end + --print ("Vanguard: playername: ".. _track_player_name) hits_last = 0 diff --git a/startup.lua b/startup.lua index 8bf40e46..c0656a02 100644 --- a/startup.lua +++ b/startup.lua @@ -145,13 +145,15 @@ function _G._detalhes:Start() self:AtualizaGumpPrincipal (-1, true) local lower_instance = _detalhes:GetLowerInstanceNumber() - + for index = 1, #self.tabela_instancias do local instance = self.tabela_instancias [index] if (instance:IsAtiva()) then --> refresh wallpaper if (instance.wallpaper.enabled) then instance:InstanceWallpaper (true) + else + instance:InstanceWallpaper (false) end --> refresh desaturated icons if is lower instance @@ -164,8 +166,21 @@ function _G._detalhes:Start() _detalhes.ToolBar:ReorganizeIcons() --> refresh all skin self.RefreshAfterStartup = nil + + function _detalhes:CheckWallpaperAfterStartup() + for _, instance in ipairs (self.tabela_instancias) do + if (not instance.wallpaper.enabled) then + if (instance:IsAtiva()) then + instance:InstanceWallpaper (false) + end + end + end + self.CheckWallpaperAfterStartup = nil + end + _detalhes:ScheduleTimer ("CheckWallpaperAfterStartup", 5) + end - self:ScheduleTimer ("RefreshAfterStartup", 4) + self:ScheduleTimer ("RefreshAfterStartup", 5) @@ -211,8 +226,6 @@ function _G._detalhes:Start() -- self.listener:RegisterEvent ("UNIT_SPELLCAST_INTERRUPTED") ---------------------------------------------------------------------------------------------------------------------------------------- - local SharedMedia = LibStub:GetLibrary ("LibSharedMedia-3.0") - function _detalhes:CooltipPreset (preset) local GameCooltip = GameCooltip @@ -227,6 +240,17 @@ function _G._detalhes:Start() GameCooltip:SetOption ("YSpacingMod", -4) GameCooltip:SetOption ("IgnoreButtonAutoHeight", true) GameCooltip:SetColor (1, 0.5, 0.5, 0.5, 0.5) + + elseif (preset == 2) then + GameCooltip:SetOption ("TextFont", "Friz Quadrata TT") + GameCooltip:SetOption ("TextColor", "orange") + GameCooltip:SetOption ("TextSize", 12) + GameCooltip:SetOption ("FixedWidth", 220) + GameCooltip:SetOption ("ButtonsYMod", -4) + GameCooltip:SetOption ("YSpacingMod", -4) + GameCooltip:SetOption ("IgnoreButtonAutoHeight", true) + GameCooltip:SetColor (1, 0.5, 0.5, 0.5, 0.5) + end end @@ -806,6 +830,206 @@ function _G._detalhes:Start() b:SetAlpha (1) --]] + local panel = self.gump:NewPanel (UIParent, nil, "DetailsWindowOptionsBarTextEditor", nil, 650, 200) + panel:SetPoint ("center", UIParent, "center") + panel:Hide() + panel:SetFrameStrata ("FULLSCREEN") + panel:SetBackdrop ({ bgFile = [[Interface\AddOns\Details\images\background]], tile = true, tileSize = 64, edgeFile="Interface\\Tooltips\\UI-Tooltip-Border", edgeSize=16, insets = {left=3, right=3, top=3, bottom=3}}) + panel:DisableGradient() + panel:SetBackdropColor (0, 0, 0, 1) + + function panel.widget:Open (text, callback, host) + if (host) then + panel:SetPoint ("center", host, "center") + end + + text = text:gsub ("||", "|") + panel.default_text = text + panel.widget.editbox:SetText (text) + panel.callback = callback + panel:Show() + end + + local textentry = self.gump:NewSpecialLuaEditorEntry (panel.widget, 450, 180, "editbox", "$parentEntry", true) + textentry:SetPoint ("topleft", panel.widget, "topleft", 10, -10) + + local arg1_button = self.gump:NewButton (panel, nil, "$parentButton1", nil, 80, 20, function() textentry.editbox:Insert ("{data1}") end, nil, nil, nil, "{data1}") + local arg2_button = self.gump:NewButton (panel, nil, "$parentButton2", nil, 80, 20, function() textentry.editbox:Insert ("{data2}") end, nil, nil, nil, "{data2}") + local arg3_button = self.gump:NewButton (panel, nil, "$parentButton3", nil, 80, 20, function() textentry.editbox:Insert ("{data3}") end, nil, nil, nil, "{data3}") + arg1_button:SetPoint ("topright", panel, "topright", -10, -14) + arg2_button:SetPoint ("topright", panel, "topright", -10, -36) + arg3_button:SetPoint ("topright", panel, "topright", -10, -58) + arg1_button:InstallCustomTexture() + arg2_button:InstallCustomTexture() + arg3_button:InstallCustomTexture() + + -- code author Saiket from http://www.wowinterface.com/forums/showpost.php?p=245759&postcount=6 + --- @return StartPos, EndPos of highlight in this editbox. + local function GetTextHighlight ( self ) + local Text, Cursor = self:GetText(), self:GetCursorPosition(); + self:Insert( "" ); -- Delete selected text + local TextNew, CursorNew = self:GetText(), self:GetCursorPosition(); + -- Restore previous text + self:SetText( Text ); + self:SetCursorPosition( Cursor ); + local Start, End = CursorNew, #Text - ( #TextNew - CursorNew ); + self:HighlightText( Start, End ); + return Start, End; + end + + local StripColors; + do + local CursorPosition, CursorDelta; + --- Callback for gsub to remove unescaped codes. + local function StripCodeGsub ( Escapes, Code, End ) + if ( #Escapes % 2 == 0 ) then -- Doesn't escape Code + if ( CursorPosition and CursorPosition >= End - 1 ) then + CursorDelta = CursorDelta - #Code; + end + return Escapes; + end + end + --- Removes a single escape sequence. + local function StripCode ( Pattern, Text, OldCursor ) + CursorPosition, CursorDelta = OldCursor, 0; + return Text:gsub( Pattern, StripCodeGsub ), OldCursor and CursorPosition + CursorDelta; + end + --- Strips Text of all color escape sequences. + -- @param Cursor Optional cursor position to keep track of. + -- @return Stripped text, and the updated cursor position if Cursor was given. + function StripColors ( Text, Cursor ) + Text, Cursor = StripCode( "(|*)(|c%x%x%x%x%x%x%x%x)()", Text, Cursor ); + return StripCode( "(|*)(|r)()", Text, Cursor ); + end + end + + local COLOR_END = "|r"; + --- Wraps this editbox's selected text with the given color. + local function ColorSelection ( self, ColorCode ) + local Start, End = GetTextHighlight( self ); + local Text, Cursor = self:GetText(), self:GetCursorPosition(); + if ( Start == End ) then -- Nothing selected + --Start, End = Cursor, Cursor; -- Wrap around cursor + return; -- Wrapping the cursor in a color code and hitting backspace crashes the client! + end + -- Find active color code at the end of the selection + local ActiveColor; + if ( End < #Text ) then -- There is text to color after the selection + local ActiveEnd; + local CodeEnd, _, Escapes, Color = 0; + while ( true ) do + _, CodeEnd, Escapes, Color = Text:find( "(|*)(|c%x%x%x%x%x%x%x%x)", CodeEnd + 1 ); + if ( not CodeEnd or CodeEnd > End ) then + break; + end + if ( #Escapes % 2 == 0 ) then -- Doesn't escape Code + ActiveColor, ActiveEnd = Color, CodeEnd; + end + end + + if ( ActiveColor ) then + -- Check if color gets terminated before selection ends + CodeEnd = 0; + while ( true ) do + _, CodeEnd, Escapes = Text:find( "(|*)|r", CodeEnd + 1 ); + if ( not CodeEnd or CodeEnd > End ) then + break; + end + if ( CodeEnd > ActiveEnd and #Escapes % 2 == 0 ) then -- Terminates ActiveColor + ActiveColor = nil; + break; + end + end + end + end + + local Selection = Text:sub( Start + 1, End ); + -- Remove color codes from the selection + local Replacement, CursorReplacement = StripColors( Selection, Cursor - Start ); + + self:SetText( ( "" ):join( + Text:sub( 1, Start ), + ColorCode, Replacement, COLOR_END, + ActiveColor or "", Text:sub( End + 1 ) + ) ); + + -- Restore cursor and highlight, adjusting for wrapper text + Cursor = Start + CursorReplacement; + if ( CursorReplacement > 0 ) then -- Cursor beyond start of color code + Cursor = Cursor + #ColorCode; + end + if ( CursorReplacement >= #Replacement ) then -- Cursor beyond end of color + Cursor = Cursor + #COLOR_END; + end + + self:SetCursorPosition( Cursor ); + -- Highlight selection and wrapper + self:HighlightText( Start, #ColorCode + ( #Replacement - #Selection ) + #COLOR_END + End ); + end + + local color_func = function (_, r, g, b, a) + local hex = _detalhes:hex (a*255).._detalhes:hex (r*255).._detalhes:hex (g*255).._detalhes:hex (b*255) + ColorSelection ( textentry.editbox, "|c" .. hex) + end + + local func_button = self.gump:NewButton (panel, nil, "$parentButton4", nil, 80, 20, function() textentry.editbox:Insert ("{func local player = ...; return 0;}") end, nil, nil, nil, Loc ["STRING_OPTIONS_TEXTEDITOR_FUNC"]) + local color_button = self.gump:NewColorPickButton (panel, "$parentButton5", nil, color_func) + color_button:SetSize (80, 20) + func_button:SetPoint ("topright", panel, "topright", -10, -80) + color_button:SetPoint ("topright", panel, "topright", -10, -102) + func_button:InstallCustomTexture() + + color_button.tooltip = Loc ["STRING_OPTIONS_TEXTEDITOR_COLOR_TOOLTIP"] + func_button.tooltip = Loc ["STRING_OPTIONS_TEXTEDITOR_FUNC_TOOLTIP"] + + --color_button:InstallCustomTexture() + + local comma_button = self.gump:NewButton (panel, nil, "$parentButtonComma", nil, 80, 20, function() textentry.editbox:Insert ("_detalhes:comma_value ( )") end, nil, nil, nil, Loc ["STRING_OPTIONS_TEXTEDITOR_COMMA"]) + local tok_button = self.gump:NewButton (panel, nil, "$parentButtonTok", nil, 80, 20, function() textentry.editbox:Insert ("_detalhes:ToK2 ( )") end, nil, nil, nil, Loc ["STRING_OPTIONS_TEXTEDITOR_TOK"]) + comma_button:InstallCustomTexture() + tok_button:InstallCustomTexture() + comma_button.tooltip = Loc ["STRING_OPTIONS_TEXTEDITOR_COMMA_TOOLTIP"] + tok_button.tooltip = Loc ["STRING_OPTIONS_TEXTEDITOR_TOK_TOOLTIP"] + + comma_button:SetPoint ("topright", panel, "topright", -100, -14) + tok_button:SetPoint ("topright", panel, "topright", -100, -36) + + local done = function() + local text = panel.widget.editbox:GetText() + text = text:gsub ("\n", "") + + local test = text + + local function errorhandler(err) + return geterrorhandler()(err) + end + + local code = [[local str = "STR"; str = str:ReplaceData (100, 50, 75, {nome = "you", total = 10, total_without_pet = 5, damage_taken = 7, last_dps = 1, friendlyfire_total = 6, totalover = 2, totalabsorb = 4, totalover_without_pet = 6, healing_taken = 1, heal_enemy_amt = 2});]] + code = code:gsub ("STR", test) + + local f = loadstring (code) + local err, two = xpcall (f, errorhandler) + + if (not err) then + return + end + + panel.callback (text) + panel:Hide() + end + + local ok_button = self.gump:NewButton (panel, nil, "$parentButtonOk", nil, 80, 20, done, nil, nil, nil, "DONE") + ok_button:InstallCustomTexture() + ok_button:SetPoint ("topright", panel, "topright", -10, -174) + + local reset_button = self.gump:NewButton (panel, nil, "$parentDefaultOk", nil, 80, 20, function() textentry.editbox:SetText (_detalhes.instance_defaults.row_info.textR_custom_text) end, nil, nil, nil, "Default") + reset_button:InstallCustomTexture() + reset_button:SetPoint ("topright", panel, "topright", -100, -152) + + local cancel_button = self.gump:NewButton (panel, nil, "$parentDefaultCancel", nil, 80, 20, function() textentry.editbox:SetText (panel.default_text); done(); end, nil, nil, nil, "Cancel") + cancel_button:InstallCustomTexture() + cancel_button:SetPoint ("topright", panel, "topright", -100, -174) + function _detalhes:OpenOptionsWindowAtStart() --_detalhes:OpenOptionsWindow (_detalhes.tabela_instancias[1]) --print (_G ["DetailsClearSegmentsButton1"]:GetSize())