diff --git a/Libs/DF/cooltip.lua b/Libs/DF/cooltip.lua index 2673476f..f6bec583 100644 --- a/Libs/DF/cooltip.lua +++ b/Libs/DF/cooltip.lua @@ -18,7 +18,7 @@ local PixelUtil = PixelUtil or DFPixelUtil local version = 3 local CONST_MENU_TYPE_MAINMENU = "main" -local CONST_MENU_TYPE_SUBMENU = "sec" +local CONST_MENU_TYPE_SUBMENU = "sub" local CONST_COOLTIP_TYPE_MENU = "menu" local CONST_COOLTIP_TYPE_TOOLTIP = "tooltip" @@ -52,6 +52,18 @@ function DF:CreateCoolTip() gameCooltip.debug = bDebugState end + function gameCooltip:ParseMenuType(menuType) + if ((type(menuType) == "number" and menuType == 1) or (type(menuType) == "string" and menuType == CONST_MENU_TYPE_MAINMENU)) then + return CONST_MENU_TYPE_MAINMENU + end + + if ((type(menuType) == "number" and menuType == 2) or (type(menuType) == "string" and menuType == CONST_MENU_TYPE_SUBMENU)) then + return CONST_MENU_TYPE_SUBMENU + end + + return CONST_MENU_TYPE_MAINMENU + end + --containers gameCooltip.LeftTextTable = {} gameCooltip.LeftTextTableSub = {} @@ -180,12 +192,14 @@ function DF:CreateCoolTip() self:SetBackdropColor(DF:ParseColors(defaultBackdropColor)) self:SetBackdropBorderColor(DF:ParseColors(defaultBackdropBorderColor)) + --this texture get the color from gameCooltip:SetColor() if (not self.frameBackgroundTexture) then self.frameBackgroundTexture = self:CreateTexture("$parent_FrameBackgroundTexture", "BACKGROUND", nil, 2) self.frameBackgroundTexture:SetColorTexture(0, 0, 0, 0) self.frameBackgroundTexture:SetAllPoints() end + --this get the texture from gameCooltip:SetWallpaper(index, texture, texcoord, color, desaturate) if (not self.frameWallpaper) then self.frameWallpaper = self:CreateTexture("$parent_FrameWallPaper", "BACKGROUND", nil, 4) self.frameWallpaper:SetPoint("TOPLEFT", self, "TOPLEFT", 0, 0) @@ -198,6 +212,12 @@ function DF:CreateCoolTip() self.selectedTop:SetHeight(3) end + if (not self.gradientTexture) then + self.gradientTexture = DetailsFramework:CreateTexture(self, {gradient = "vertical", fromColor = {0, 0, 0, .2}, toColor = {0, 0, 0, 0}}, 1, 1, "overlay", {0, 1, 0, 1}) + self.gradientTexture.sublevel = -7 + self.gradientTexture:SetAllPoints() + end + if (not self.selectedBottom) then self.selectedBottom = self:CreateTexture("$parent_SelectedBottom", "ARTWORK") self.selectedBottom:SetColorTexture(.5, .5, .5, .75) @@ -211,13 +231,6 @@ function DF:CreateCoolTip() self.selectedMiddle:SetPoint("BOTTOMRIGHT", self.selectedBottom, "TOPRIGHT") end - if (not self.upperImage2) then - self.upperImage2 = self:CreateTexture("$parent_UpperImage2", "ARTWORK") - self.upperImage2:SetPoint("CENTER", self, "CENTER", 0, -3) - self.upperImage2:SetPoint("BOTTOM", self, "TOP", 0, -3) - self.upperImage2:Hide() - end - if (not self.upperImage) then self.upperImage = self:CreateTexture("$parent_UpperImage", "OVERLAY") self.upperImage:SetPoint("CENTER", self, "CENTER", 0, -3) @@ -225,6 +238,13 @@ function DF:CreateCoolTip() self.upperImage:Hide() end + if (not self.upperImage2) then + self.upperImage2 = self:CreateTexture("$parent_UpperImage2", "ARTWORK") + self.upperImage2:SetPoint("CENTER", self, "CENTER", 0, -3) + self.upperImage2:SetPoint("BOTTOM", self, "TOP", 0, -3) + self.upperImage2:Hide() + end + if (not self.upperImageText) then self.upperImageText = self:CreateFontString("$parent_UpperImageText", "OVERLAY", "GameTooltipHeaderText") self.upperImageText:SetJustifyH("LEFT") @@ -2027,7 +2047,9 @@ function DF:CreateCoolTip() --set tooltip color function gameCooltip:SetColor(menuType, ...) local colorRed, colorGreen, colorBlue, colorAlpha = DF:ParseColors(...) - if ((type(menuType) == "string" and menuType == CONST_MENU_TYPE_MAINMENU) or (type(menuType) == "number" and menuType == 1)) then + menuType = gameCooltip:ParseMenuType(menuType) + + if (menuType == CONST_MENU_TYPE_MAINMENU) then frame1.frameBackgroundTexture:SetColorTexture(colorRed, colorGreen, colorBlue, colorAlpha) --hide textures from older versions if exists @@ -2037,7 +2059,7 @@ function DF:CreateCoolTip() frame1.frameBackgroundCenter:Hide() end - elseif ((type(menuType) == "string" and menuType == CONST_MENU_TYPE_SUBMENU) or (type(menuType) == "number" and menuType == 2)) then + elseif (menuType == CONST_MENU_TYPE_SUBMENU) then frame2.frameBackgroundTexture:SetColorTexture(colorRed, colorGreen, colorBlue, colorAlpha) --hide textures from older versions if exists @@ -2054,10 +2076,14 @@ function DF:CreateCoolTip() --set last selected option function gameCooltip:SetLastSelected(menuType, index, index2) if (gameCooltip.Type == 3) then - if ((type(menuType) == "string" and menuType == CONST_MENU_TYPE_MAINMENU) or (type(menuType) == "number" and menuType == 1)) then + menuType = gameCooltip:ParseMenuType(menuType) + + if (menuType == CONST_MENU_TYPE_MAINMENU) then gameCooltip.SelectedIndexMain = index - elseif ((type(menuType) == "string" and menuType == CONST_MENU_TYPE_SUBMENU) or (type(menuType) == "number" and menuType == 2)) then + + elseif (menuType == CONST_MENU_TYPE_SUBMENU) then gameCooltip.SelectedIndexSec[index] = index2 + else return gameCooltip:PrintDebug("SetLastSelected() unknown menuType.", menuType) end @@ -2179,7 +2205,9 @@ function DF:CreateCoolTip() --menu functions local defaultWhiteColor = {1, 1, 1} function gameCooltip:AddMenu(menuType, func, param1, param2, param3, leftText, leftIcon, indexUp) - if (leftText and indexUp and ((type(menuType) == "string" and menuType == CONST_MENU_TYPE_MAINMENU) or (type(menuType) == "number" and menuType == 1))) then + menuType = gameCooltip:ParseMenuType(menuType) + + if (leftText and indexUp and (menuType == CONST_MENU_TYPE_MAINMENU)) then gameCooltip.Indexes = gameCooltip.Indexes + 1 if (not gameCooltip.IndexesSub[gameCooltip.Indexes]) then gameCooltip.IndexesSub[gameCooltip.Indexes] = 0 @@ -2197,7 +2225,7 @@ function DF:CreateCoolTip() return gameCooltip:PrintDebug("AddMenu() no function passed.") end - if ((type(menuType) == "string" and menuType == CONST_MENU_TYPE_MAINMENU) or (type(menuType) == "number" and menuType == 1)) then + if (menuType == CONST_MENU_TYPE_MAINMENU) then local parameterTable if (gameCooltip.isSpecial) then parameterTable = {} @@ -2248,10 +2276,10 @@ function DF:CreateCoolTip() lineTable_Left[8] = false end - elseif ((type(menuType) == "string" and menuType == CONST_MENU_TYPE_SUBMENU) or (type(menuType) == "number" and menuType == 2)) then + elseif (menuType == CONST_MENU_TYPE_SUBMENU) then if (gameCooltip.SubIndexes == 0) then if (not indexUp or not leftText) then - return gameCooltip:PrintDebug("AddMenu() attempt to add a submenu with a parent.") --error[leftText can't be nil if indexUp are true] + return gameCooltip:PrintDebug("AddMenu() attempt to add a submenu with a parent.") end end @@ -2260,7 +2288,7 @@ function DF:CreateCoolTip() gameCooltip.IndexesSub[gameCooltip.Indexes] = gameCooltip.IndexesSub[gameCooltip.Indexes] + 1 elseif (indexUp and not leftText) then - return gameCooltip:PrintDebug("AddMenu() attempt to add a submenu with a parent.") --error[leftText can't be nil if indexUp are true] + return gameCooltip:PrintDebug("AddMenu() attempt to add a submenu with a parent.") end --menu container @@ -2356,18 +2384,21 @@ function DF:CreateCoolTip() return end + menuType = gameCooltip:ParseMenuType(menuType) + if (type(colorRed) == "table" or type(colorRed) == "string") then statusbarGlow, backgroundBar, colorRed, colorGreen, colorBlue, colorAlpha = colorGreen, colorBlue, DF:ParseColors(colorRed) + elseif (type(colorRed) == "boolean") then backgroundBar = colorGreen statusbarGlow = colorRed colorRed, colorGreen, colorBlue, colorAlpha = 1, 1, 1, 1 end - --add local frameTable local statusbarTable - if (not menuType or (type(menuType) == "string" and menuType == CONST_MENU_TYPE_MAINMENU) or (type(menuType) == "number" and menuType == 1)) then + + if (menuType == CONST_MENU_TYPE_MAINMENU) then frameTable = gameCooltip.StatusBarTable if (gameCooltip.isSpecial) then statusbarTable = {} @@ -2380,7 +2411,7 @@ function DF:CreateCoolTip() end end - elseif ((type(menuType) == "string" and menuType == "sub") or (type(menuType) == "number" and menuType == 2)) then + elseif (menuType == CONST_MENU_TYPE_SUBMENU) then frameTable = gameCooltip.StatusBarTableSub local subMenuContainerStatusBar = frameTable[gameCooltip.Indexes] if (not subMenuContainerStatusBar) then @@ -2414,17 +2445,20 @@ function DF:CreateCoolTip() frame1.frameWallpaper:Hide() frame2.frameWallpaper:Hide() - function gameCooltip:SetWallpaper(index, texture, texcoord, color, desaturate) + function gameCooltip:SetWallpaper(menuType, texture, texcoord, color, desaturate) if (gameCooltip.Indexes == 0) then return gameCooltip:PrintDebug("SetWallpaper() requires an already added line (Cooltip:AddLine()).") end + menuType = gameCooltip:ParseMenuType(menuType) + local frameTable local wallpaperTable - if ((type(index) == "number" and index == 1) or (type(index) == "string" and index == CONST_MENU_TYPE_MAINMENU)) then + + if (menuType == CONST_MENU_TYPE_MAINMENU) then wallpaperTable = gameCooltip.WallpaperTable - elseif ((type(index) == "number" and index == 2) or (type(index) == "string" and index == "sub")) then + elseif (menuType == CONST_MENU_TYPE_SUBMENU) then frameTable = gameCooltip.WallpaperTableSub local subMenuContainerWallpapers = frameTable[gameCooltip.Indexes] if (not subMenuContainerWallpapers) then @@ -2463,6 +2497,7 @@ function DF:CreateCoolTip() if (anchor and index == 1) then local myAnchor, hisAnchor, x, y = unpack(anchor) fontstring:SetPoint(myAnchor, frame1.upperImage, hisAnchor or myAnchor, x or 0, y or 0) + elseif (anchor and index == 2) then local myAnchor, hisAnchor, x, y = unpack(anchor) fontstring:SetPoint(myAnchor, frame1, hisAnchor or myAnchor, x or 0, y or 0) @@ -2481,11 +2516,15 @@ function DF:CreateCoolTip() fontstring:Show() end - function gameCooltip:SetBackdrop(index, backdrop, backdropcolor, bordercolor) + function gameCooltip:SetBackdrop(menuType, backdrop, backdropcolor, bordercolor) local frame - if (index == 1) then + + menuType = gameCooltip:ParseMenuType(menuType) + + if (menuType == CONST_MENU_TYPE_MAINMENU) then frame = frame1 - elseif (index == 2) then + + elseif (menuType == CONST_MENU_TYPE_SUBMENU) then frame = frame2 end @@ -2568,8 +2607,9 @@ function DF:CreateCoolTip() side = side or 1 local frameTable local iconTable + menuType = gameCooltip:ParseMenuType(menuType) - if (not menuType or (type(menuType) == "string" and menuType == CONST_MENU_TYPE_MAINMENU) or (type(menuType) == "number" and menuType == 1)) then + if (menuType == CONST_MENU_TYPE_MAINMENU) then if (not side or (type(side) == "string" and side == "left") or (type(side) == "number" and side == 1)) then frameTable = gameCooltip.LeftIconTable @@ -2588,7 +2628,7 @@ function DF:CreateCoolTip() end end - elseif ((type(menuType) == "string" and menuType == "sub") or (type(menuType) == "number" and menuType == 2)) then + elseif (menuType == CONST_MENU_TYPE_SUBMENU) then if ((type(side) == "string" and side == "left") or (type(side) == "number" and side == 1)) then frameTable = gameCooltip.LeftIconTableSub @@ -2703,7 +2743,9 @@ function DF:CreateCoolTip() local lineTable_Left local lineTable_Right - if (not menuType or (type(menuType) == "string" and menuType == CONST_MENU_TYPE_MAINMENU) or (type(menuType) == "number" and menuType == 1)) then + menuType = gameCooltip:ParseMenuType(menuType) + + if (menuType == CONST_MENU_TYPE_MAINMENU) then gameCooltip.Indexes = gameCooltip.Indexes + 1 if (not gameCooltip.IndexesSub[gameCooltip.Indexes]) then gameCooltip.IndexesSub[gameCooltip.Indexes] = 0 @@ -2732,7 +2774,7 @@ function DF:CreateCoolTip() end end - elseif ((type(menuType) == "string" and menuType == "sub") or (type(menuType) == "number" and menuType == 2)) then + elseif (menuType == CONST_MENU_TYPE_SUBMENU) then gameCooltip.SubIndexes = gameCooltip.SubIndexes + 1 gameCooltip.IndexesSub[gameCooltip.Indexes] = gameCooltip.IndexesSub[gameCooltip.Indexes] + 1 gameCooltip.HaveSubMenu = true @@ -2996,7 +3038,7 @@ function DF:CreateCoolTip() gameCooltip:ShowCooltip() if (fromClick) then - frame1:Flash (0.05, 0.05, 0.2, true, 0, 0) + frame1:Flash(0.05, 0.05, 0.2, true, 0, 0) end end diff --git a/Libs/DF/fw.lua b/Libs/DF/fw.lua index a8694dab..a341eed3 100644 --- a/Libs/DF/fw.lua +++ b/Libs/DF/fw.lua @@ -1,6 +1,6 @@ -local dversion = 370 +local dversion = 371 local major, minor = "DetailsFramework-1.0", dversion local DF, oldminor = LibStub:NewLibrary(major, minor) @@ -10,7 +10,7 @@ if (not DF) then end DetailsFrameworkCanLoad = true -local SharedMedia = LibStub:GetLibrary ("LibSharedMedia-3.0") +local SharedMedia = LibStub:GetLibrary("LibSharedMedia-3.0") local _ local type = type @@ -43,14 +43,18 @@ if (not PixelUtil) then local gameVersion = GetBuildInfo() if (gameVersion:match("%d") == "1" or gameVersion:match("%d") == "2" or gameVersion:match("%d") == "3") then PixelUtil = { - SetWidth = function (self, width) self:SetWidth (width) end, - SetHeight = function (self, height) self:SetHeight (height) end, - SetSize = function (self, width, height) self:SetSize (width, height) end, - SetPoint = function (self, ...) self:SetPoint (...) end, + SetWidth = function(self, width) self:SetWidth(width) end, + SetHeight = function(self, height) self:SetHeight(height) end, + SetSize = function(self, width, height) self:SetSize(width, height) end, + SetPoint = function(self, ...) self:SetPoint(...) end, } end end +function DF:GetDefaultBackdropColor() + return 0.1215, 0.1176, 0.1294, 0.8 +end + function DF.IsDragonflightAndBeyond() return select(4, GetBuildInfo()) >= 100000 end @@ -157,7 +161,7 @@ function DF:GetRoleByClassicTalentTree() --tab information local name, iconTexture, pointsSpent, fileName = GetTalentTabInfo(i) if (name) then - tinsert (pointsPerSpec, {name, pointsSpent, fileName}) + tinsert(pointsPerSpec, {name, pointsSpent, fileName}) end end end diff --git a/Libs/DF/panel.lua b/Libs/DF/panel.lua index 305b49c4..bfa6f9f7 100644 --- a/Libs/DF/panel.lua +++ b/Libs/DF/panel.lua @@ -4856,7 +4856,7 @@ end ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ -- ~standard backdrop -function DF:ApplyStandardBackdrop(frame, darkTheme, alphaScale) +function DF:ApplyStandardBackdrop(frame, solidColor, alphaScale) alphaScale = alphaScale or 1.0 if (not frame.SetBackdrop)then @@ -4864,28 +4864,27 @@ function DF:ApplyStandardBackdrop(frame, darkTheme, alphaScale) Mixin(frame, BackdropTemplateMixin) end - if (darkTheme) then - frame:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Cooldown\cooldown2]], tileSize = 32, tile = true}) - frame:SetBackdropBorderColor(0, 0, 0, 1) - frame:SetBackdropColor(.54, .54, .54, .54 * alphaScale) + local red, green, blue, alpha = DF:GetDefaultBackdropColor() + + if (solidColor) then + local colorDeviation = 0.05 + frame:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Buttons\WHITE8X8]], tileSize = 32, tile = true}) + frame:SetBackdropColor(red, green, blue, 0.872) + frame:SetBackdropBorderColor(0, 0, 0, 0.95) else frame:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}) - frame:SetBackdropBorderColor(0, 0, 0, 1) - frame:SetBackdropColor(0.1215, 0.1176, 0.1294, 0.2 * alphaScale) + frame:SetBackdropColor(red, green, blue, alpha * alphaScale) + frame:SetBackdropBorderColor(0, 0, 0, 0.95) end if (not frame.__background) then frame.__background = frame:CreateTexture(nil, "background") - frame.__background:SetColorTexture(0.1215, 0.1176, 0.1294, 0.99) + frame.__background:SetColorTexture(red, green, blue) frame.__background:SetAllPoints() end - --frame.innerBorderTexture = frame:CreateTexture(nil, "overlay") - --frame.innerBorderTexture:SetAllPoints() - --frame.innerBorderTexture:SetAtlas("Options_InnerFrame") - - frame.__background:SetAlpha(0.8 * alphaScale) + frame.__background:SetAlpha(alpha * alphaScale) end ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ diff --git a/Libs/DF/spells.lua b/Libs/DF/spells.lua index 09aa7a29..e368e1df 100644 --- a/Libs/DF/spells.lua +++ b/Libs/DF/spells.lua @@ -1274,7 +1274,7 @@ end ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ --consumables -if(DF.IsShadowlandsWow() or DF.IsDragonflight()) then --Temporary IsDragonFlight until I get the items together +if (DF.IsShadowlandsWow() or DF.IsDragonflight()) then --Temporary IsDragonFlight until I get the items together DF.WeaponEnchantIds = { [6188] = true, --shadowcore oil [6190] = true, --embalmer's oil @@ -1407,6 +1407,12 @@ elseif (DF.IsWotLKWow()) then DF.FeastIDs = {} DF.RuneIDs = {} +elseif (DF.IsClassicWow()) then + DF.PotionIDs = {} + DF.FeastIDs = {} + DF.RuneIDs = {} + DF.FoodIDs = {} + DF.FlaskIDs = {} end -- /dump UnitAura ("player", 1) diff --git a/frames/window_main.lua b/frames/window_main.lua index 26d17a7d..a0bc530d 100644 --- a/frames/window_main.lua +++ b/frames/window_main.lua @@ -30,10 +30,15 @@ local tokFunctions = Details.ToKFunctions --constants local baseframe_strata = "LOW" -local gump_fundo_backdrop = { +local defaultBackdropSt = { bgFile = [[Interface\AddOns\Details\images\background]], tile = true, tileSize = 16, insets = {left = 0, right = 0, top = 0, bottom = 0}} +local CONST_ROWFRAME_ALPHA = 0.975036 +local parseRowFrameAlpha = function(value) + return math.min(value, CONST_ROWFRAME_ALPHA) +end + function Details:ScheduleUpdate(instancia) instancia.barraS = {nil, nil} instancia.update = true @@ -322,20 +327,20 @@ local function OnLeaveMainWindow (instancia, self) end Details.OnLeaveMainWindow = OnLeaveMainWindow -local function OnEnterMainWindow (instancia, self) +local function OnEnterMainWindow(instancia, self) instancia.is_interacting = true instancia:SetMenuAlpha (nil, nil, nil, nil, true) instancia:SetAutoHideMenu (nil, nil, true) instancia:RefreshAttributeTextSize() - + if (not instancia.last_interaction or instancia.last_interaction < Details._tempo) then instancia.last_interaction = Details._tempo or time() end if (instancia.baseframe:GetFrameLevel() > instancia.rowframe:GetFrameLevel()) then - instancia.rowframe:SetFrameLevel (instancia.baseframe:GetFrameLevel()) + instancia.rowframe:SetFrameLevel(instancia.baseframe:GetFrameLevel()) end - + if (instancia.modo ~= Details._detalhes_props["MODO_ALONE"] and not instancia.baseframe.isLocked) then --> resize, lock and ungroup buttons @@ -790,10 +795,9 @@ local function move_janela (baseframe, iniciando, instancia, just_updating) precisa_ativar = not instancia_alvo.ativa if (need_start) then --> se a inst�ncia n�o tiver sido aberta ainda - local lower_instance = Details:GetLowerInstanceNumber() - instancia_alvo:RestauraJanela (instancia_alvo.meu_id, true) + instancia_alvo:RestauraJanela(instancia_alvo.meu_id, true) if (instancia_alvo:IsSoloMode()) then Details.SoloTables:switch() end @@ -803,9 +807,9 @@ local function move_janela (baseframe, iniciando, instancia, just_updating) instancia_alvo:SaveMainWindowPosition() instancia_alvo:RestoreMainWindowPosition() - Details.FadeHandler.Fader (instancia_alvo.baseframe, 1) - Details.FadeHandler.Fader (instancia_alvo.rowframe, 1) - Details.FadeHandler.Fader (instancia_alvo.baseframe.cabecalho.ball, 1) + Details.FadeHandler.Fader(instancia_alvo.baseframe, 1) + Details.FadeHandler.Fader(instancia_alvo.rowframe, parseRowFrameAlpha(1)) + Details.FadeHandler.Fader(instancia_alvo.baseframe.cabecalho.ball, 1) need_start = false end @@ -1851,7 +1855,7 @@ local barra_backdrop_onleave = { --> pre creating the truncate frame Details.left_anti_truncate = CreateFrame ("frame", "DetailsLeftTextAntiTruncate", UIParent,"BackdropTemplate") - Details.left_anti_truncate:SetBackdrop (gump_fundo_backdrop) + Details.left_anti_truncate:SetBackdrop (defaultBackdropSt) Details.left_anti_truncate:SetBackdropColor (0, 0, 0, 0.8) Details.left_anti_truncate:SetFrameStrata ("FULLSCREEN") Details.left_anti_truncate.text = Details.left_anti_truncate:CreateFontString (nil, "overlay", "GameFontNormal") @@ -2575,8 +2579,7 @@ local function button_stretch_scripts (baseframe, backgrounddisplay, instancia) Details.FadeHandler.Fader (self, "ALPHA", 0) end) - button:SetScript ("OnMouseDown", function (self, button) - + button:SetScript ("OnMouseDown", function(self, button) if (button ~= "LeftButton") then return end @@ -2584,14 +2587,14 @@ local function button_stretch_scripts (baseframe, backgrounddisplay, instancia) if (instancia:IsSoloMode()) then return end - - instancia:EsconderScrollBar (true) + + instancia:EsconderScrollBar(true) baseframe._place = instancia:SaveMainWindowPosition() baseframe.isResizing = true baseframe.isStretching = true - baseframe:SetFrameStrata ("TOOLTIP") - instancia.rowframe:SetFrameStrata ("TOOLTIP") - + baseframe:SetFrameStrata("TOOLTIP") + instancia.rowframe:SetFrameStrata("TOOLTIP") + local _r, _g, _b, _a = baseframe:GetBackdropColor() gump:GradientEffect ( baseframe, "frame", _r, _g, _b, _a, _r, _g, _b, 0.9, 1.5) @@ -2635,24 +2638,23 @@ local function button_stretch_scripts (baseframe, backgrounddisplay, instancia) instancia.stretchToo = linha_horizontal if (#instancia.stretchToo > 0) then - for _, esta_instancia in ipairs (instancia.stretchToo) do - esta_instancia:EsconderScrollBar (true) - esta_instancia.baseframe._place = esta_instancia:SaveMainWindowPosition() - esta_instancia.baseframe.isResizing = true - esta_instancia.baseframe.isStretching = true - esta_instancia.baseframe:SetFrameStrata ("TOOLTIP") - esta_instancia.rowframe:SetFrameStrata ("TOOLTIP") - - local _r, _g, _b, _a = esta_instancia.baseframe:GetBackdropColor() - gump:GradientEffect ( esta_instancia.baseframe, "frame", _r, _g, _b, _a, _r, _g, _b, 0.9, 1.5) - Details:SendEvent ("DETAILS_INSTANCE_STARTSTRETCH", nil, esta_instancia) - - if (esta_instancia.wallpaper.enabled) then - _r, _g, _b = esta_instancia.baseframe.wallpaper:GetVertexColor() - _a = esta_instancia.baseframe.wallpaper:GetAlpha() - gump:GradientEffect (esta_instancia.baseframe.wallpaper, "texture", _r, _g, _b, _a, _r, _g, _b, 0.05, 0.5) + for _, thisInstance in ipairs(instancia.stretchToo) do + thisInstance:EsconderScrollBar(true) + thisInstance.baseframe._place = thisInstance:SaveMainWindowPosition() + thisInstance.baseframe.isResizing = true + thisInstance.baseframe.isStretching = true + thisInstance.baseframe:SetFrameStrata("TOOLTIP") + thisInstance.rowframe:SetFrameStrata("TOOLTIP") + + local _r, _g, _b, _a = thisInstance.baseframe:GetBackdropColor() + gump:GradientEffect(thisInstance.baseframe, "frame", _r, _g, _b, _a, _r, _g, _b, 0.9, 1.5) + Details:SendEvent("DETAILS_INSTANCE_STARTSTRETCH", nil, thisInstance) + + if (thisInstance.wallpaper.enabled) then + _r, _g, _b = thisInstance.baseframe.wallpaper:GetVertexColor() + _a = thisInstance.baseframe.wallpaper:GetAlpha() + gump:GradientEffect(thisInstance.baseframe.wallpaper, "texture", _r, _g, _b, _a, _r, _g, _b, 0.05, 0.5) end - end end @@ -2696,28 +2698,28 @@ local function button_stretch_scripts (baseframe, backgrounddisplay, instancia) baseframe.stretch_direction = nil if (instancia.stretchToo and #instancia.stretchToo > 0) then - for _, esta_instancia in ipairs (instancia.stretchToo) do + for _, esta_instancia in ipairs(instancia.stretchToo) do esta_instancia.baseframe:StopMovingOrSizing() esta_instancia.baseframe.isResizing = false esta_instancia:RestoreMainWindowPosition (esta_instancia.baseframe._place) esta_instancia:ReajustaGump() esta_instancia.baseframe.isStretching = false if (esta_instancia.need_rolagem) then - esta_instancia:MostrarScrollBar (true) + esta_instancia:MostrarScrollBar(true) end - Details:SendEvent ("DETAILS_INSTANCE_SIZECHANGED", nil, esta_instancia) + Details:SendEvent("DETAILS_INSTANCE_SIZECHANGED", nil, esta_instancia) local _r, _g, _b, _a = esta_instancia.baseframe:GetBackdropColor() - gump:GradientEffect ( esta_instancia.baseframe, "frame", _r, _g, _b, _a, instancia.bg_r, instancia.bg_g, instancia.bg_b, instancia.bg_alpha, 0.5) + gump:GradientEffect(esta_instancia.baseframe, "frame", _r, _g, _b, _a, instancia.bg_r, instancia.bg_g, instancia.bg_b, instancia.bg_alpha, 0.5) if (esta_instancia.wallpaper.enabled) then _r, _g, _b = esta_instancia.baseframe.wallpaper:GetVertexColor() _a = esta_instancia.baseframe.wallpaper:GetAlpha() - gump:GradientEffect (esta_instancia.baseframe.wallpaper, "texture", _r, _g, _b, _a, _r, _g, _b, esta_instancia.wallpaper.alpha, 1.0) + gump:GradientEffect(esta_instancia.baseframe.wallpaper, "texture", _r, _g, _b, _a, _r, _g, _b, esta_instancia.wallpaper.alpha, 1.0) end - esta_instancia.baseframe:SetFrameStrata (esta_instancia.strata) - esta_instancia.rowframe:SetFrameStrata (esta_instancia.strata) + esta_instancia.baseframe:SetFrameStrata(esta_instancia.strata) + esta_instancia.rowframe:SetFrameStrata(esta_instancia.strata) esta_instancia:StretchButtonAlwaysOnTop() Details:SendEvent ("DETAILS_INSTANCE_ENDSTRETCH", nil, esta_instancia.baseframe) @@ -2732,26 +2734,23 @@ local function button_stretch_scripts (baseframe, backgrounddisplay, instancia) end local _r, _g, _b, _a = baseframe:GetBackdropColor() - gump:GradientEffect ( baseframe, "frame", _r, _g, _b, _a, instancia.bg_r, instancia.bg_g, instancia.bg_b, instancia.bg_alpha, 0.5) + gump:GradientEffect(baseframe, "frame", _r, _g, _b, _a, instancia.bg_r, instancia.bg_g, instancia.bg_b, instancia.bg_alpha, 0.5) if (instancia.wallpaper.enabled) then _r, _g, _b = baseframe.wallpaper:GetVertexColor() _a = baseframe.wallpaper:GetAlpha() - gump:GradientEffect (baseframe.wallpaper, "texture", _r, _g, _b, _a, _r, _g, _b, instancia.wallpaper.alpha, 1.0) + gump:GradientEffect(baseframe.wallpaper, "texture", _r, _g, _b, _a, _r, _g, _b, instancia.wallpaper.alpha, 1.0) end - baseframe:SetFrameStrata (instancia.strata) - instancia.rowframe:SetFrameStrata (instancia.strata) + baseframe:SetFrameStrata(instancia.strata) + instancia.rowframe:SetFrameStrata(instancia.strata) instancia:StretchButtonAlwaysOnTop() - Details:SnapTextures (false) - Details:SendEvent ("DETAILS_INSTANCE_ENDSTRETCH", nil, instancia) - + if (Details.stretch_changed_update_speed) then - Details:SetWindowUpdateSpeed (false, true) + Details:SetWindowUpdateSpeed(false, true) Details.stretch_changed_update_speed = nil end - end) end @@ -3486,6 +3485,11 @@ function gump:CriaJanelaPrincipal (ID, instancia, criando) rowframe:SetFrameLevel (3) rowframe:EnableMouse(false) instancia.rowframe = rowframe + + function rowframe:SetFrameAlpha(value) + local value = parseRowFrameAlpha(value) + self:SetAlpha(value) + end --> right click bookmark local switchbutton = CreateFrame("button", "Details_SwitchButtonFrame" .. ID, UIParent) @@ -3620,7 +3624,7 @@ function gump:CriaJanelaPrincipal (ID, instancia, criando) --baseframe:SetResizeBounds(150, 7, _detalhes.max_window_size.width, _detalhes.max_window_size.height) end - baseframe:SetBackdrop (gump_fundo_backdrop) + baseframe:SetBackdrop (defaultBackdropSt) baseframe:SetBackdropColor (instancia.bg_r, instancia.bg_g, instancia.bg_b, instancia.bg_alpha) -- background window config ------------------------------------------------------------------------------------------------------------------------------------------------- @@ -3631,7 +3635,7 @@ function gump:CriaJanelaPrincipal (ID, instancia, criando) backgrounddisplay:SetResizable (true) backgrounddisplay:SetPoint ("topleft", baseframe, "topleft") backgrounddisplay:SetPoint ("bottomright", baseframe, "bottomright") - backgrounddisplay:SetBackdrop (gump_fundo_backdrop) + backgrounddisplay:SetBackdrop (defaultBackdropSt) backgrounddisplay:SetBackdropColor (instancia.bg_r, instancia.bg_g, instancia.bg_b, instancia.bg_alpha) -- instance mini widgets ------------------------------------------------------------------------------------------------------------------------------------------------- @@ -4011,36 +4015,35 @@ local getActor = function(self) return self.minha_tabela end ---> search key: ~row ~barra ~newbar ~createbar ~createrow -function gump:CreateNewLine (instancia, index) - - --> instancia = window object, index = row number - local baseframe = instancia.baseframe - local rowframe = instancia.rowframe +--search key: ~row ~barra ~newbar ~createbar ~createrow +function gump:CreateNewLine(instance, index) + --instance = window object, index = row number + local baseframe = instance.baseframe + local rowframe = instance.rowframe - --> create the bar with rowframe as parent - local newLine = CreateFrame ("button", "DetailsBarra_"..instancia.meu_id.."_"..index, rowframe,"BackdropTemplate") + --create the bar with rowframe as parent + local newLine = CreateFrame("button", "DetailsBarra_"..instance.meu_id.."_"..index, rowframe, "BackdropTemplate") newLine.row_id = index - newLine.instance_id = instancia.meu_id + newLine.instance_id = instance.meu_id newLine.animacao_fim = 0 newLine.animacao_fim2 = 0 newLine.GetActor = getActor - --> set point, almost irrelevant here, it recalc this on SetBarGrowDirection() - local y = instancia.row_height * (index-1) - if (instancia.bars_grow_direction == 1) then - y = y*-1 - newLine:SetPoint ("topleft", baseframe, "topleft", instancia.row_info.space.left, y) + --set point, almost irrelevant here, it recalc this on SetBarGrowDirection() + local y = instance.row_height * (index-1) + if (instance.bars_grow_direction == 1) then + y = y * -1 + newLine:SetPoint("topleft", baseframe, "topleft", instance.row_info.space.left, y) - elseif (instancia.bars_grow_direction == 2) then - newLine:SetPoint ("bottomleft", baseframe, "bottomleft", instancia.row_info.space.left, y + 2) + elseif (instance.bars_grow_direction == 2) then + newLine:SetPoint("bottomleft", baseframe, "bottomleft", instance.row_info.space.left, y + 2) end - --> row height - newLine:SetHeight (instancia.row_info.height) - newLine:SetWidth (baseframe:GetWidth()+instancia.row_info.space.right) + --row height + newLine:SetHeight (instance.row_info.height) + newLine:SetWidth (baseframe:GetWidth()+instance.row_info.space.right) newLine:SetFrameLevel (baseframe:GetFrameLevel() + 4) newLine.last_value = 0 newLine.w_mod = 0 @@ -4048,69 +4051,70 @@ function gump:CreateNewLine (instancia, index) newLine:RegisterForClicks ("LeftButtonDown", "RightButtonDown") --statusbar - newLine.statusbar = CreateFrame ("StatusBar", "DetailsBarra_Statusbar_"..instancia.meu_id.."_"..index, newLine) + newLine.statusbar = CreateFrame("StatusBar", "DetailsBarra_Statusbar_"..instance.meu_id.."_"..index, newLine) newLine.statusbar.value = 0 --frame for hold the backdrop border - newLine.border = CreateFrame ("Frame", "DetailsBarra_Border_" .. instancia.meu_id .. "_" .. index, newLine.statusbar, "BackdropTemplate") - newLine.border:SetFrameLevel (newLine.statusbar:GetFrameLevel()+2) - newLine.border:SetAllPoints (newLine) + newLine.border = CreateFrame("Frame", "DetailsBarra_Border_" .. instance.meu_id .. "_" .. index, newLine.statusbar, "BackdropTemplate") + newLine.border:SetFrameLevel(newLine.statusbar:GetFrameLevel()+2) + newLine.border:SetAllPoints(newLine) --border newLine.lineBorder = DetailsFramework:CreateFullBorder(newLine:GetName() .. "Border", newLine.border) --low 3d bar --search key: ~model - newLine.modelbox_low = CreateFrame ("playermodel", "DetailsBarra_ModelBarLow_" .. instancia.meu_id .. "_" .. index, newLine) --rowframe + newLine.modelbox_low = CreateFrame("playermodel", "DetailsBarra_ModelBarLow_" .. instance.meu_id .. "_" .. index, newLine) newLine.modelbox_low:SetFrameLevel (newLine.statusbar:GetFrameLevel()-1) - newLine.modelbox_low:SetPoint ("topleft", newLine, "topleft") - newLine.modelbox_low:SetPoint ("bottomright", newLine, "bottomright") + newLine.modelbox_low:SetPoint("topleft", newLine, "topleft") + newLine.modelbox_low:SetPoint("bottomright", newLine, "bottomright") + --high 3d bar - newLine.modelbox_high = CreateFrame ("playermodel", "DetailsBarra_ModelBarHigh_" .. instancia.meu_id .. "_" .. index, newLine) --rowframe + newLine.modelbox_high = CreateFrame("playermodel", "DetailsBarra_ModelBarHigh_" .. instance.meu_id .. "_" .. index, newLine) newLine.modelbox_high:SetFrameLevel (newLine.statusbar:GetFrameLevel()+1) - newLine.modelbox_high:SetPoint ("topleft", newLine, "topleft") - newLine.modelbox_high:SetPoint ("bottomright", newLine, "bottomright") - - --> create textures and icons - newLine.textura = newLine.statusbar:CreateTexture (nil, "artwork") - newLine.textura:SetHorizTile (false) - newLine.textura:SetVertTile (false) - - --> row background texture - newLine.background = newLine:CreateTexture (nil, "background") + newLine.modelbox_high:SetPoint("topleft", newLine, "topleft") + newLine.modelbox_high:SetPoint("bottomright", newLine, "bottomright") + + --create textures and icons + newLine.textura = newLine.statusbar:CreateTexture(nil, "artwork") + newLine.textura:SetHorizTile(false) + newLine.textura:SetVertTile(false) + + --row background texture + newLine.background = newLine:CreateTexture(nil, "background") newLine.background:SetTexture("") newLine.background:SetAllPoints (newLine) - newLine.statusbar:SetStatusBarColor (0, 0, 0, 0) - newLine.statusbar:SetStatusBarTexture (newLine.textura) - newLine.statusbar:SetMinMaxValues (0, 100) - newLine.statusbar:SetValue (0) + newLine.statusbar:SetStatusBarColor(0, 0, 0, 0) + newLine.statusbar:SetStatusBarTexture(newLine.textura) + newLine.statusbar:SetMinMaxValues(0, 100) + newLine.statusbar:SetValue(0) - newLine.overlayTexture = newLine.statusbar:CreateTexture (nil, "overlay") + newLine.overlayTexture = newLine.statusbar:CreateTexture(nil, "overlay") newLine.overlayTexture:SetAllPoints() - --> class icon - local icone_classe = newLine.border:CreateTexture (nil, "overlay") - icone_classe:SetHeight (instancia.row_info.height) - icone_classe:SetWidth (instancia.row_info.height) - icone_classe:SetTexture (instancia.row_info.icon_file) + --class icon + local icone_classe = newLine.border:CreateTexture(nil, "overlay") + icone_classe:SetHeight (instance.row_info.height) + icone_classe:SetWidth (instance.row_info.height) + icone_classe:SetTexture (instance.row_info.icon_file) icone_classe:SetTexCoord (.75, 1, .75, 1) newLine.icone_classe = icone_classe - local iconFrame = CreateFrame ("frame", "DetailsBarra_IconFrame_" .. instancia.meu_id .. "_" .. index, newLine.statusbar) - iconFrame:SetPoint ("topleft", icone_classe, "topleft") - iconFrame:SetPoint ("bottomright", icone_classe, "bottomright") + local iconFrame = CreateFrame("frame", "DetailsBarra_IconFrame_" .. instance.meu_id .. "_" .. index, newLine.statusbar) + iconFrame:SetPoint("topleft", icone_classe, "topleft") + iconFrame:SetPoint("bottomright", icone_classe, "bottomright") iconFrame:SetFrameLevel (newLine.statusbar:GetFrameLevel()+1) - iconFrame.instance_id = instancia.meu_id + iconFrame.instance_id = instance.meu_id iconFrame.row = newLine newLine.icon_frame = iconFrame - icone_classe:SetPoint ("left", newLine, "left") - newLine.statusbar:SetPoint ("topleft", icone_classe, "topright") - newLine.statusbar:SetPoint ("bottomright", newLine, "bottomright") + icone_classe:SetPoint("left", newLine, "left") + newLine.statusbar:SetPoint("topleft", icone_classe, "topright") + newLine.statusbar:SetPoint("bottomright", newLine, "bottomright") --> left text 1 newLine.lineText1 = newLine.border:CreateFontString (nil, "overlay", "GameFontHighlight") - newLine.lineText1:SetPoint ("left", newLine.icone_classe, "right", 3, 0) + newLine.lineText1:SetPoint("left", newLine.icone_classe, "right", 3, 0) newLine.lineText1:SetJustifyH ("left") newLine.lineText1:SetNonSpaceWrap (true) @@ -4120,21 +4124,21 @@ function gump:CreateNewLine (instancia, index) end --> set the onclick, on enter scripts - barra_scripts (newLine, instancia, index) + barra_scripts (newLine, instance, index) --> hide Details.FadeHandler.Fader (newLine, 1) --> adds the window container - instancia.barras [index] = newLine + instance.barras [index] = newLine --> set the left text newLine.lineText1:SetText (Loc["STRING_NEWROW"]) --> refresh rows - instancia:InstanceRefreshRows() + instance:InstanceRefreshRows() - Details:SendEvent ("DETAILS_INSTANCE_NEWROW", nil, instancia, newLine) + Details:SendEvent ("DETAILS_INSTANCE_NEWROW", nil, instance, newLine) return newLine end @@ -5162,40 +5166,39 @@ function Details:GetTextures() --atributo_icon � uma exce��o end -function Details:SetWindowAlphaForInteract (alpha) - - local ignorebars = self.menu_alpha.ignorebars - +function Details:SetWindowAlphaForInteract(alpha) + local ignoreBars = self.menu_alpha.ignorebars + if (self.is_interacting) then - --> entrou - self.baseframe:SetAlpha (alpha) - self:InstanceAlpha (alpha) - self:SetIconAlpha (alpha, nil, true) - - if (ignorebars) then - self.rowframe:SetAlpha (1) + --mouse entered the window + self.baseframe:SetAlpha(alpha) + self:InstanceAlpha(alpha) + self:SetIconAlpha(alpha, nil, true) + + if (ignoreBars) then + self.rowframe:SetFrameAlpha(1) else - self.rowframe:SetAlpha (alpha) + self.rowframe:SetFrameAlpha(alpha) end else - --> saiu + --mouse left the window if (self.combat_changes_alpha and self.combat_changes_alpha ~= 1) then --> combat alpha - self:InstanceAlpha (self.combat_changes_alpha) - self:SetIconAlpha (self.combat_changes_alpha, nil, true) - self.rowframe:SetAlpha (self.combat_changes_alpha) --alpha do combate � absoluta - self.baseframe:SetAlpha (self.combat_changes_alpha) --alpha do combate � absoluta + self:InstanceAlpha(self.combat_changes_alpha) + self:SetIconAlpha(self.combat_changes_alpha, nil, true) + self.rowframe:SetFrameAlpha(self.combat_changes_alpha) --alpha do combate � absoluta + self.baseframe:SetAlpha(self.combat_changes_alpha) --alpha do combate � absoluta else - self:InstanceAlpha (alpha) - self:SetIconAlpha (alpha, nil, true) - - if (ignorebars) then - self.rowframe:SetAlpha (1) + self:InstanceAlpha(alpha) + self:SetIconAlpha(alpha, nil, true) + + if (ignoreBars) then + self.rowframe:SetFrameAlpha(1) else - self.rowframe:SetAlpha (alpha) + self.rowframe:SetFrameAlpha(alpha) end - - self.baseframe:SetAlpha (alpha) + + self.baseframe:SetAlpha(alpha) end end @@ -5252,23 +5255,15 @@ function Details:SetWindowAlphaForCombat (entering_in_combat, true_hide, alphaAm self.baseframe:Hide() self.rowframe:Hide() self.windowSwitchButton:Hide() - --Details.FadeHandler.Fader (self.baseframe, unpack(_detalhes.windows_fade_in)) - --Details.FadeHandler.Fader (self.rowframe, unpack(_detalhes.windows_fade_in)) - --Details.FadeHandler.Fader (self.windowSwitchButton, unpack(_detalhes.windows_fade_in)) - - --self:SetIconAlpha (nil, true) - if (Details.debug) then Details:Msg ("(debug) hiding window SetWindowAlphaForCombat()", amount, rowsamount, menuamount) end - --]] else - -- self.baseframe:Show() - self.baseframe:SetAlpha (1) - - self:InstanceAlpha(min (amount, self.color[4])) - Details.FadeHandler.Fader(self.rowframe, "ALPHAANIM", rowsamount) + self.baseframe:SetAlpha(1) + + self:InstanceAlpha(min(amount, self.color[4])) + Details.FadeHandler.Fader(self.rowframe, "ALPHAANIM", parseRowFrameAlpha(rowsamount)) Details.FadeHandler.Fader(self.baseframe, "ALPHAANIM", rowsamount) --]] end @@ -7405,24 +7400,24 @@ function Details:UpdateClickThrough() --window frames if (windowClickThrough) then - self.baseframe:EnableMouse (false) - self.bgframe:EnableMouse (false) - self.rowframe:EnableMouse (false) - self.floatingframe:EnableMouse (false) - self.windowSwitchButton:EnableMouse (false) - self.windowBackgroundDisplay:EnableMouse (false) - self.baseframe.UPFrame:EnableMouse (false) + self.baseframe:EnableMouse(false) + self.bgframe:EnableMouse(false) + self.rowframe:EnableMouse(false) + self.floatingframe:EnableMouse(false) + self.windowSwitchButton:EnableMouse(false) + self.windowBackgroundDisplay:EnableMouse(false) + self.baseframe.UPFrame:EnableMouse(false) self.baseframe.DOWNFrame:EnableMouse(false) else - self.baseframe:EnableMouse (true) - self.bgframe:EnableMouse (true) - self.rowframe:EnableMouse (true) - self.floatingframe:EnableMouse (true) - self.windowSwitchButton:EnableMouse (true) - self.windowBackgroundDisplay:EnableMouse (true) - self.baseframe.UPFrame:EnableMouse (true) + self.baseframe:EnableMouse(true) + self.bgframe:EnableMouse(true) + self.rowframe:EnableMouse(true) + self.floatingframe:EnableMouse(true) + self.windowSwitchButton:EnableMouse(true) + self.windowBackgroundDisplay:EnableMouse(true) + self.baseframe.UPFrame:EnableMouse(true) self.baseframe.DOWNFrame:EnableMouse(true) end @@ -7436,24 +7431,24 @@ function Details:UpdateClickThrough() toolbar_buttons [6] = self.baseframe.cabecalho.fechar for i, button in ipairs (toolbar_buttons) do - button:EnableMouse (toolbar_buttons) + button:EnableMouse(toolbar_buttons) end else --player bars for barIndex, barObject in ipairs (self.barras) do - barObject:EnableMouse (true) + barObject:EnableMouse(true) barObject.icon_frame:EnableMouse(true) end --window frames - self.baseframe:EnableMouse (true) - self.bgframe:EnableMouse (true) - self.rowframe:EnableMouse (true) - self.floatingframe:EnableMouse (true) - self.windowSwitchButton:EnableMouse (true) - self.windowBackgroundDisplay:EnableMouse (true) - self.baseframe.UPFrame:EnableMouse (true) + self.baseframe:EnableMouse(true) + self.bgframe:EnableMouse(true) + self.rowframe:EnableMouse(true) + self.floatingframe:EnableMouse(true) + self.windowSwitchButton:EnableMouse(true) + self.windowBackgroundDisplay:EnableMouse(true) + self.baseframe.UPFrame:EnableMouse(true) self.baseframe.DOWNFrame:EnableMouse(true) --titlebar icons, forcing true because the player isn't in combat and the inCombat setting is enabled @@ -7466,7 +7461,7 @@ function Details:UpdateClickThrough() toolbar_buttons [6] = self.baseframe.cabecalho.fechar for i, button in ipairs (toolbar_buttons) do - button:EnableMouse (true) + button:EnableMouse(true) end end else @@ -7474,33 +7469,33 @@ function Details:UpdateClickThrough() --player bars if (barsClickThrough) then for barIndex, barObject in ipairs (self.barras) do - barObject:EnableMouse (false) + barObject:EnableMouse(false) barObject.icon_frame:EnableMouse(false) end else for barIndex, barObject in ipairs (self.barras) do - barObject:EnableMouse (true) + barObject:EnableMouse(true) end end --window frame if (windowClickThrough) then - self.baseframe:EnableMouse (false) - self.bgframe:EnableMouse (false) - self.rowframe:EnableMouse (false) - self.floatingframe:EnableMouse (false) - self.windowSwitchButton:EnableMouse (false) - self.windowBackgroundDisplay:EnableMouse (false) - self.baseframe.UPFrame:EnableMouse (false) + self.baseframe:EnableMouse(false) + self.bgframe:EnableMouse(false) + self.rowframe:EnableMouse(false) + self.floatingframe:EnableMouse(false) + self.windowSwitchButton:EnableMouse(false) + self.windowBackgroundDisplay:EnableMouse(false) + self.baseframe.UPFrame:EnableMouse(false) self.baseframe.DOWNFrame:EnableMouse(false) else - self.baseframe:EnableMouse (true) - self.bgframe:EnableMouse (true) - self.rowframe:EnableMouse (true) - self.floatingframe:EnableMouse (true) - self.windowSwitchButton:EnableMouse (true) - self.windowBackgroundDisplay:EnableMouse (true) - self.baseframe.UPFrame:EnableMouse (true) + self.baseframe:EnableMouse(true) + self.bgframe:EnableMouse(true) + self.rowframe:EnableMouse(true) + self.floatingframe:EnableMouse(true) + self.windowSwitchButton:EnableMouse(true) + self.windowBackgroundDisplay:EnableMouse(true) + self.baseframe.UPFrame:EnableMouse(true) self.baseframe.DOWNFrame:EnableMouse(true) end @@ -7514,7 +7509,7 @@ function Details:UpdateClickThrough() toolbar_buttons [6] = self.baseframe.cabecalho.fechar for i, button in ipairs (toolbar_buttons) do - button:EnableMouse (toolbarIcons) + button:EnableMouse(toolbarIcons) end end end @@ -7706,17 +7701,16 @@ function Details:LeftMenuAnchorSide (side) return self:MenuAnchor() end -function Details:SetFrameStrata (strata) - +function Details:SetFrameStrata(strata) if (not strata) then strata = self.strata end self.strata = strata - self.rowframe:SetFrameStrata (strata) - self.windowSwitchButton:SetFrameStrata (strata) - self.baseframe:SetFrameStrata (strata) + self.rowframe:SetFrameStrata(strata) + self.windowSwitchButton:SetFrameStrata(strata) + self.baseframe:SetFrameStrata(strata) if (strata == "BACKGROUND") then self.break_snap_button:SetFrameStrata ("LOW") @@ -8260,7 +8254,7 @@ function Details:SetMenuAlpha (enabled, onenter, onleave, ignorebars, interactin if (not enabled) then self.baseframe:SetAlpha (1) - self.rowframe:SetAlpha (1) + self.rowframe:SetFrameAlpha(1) self:InstanceAlpha (self.color[4]) self:SetIconAlpha (1, nil, true) return self:InstanceColor (unpack(self.color)) @@ -8405,15 +8399,14 @@ function Details:GetInstanceGroup (instance_id) return current_group end -function Details:SetWindowScale (scale, from_options) +function Details:SetWindowScale(scale, fromOptions) if (not scale) then scale = self.window_scale end - if (from_options) then + if (fromOptions) then local group = self:GetInstanceGroup() - - for _, instance in ipairs (group) do + for _, instance in ipairs(group) do instance.baseframe:SetScale(scale) instance.rowframe:SetScale(scale) instance.windowSwitchButton:SetScale(scale) diff --git a/frames/window_switch.lua b/frames/window_switch.lua index 50f37f41..323e3c12 100644 --- a/frames/window_switch.lua +++ b/frames/window_switch.lua @@ -1,283 +1,171 @@ -local _detalhes = _G._detalhes -local AceLocale = LibStub ("AceLocale-3.0") -local Loc = AceLocale:GetLocale ( "Details" ) +local Details = Details +local AceLocale = LibStub("AceLocale-3.0") +local Loc = AceLocale:GetLocale( "Details" ) -local gump = _detalhes.gump +local gump = Details.gump local _ + --lua locals -local _unpack = unpack -local _math_floor = math.floor +local unpack = unpack +local floor = math.floor +local gameCooltip = GameCooltip --api locals do - local _CreateFrame = CreateFrame - local _UIParent = UIParent + local bookmarkFrame = CreateFrame("frame", "DetailsSwitchPanel", UIParent,"BackdropTemplate") + bookmarkFrame:SetPoint("center", UIParent, "center", 500, -300) + bookmarkFrame:SetWidth(250) + bookmarkFrame:SetHeight(100) + bookmarkFrame:SetFrameStrata("FULLSCREEN") + bookmarkFrame:SetFrameLevel(16) + bookmarkFrame.editing_window = nil - local gump_fundo_backdrop = { - bgFile = "Interface\\AddOns\\Details\\images\\background", - tile = true, tileSize = 16, - insets = {left = 0, right = 0, top = 0, bottom = 0}} + DetailsFramework:ApplyStandardBackdrop(bookmarkFrame, true) + bookmarkFrame:SetBackdropBorderColor(0, 0, 0, 0) - local frame = _CreateFrame ("frame", "DetailsSwitchPanel", _UIParent,"BackdropTemplate") - frame:SetPoint ("center", _UIParent, "center", 500, -300) - frame:SetWidth (250) - frame:SetHeight (100) - frame:SetBackdrop (gump_fundo_backdrop) - frame:SetBackdropBorderColor (170/255, 170/255, 170/255) - frame:SetBackdropColor (0, 0, 0, .7) - - DetailsSwitchPanel.HoverOverBackground = {.6, .6, .6, .2} - - frame.hover_over_texture = frame:CreateTexture (nil, "border") - frame.hover_over_texture:SetTexture (unpack (DetailsSwitchPanel.HoverOverBackground)) - frame.hover_over_texture:SetSize (130, 18) - frame.hover_over_texture:Hide() - - frame:SetFrameStrata ("FULLSCREEN") - frame:SetFrameLevel (16) - - frame.background = frame:CreateTexture (nil, "background") - frame.background:SetTexture ("Interface\\AddOns\\Details\\images\\background") - --frame.background:SetTexture ([[Interface\SPELLBOOK\Spellbook-Page-1]]) - --frame.background:SetTexCoord (331/512, 63/512, 109/512, 143/512) - frame.background:SetAllPoints() - frame.background:SetDesaturated (true) - --frame.background:SetVertexColor (1, 1, 1, 0.1) - frame.background:SetVertexColor (0, 0, 0, .8) - - frame.topbg = frame:CreateTexture (nil, "background") - frame.topbg:SetTexture ("Interface\\AddOns\\Details\\images\\background") - --frame.topbg:SetTexCoord (100/512, 267/512, 143/512, 202/512) - frame.topbg:SetPoint ("bottomleft", frame, "topleft") - frame.topbg:SetPoint ("bottomright", frame, "topright") - frame.topbg:SetHeight (20) - frame.topbg:SetDesaturated (true) - frame.topbg:SetVertexColor (0, 0, 0, 1) - - frame.topbg_frame = CreateFrame ("frame", nil, frame) - frame.topbg_frame:SetPoint ("bottomleft", frame, "topleft") - frame.topbg_frame:SetPoint ("bottomright", frame, "topright") - frame.topbg_frame:SetHeight (20) - frame.topbg_frame:EnableMouse (true) - frame.topbg_frame:SetScript ("OnMouseDown", function (self, button) - if (button == "RightButton") then - _detalhes.switch:CloseMe() - end - end) - - frame.star = frame:CreateTexture (nil, "overlay") - frame.star:SetTexture ([[Interface\Glues\CharacterSelect\Glues-AddOn-Icons]]) - frame.star:SetTexCoord (0.75, 1, 0, 1) - frame.star:SetVertexColor (1, 0.8, 0.6) - frame.star:SetSize (16, 16) - frame.star:SetPoint ("bottomleft", frame, "topleft", 4, 1) - - frame.title_label = frame:CreateFontString (nil, "overlay", "GameFontNormal") - frame.title_label:SetPoint ("left", frame.star, "right", 4, 0) - frame.title_label:SetTextColor (1, 0.8, 0.4) - frame.title_label:SetText (Loc ["STRING_KEYBIND_BOOKMARK"]) + local backgroundGradientTexture = DetailsFramework:CreateTexture(bookmarkFrame, {gradient = "vertical", fromColor = {0, 0, 0, 0.2}, toColor = {0, 0, 0, 0.4}}, 1, 1, "artwork", {0, 1, 0, 1}) + backgroundGradientTexture:SetAllPoints() ---------------------------------------------------------------------------------------------------------------------------- + bookmarkFrame.HoverOverBackground = {.6, .6, .6, .2} + bookmarkFrame.hoverOverTexture = bookmarkFrame:CreateTexture(nil, "border") + bookmarkFrame.hoverOverTexture:SetTexture(unpack(bookmarkFrame.HoverOverBackground)) + bookmarkFrame.hoverOverTexture:SetSize(130, 18) + bookmarkFrame.hoverOverTexture:Hide() - frame.editing_window = nil - local windowcolor_callback = function (button, r, g, b, a) - local instance = frame.editing_window - - if (instance.menu_alpha.enabled and a ~= instance.color[4]) then - _detalhes:Msg (Loc ["STRING_OPTIONS_MENU_ALPHAWARNING"]) - instance:InstanceColor (r, g, b, instance.menu_alpha.onleave, nil, true) - - if (_detalhes.options_group_edit) then - for _, this_instance in ipairs (instance:GetInstanceGroup()) do - if (this_instance ~= instance) then - this_instance:InstanceColor (r, g, b, instance.menu_alpha.onleave, nil, true) - end - end - end - - return - end - - instance:InstanceColor (r, g, b, a, nil, true) - if (_detalhes.options_group_edit) then - for _, this_instance in ipairs (instance:GetInstanceGroup()) do - if (this_instance ~= instance) then - this_instance:InstanceColor (r, g, b, a, nil, true) - end - end - end - end - - local change_color = function() - frame.editing_window = _detalhes.switch.current_instancia - local r, g, b, a = unpack (frame.editing_window.color) - _detalhes.gump:ColorPick (frame, r, g, b, a, windowcolor_callback) - _detalhes.switch:CloseMe() - end - - local window_color = gump:CreateButton (frame.topbg_frame, change_color, 14, 14) - window_color:SetPoint ("bottomright", frame, "topright", -3, 2) - - local window_color_texture = gump:CreateImage (window_color, [[Interface\AddOns\Details\images\icons]], 14, 14, "artwork", {434/512, 466/512, 277/512, 307/512}) - window_color_texture:SetAlpha (0.55) - window_color_texture:SetAllPoints() - - window_color:SetHook ("OnEnter", function() - window_color_texture:SetAlpha (1) - GameCooltip:Reset() - _detalhes:CooltipPreset (1) - GameCooltip:SetBackdrop (1, _detalhes.tooltip_backdrop, backgroundColor, _detalhes.tooltip_border_color) - GameCooltip:AddLine (Loc ["STRING_OPTIONS_INSTANCE_COLOR"]) - GameCooltip:SetOwner (window_color.widget) - GameCooltip:SetType ("tooltip") - GameCooltip:Show() - end) - window_color:SetHook ("OnLeave", function() - window_color_texture:SetAlpha (0.55) - GameCooltip:Hide() - end) - ---------------------------------------------------------------------------------------------------------------------------- - --> ~all - local all_switch = CreateFrame ("frame", "DetailsAllAttributesFrame", UIParent,"BackdropTemplate") - all_switch:SetFrameStrata ("tooltip") - all_switch:Hide() - all_switch:SetSize(600, 150) - all_switch:SetClampedToScreen (true) - all_switch:SetBackdrop ({bgFile = "Interface\\AddOns\\Details\\images\\background", tile = true, tileSize = 16 }) - all_switch:SetBackdropColor (0.05, 0.05, 0.05, 0.3) - all_switch.background = all_switch:CreateTexture ("DetailsAllAttributesFrameBackground", "background") - all_switch.background:SetDrawLayer ("background", 2) - all_switch.background:SetPoint ("topleft", all_switch, "topleft", 4, -4) - all_switch.background:SetPoint ("bottomright", all_switch, "bottomright", -4, 4) - all_switch.wallpaper = all_switch:CreateTexture ("DetailsAllAttributesFrameWallPaper", "background") - all_switch.wallpaper:SetDrawLayer ("background", 4) - all_switch.wallpaper:SetPoint ("topleft", all_switch, "topleft", 4, -4) - all_switch.wallpaper:SetPoint ("bottomright", all_switch, "bottomright", -4, 4) - all_switch.buttons = {} - - all_switch.ShowAnimation = _detalhes.gump:CreateAnimationHub (all_switch, function() all_switch:Show() end) - _detalhes.gump:CreateAnimation (all_switch.ShowAnimation, "scale", 1, 0.04, 1, 0, 1, 1, "BOTTOM", 0, 0) - _detalhes.gump:CreateAnimation (all_switch.ShowAnimation, "alpha", 1, 0.04, 0, 1) - - all_switch:SetScript ("OnMouseDown", function (self, button) + --~all + local allDisplaysFrame = CreateFrame("frame", "DetailsAllAttributesFrame", UIParent,"BackdropTemplate") + allDisplaysFrame:SetFrameStrata("tooltip") + allDisplaysFrame:Hide() + allDisplaysFrame:SetSize(600, 150) + allDisplaysFrame:SetClampedToScreen(true) + allDisplaysFrame.buttons = {} + + DetailsFramework:ApplyStandardBackdrop(allDisplaysFrame) + allDisplaysFrame.BackgroundGradientTexture = DetailsFramework:CreateTexture(allDisplaysFrame, {gradient = "vertical", fromColor = "transparent", toColor = {0, 0, 0, 0.2}}, 1, 1, "artwork", {0, 1, 0, 1}) + allDisplaysFrame.BackgroundGradientTexture:SetAllPoints() + + allDisplaysFrame:SetScript("OnMouseDown", function(self, button) if (button == "RightButton") then self:Hide() end end) - all_switch:SetScript ("OnEnter", function (self, button) - all_switch.interacting = true - all_switch.last_up = GetTime() + + allDisplaysFrame:SetScript("OnEnter", function(self, button) + allDisplaysFrame.interacting = true + allDisplaysFrame.last_up = GetTime() end) - all_switch:SetScript ("OnLeave", function (self, button) - all_switch.interacting = false - all_switch.last_up = GetTime() + + allDisplaysFrame:SetScript("OnLeave", function(self, button) + allDisplaysFrame.interacting = false + allDisplaysFrame.last_up = GetTime() end) - - local on_update_all_switch = function (self, elapsed) + + local on_update_all_switch = function(self, elapsed) if (not self.interacting) then - if (GetTime() > all_switch.last_up+2) then - local cursor_x, cursor_y = GetCursorPosition() - cursor_x, cursor_y = floor (cursor_x), floor (cursor_y) - if (all_switch.cursor_x ~= cursor_x or all_switch.cursor_y ~= cursor_y) then + if (GetTime() > allDisplaysFrame.last_up + 2) then + local cursorX, cursorY = GetCursorPosition() + cursorX, cursorY = floor(cursorX), floor(cursorY) + if (allDisplaysFrame.cursor_x ~= cursorX or allDisplaysFrame.cursor_y ~= cursorY) then self:Hide() else - all_switch.last_up = GetTime()-1 + allDisplaysFrame.last_up = GetTime() - 1 end end end end - - all_switch:SetScript ("OnHide", function (self) - all_switch:SetScript ("OnUpdate", nil) - end) - - DetailsSwitchPanel.all_switch = all_switch - - function _detalhes:ShowAllSwitch() - if (all_switch:IsShown()) then - return all_switch:Hide() - end - all_switch.instance = self - GameTooltip:Hide() - GameCooltip:Hide() - all_switch:ClearAllPoints() - all_switch:SetPoint ("bottom", self.baseframe.UPFrame, "top", 4) - all_switch:Show() - - if (_detalhes.switch.frame:IsShown()) then - _detalhes.switch:CloseMe() + allDisplaysFrame:SetScript("OnHide", function(self) + allDisplaysFrame:SetScript("OnUpdate", nil) + end) + + DetailsSwitchPanel.all_switch = allDisplaysFrame + + function Details:ShowAllSwitch() + if (allDisplaysFrame:IsShown()) then + return allDisplaysFrame:Hide() + end + + allDisplaysFrame.instance = self + GameTooltip:Hide() + gameCooltip:Hide() + allDisplaysFrame:ClearAllPoints() + allDisplaysFrame:SetPoint("bottom", self.baseframe.UPFrame, "top", 4) + + allDisplaysFrame:Show() + + if (Details.switch.frame:IsShown()) then + Details.switch:CloseMe() end end - + local on_click_all_switch_button = function (self, button) if (button == "LeftButton") then local attribute = self.attribute - local sub_attribute = self.sub_attribute - local instance = all_switch.instance - + local subAttribute = self.sub_attribute + local instance = allDisplaysFrame.instance + --check if is a plugin button if (self.isPlugin) then - if (_detalhes.RaidTables.NameTable[self.pluginName]) then - _detalhes.RaidTables:EnableRaidMode (instance, self.pluginName) - elseif (_detalhes.SoloTables.NameTable [self.pluginName]) then - _detalhes.SoloTables:EnableSoloMode (instance, self.pluginName) + if (Details.RaidTables.NameTable[self.pluginName]) then + Details.RaidTables:EnableRaidMode(instance, self.pluginName) + elseif (Details.SoloTables.NameTable [self.pluginName]) then + Details.SoloTables:EnableSoloMode(instance, self.pluginName) else - _detalhes:Msg ("Plugin not found.") + Details:Msg("Plugin not found.") end - all_switch:Hide() + allDisplaysFrame:Hide() return end - if (instance.modo == _detalhes._detalhes_props["MODO_ALONE"] or instance.modo == _detalhes._detalhes_props["MODO_RAID"]) then - instance:AlteraModo (instance, 2) + if (instance.modo == Details._detalhes_props["MODO_ALONE"] or instance.modo == Details._detalhes_props["MODO_RAID"]) then + instance:AlteraModo(instance, 2) end - instance:TrocaTabela (instance, true, attribute, sub_attribute) - all_switch:Hide() - + + instance:TrocaTabela(instance, true, attribute, subAttribute) + allDisplaysFrame:Hide() + elseif (button == "RightButton") then - all_switch:Hide() + allDisplaysFrame:Hide() end end - - local hover_over_texture = all_switch:CreateTexture (nil, "border") - hover_over_texture:SetTexture (unpack (DetailsSwitchPanel.HoverOverBackground)) - hover_over_texture:SetSize (130, 18) - hover_over_texture:Hide() - + + local hoverOverTexture = allDisplaysFrame:CreateTexture(nil, "border") + hoverOverTexture:SetTexture(unpack(DetailsSwitchPanel.HoverOverBackground)) + hoverOverTexture:SetSize(130, 18) + hoverOverTexture:Hide() + local icon_size = 16 local text_color = {.9, .9, .9, 1} - - local on_enter_all_switch_button = function (self) - _detalhes:SetFontColor (self.text, "orange") - all_switch.interacting = true - all_switch.last_up = GetTime() - - hover_over_texture:SetSize (130, 18) - hover_over_texture:ClearAllPoints() - hover_over_texture:SetPoint ("topleft", self, "topleft", -2, 1) - hover_over_texture:Show() - end - - local on_leave_all_switch_button = function (self) - _detalhes:SetFontColor (self.text, text_color) - all_switch.interacting = false - all_switch.last_up = GetTime() - hover_over_texture:Hide() + + local on_enter_all_switch_button = function(self) + Details:SetFontColor(self.text, "orange") + allDisplaysFrame.interacting = true + allDisplaysFrame.last_up = GetTime() + + hoverOverTexture:SetSize(130, 18) + hoverOverTexture:ClearAllPoints() + hoverOverTexture:SetPoint("topleft", self, "topleft", -2, 1) + hoverOverTexture:Show() end - local on_enter_all_switch_button_icon = function (self) - self.MainFrame.texture:SetBlendMode ("ADD") - on_enter_all_switch_button (self.MainFrame) + local on_leave_all_switch_button = function(self) + Details:SetFontColor(self.text, text_color) + allDisplaysFrame.interacting = false + allDisplaysFrame.last_up = GetTime() + hoverOverTexture:Hide() end - local on_leave_all_switch_button_icon = function (self) - self.MainFrame.texture:SetBlendMode ("BLEND") - on_leave_all_switch_button (self.MainFrame) + + local on_enter_all_switch_button_icon = function(self) + self.MainFrame.texture:SetBlendMode("ADD") + on_enter_all_switch_button(self.MainFrame) + end + local on_leave_all_switch_button_icon = function(self) + self.MainFrame.texture:SetBlendMode("BLEND") + on_leave_all_switch_button(self.MainFrame) end - all_switch.check_text_size = function (font_string) + allDisplaysFrame.check_text_size = function(font_string) local text_width = font_string:GetStringWidth() while (text_width > 104) do local text = font_string:GetText() @@ -288,7 +176,7 @@ do end local create_all_switch_button = function (attribute, sub_attribute, x, y) - local button = CreateFrame ("button", "DetailsAllAttributesFrame" .. attribute .. sub_attribute, all_switch) + local button = CreateFrame ("button", "DetailsAllAttributesFrame" .. attribute .. sub_attribute, allDisplaysFrame) button:SetSize (130, 16) button.texture = button:CreateTexture (nil, "overlay") button.texture:SetPoint ("left", 0, 0) @@ -305,8 +193,8 @@ do button.attribute = attribute button.sub_attribute = sub_attribute button:SetPoint ("topleft", x, y) - _detalhes:SetFontSize(button.text, _detalhes.all_switch_config.font_size) - _detalhes:SetFontColor (button.text, text_color) + Details:SetFontSize(button.text, Details.all_switch_config.font_size) + Details:SetFontColor (button.text, text_color) button:SetScript ("OnClick", on_click_all_switch_button) button:SetScript ("OnEnter", on_enter_all_switch_button) @@ -321,46 +209,46 @@ do return button end - all_switch:SetScript ("OnShow", function() + allDisplaysFrame:SetScript ("OnShow", function() - if (not all_switch.already_built) then + if (not allDisplaysFrame.already_built) then local x, y = 8, -8 - all_switch.higher_counter = 0 + allDisplaysFrame.higher_counter = 0 - for attribute = 1, _detalhes.atributos[0] do + for attribute = 1, Details.atributos[0] do --> localized attribute name - local loc_attribute_name = _detalhes.atributos.lista [attribute] + local loc_attribute_name = Details.atributos.lista [attribute] - local title_icon = all_switch:CreateTexture (nil, "overlay") + local title_icon = allDisplaysFrame:CreateTexture (nil, "overlay") title_icon:SetPoint ("topleft", x, y) - local texture, l, r, t, b = _detalhes:GetAttributeIcon (attribute) + local texture, l, r, t, b = Details:GetAttributeIcon (attribute) title_icon:SetTexture (texture) title_icon:SetTexCoord (l, r, t, b) title_icon:SetSize (18, 18) - local title_str = all_switch:CreateFontString (nil, "overlay", "GameFontNormal") + local title_str = allDisplaysFrame:CreateFontString (nil, "overlay", "GameFontNormal") title_str:SetPoint ("left", title_icon, "right", 2, 0) title_str:SetText (loc_attribute_name) y = y - 20 - all_switch.buttons [attribute] = {} - for i = 1, #_detalhes.sub_atributos [attribute].lista do + allDisplaysFrame.buttons [attribute] = {} + for i = 1, #Details.sub_atributos [attribute].lista do --> localized sub attribute name - local loc_sub_attribute_name = _detalhes.sub_atributos [attribute].lista [i] + local loc_sub_attribute_name = Details.sub_atributos [attribute].lista [i] local button = create_all_switch_button (attribute, i, x, y) button.text:SetText (loc_sub_attribute_name) - _detalhes:SetFontSize(button.text, _detalhes.all_switch_config.font_size) + Details:SetFontSize(button.text, Details.all_switch_config.font_size) - all_switch.check_text_size (button.text) - button.texture:SetTexture (_detalhes.sub_atributos [attribute].icones [i] [1]) - button.texture:SetTexCoord (unpack (_detalhes.sub_atributos [attribute].icones [i] [2])) - tinsert (all_switch.buttons [attribute], button) + allDisplaysFrame.check_text_size (button.text) + button.texture:SetTexture (Details.sub_atributos [attribute].icones [i] [1]) + button.texture:SetTexCoord (unpack (Details.sub_atributos [attribute].icones [i] [2])) + tinsert (allDisplaysFrame.buttons [attribute], button) y = y - 17 end - if (#_detalhes.sub_atributos [attribute].lista > all_switch.higher_counter) then - all_switch.higher_counter = #_detalhes.sub_atributos [attribute].lista + if (#Details.sub_atributos [attribute].lista > allDisplaysFrame.higher_counter) then + allDisplaysFrame.higher_counter = #Details.sub_atributos [attribute].lista end x = x + 130 @@ -368,60 +256,60 @@ do end --> prepare for scripts - all_switch.x = x - all_switch.y = -8 - all_switch.buttons [_detalhes.atributos[0]+1] = {} + allDisplaysFrame.x = x + allDisplaysFrame.y = -8 + allDisplaysFrame.buttons [Details.atributos[0]+1] = {} - local title_icon = all_switch:CreateTexture (nil, "overlay") - local texture, l, r, t, b = _detalhes:GetAttributeIcon (_detalhes.atributos[0]+1) + local title_icon = allDisplaysFrame:CreateTexture (nil, "overlay") + local texture, l, r, t, b = Details:GetAttributeIcon (Details.atributos[0]+1) title_icon:SetTexture([[Interface\AddOns\Details\images\icons]]) title_icon:SetTexCoord(412/512, 441/512, 43/512, 79/512) title_icon:SetVertexColor(.7, .6, .5, 1) title_icon:SetSize(16, 16) - local title_str = all_switch:CreateFontString (nil, "overlay", "GameFontNormal") + local title_str = allDisplaysFrame:CreateFontString (nil, "overlay", "GameFontNormal") title_str:SetPoint ("left", title_icon, "right", 2, 0) title_str:SetText ("Scripts") - title_icon:SetPoint ("topleft", all_switch.x, all_switch.y) - all_switch.y = all_switch.y - 20 - all_switch.title_custom = title_icon + title_icon:SetPoint ("topleft", allDisplaysFrame.x, allDisplaysFrame.y) + allDisplaysFrame.y = allDisplaysFrame.y - 20 + allDisplaysFrame.title_custom = title_icon - all_switch.already_built = true + allDisplaysFrame.already_built = true --> prepare for plugins - all_switch.buttons[6] = {} - local title_icon = all_switch:CreateTexture(nil, "overlay") + allDisplaysFrame.buttons[6] = {} + local title_icon = allDisplaysFrame:CreateTexture(nil, "overlay") title_icon:SetTexture ([[Interface\AddOns\Details\images\modo_icones]]) title_icon:SetTexCoord (32/256*3, 32/256*4, 0, 1) title_icon:SetSize (16, 16) - local title_str = all_switch:CreateFontString(nil, "overlay", "GameFontNormal") + local title_str = allDisplaysFrame:CreateFontString(nil, "overlay", "GameFontNormal") title_str:SetPoint("left", title_icon, "right", 2, 0) title_str:SetText(Loc["STRING_OPTIONS_PLUGINS"]) - title_icon:SetPoint("topleft", all_switch.x + 130, -8) - all_switch.title_scripts = title_icon + title_icon:SetPoint("topleft", allDisplaysFrame.x + 130, -8) + allDisplaysFrame.title_scripts = title_icon end --> update scripts - local custom_index = _detalhes.atributos[0]+1 - for _, button in ipairs (all_switch.buttons [custom_index]) do + local custom_index = Details.atributos[0]+1 + for _, button in ipairs (allDisplaysFrame.buttons [custom_index]) do button:Hide() end local button_index = 1 - for i = #_detalhes.custom, 1, -1 do - local button = all_switch.buttons [custom_index] [button_index] + for i = #Details.custom, 1, -1 do + local button = allDisplaysFrame.buttons [custom_index] [button_index] if (not button) then - button = create_all_switch_button (custom_index, i, all_switch.x, all_switch.y) - tinsert (all_switch.buttons [custom_index], button) - all_switch.y = all_switch.y - 17 + button = create_all_switch_button (custom_index, i, allDisplaysFrame.x, allDisplaysFrame.y) + tinsert (allDisplaysFrame.buttons [custom_index], button) + allDisplaysFrame.y = allDisplaysFrame.y - 17 end - local custom = _detalhes.custom [i] + local custom = Details.custom [i] button.text:SetText (custom.name) - _detalhes:SetFontSize(button.text, _detalhes.all_switch_config.font_size) + Details:SetFontSize(button.text, Details.all_switch_config.font_size) - all_switch.check_text_size (button.text) + allDisplaysFrame.check_text_size (button.text) button.texture:SetTexture (custom.icon) button.texture:SetTexCoord (0.078125, 0.921875, 0.078125, 0.921875) button:Show() @@ -429,32 +317,32 @@ do button_index = button_index + 1 end - if (#_detalhes.custom > all_switch.higher_counter) then - all_switch.higher_counter = #_detalhes.custom + if (#Details.custom > allDisplaysFrame.higher_counter) then + allDisplaysFrame.higher_counter = #Details.custom end --> update plugins - local script_index = _detalhes.atributos[0]+2 + local script_index = Details.atributos[0]+2 local button_index = 1 - all_switch.x = all_switch.x + 130 - all_switch.y = -28 + allDisplaysFrame.x = allDisplaysFrame.x + 130 + allDisplaysFrame.y = -28 - for _, button in ipairs (all_switch.buttons[script_index]) do + for _, button in ipairs (allDisplaysFrame.buttons[script_index]) do button:Hide() end --build raid plugins list - local raidPlugins = _detalhes.RaidTables:GetAvailablePlugins() + local raidPlugins = Details.RaidTables:GetAvailablePlugins() if (#raidPlugins >= 0) then for i, ptable in ipairs (raidPlugins) do --if a plugin has the member 'NoMenu', it won't be shown on menus to select plugins if (ptable[3].__enabled and not ptable[3].NoMenu) then --PluginName, PluginIcon, PluginObject, PluginAbsoluteName - local button = all_switch.buttons [script_index] [button_index] + local button = allDisplaysFrame.buttons [script_index] [button_index] if (not button) then - button = create_all_switch_button(script_index, button_index, all_switch.x, all_switch.y) - tinsert (all_switch.buttons [script_index], button) - all_switch.y = all_switch.y - 17 + button = create_all_switch_button(script_index, button_index, allDisplaysFrame.x, allDisplaysFrame.y) + tinsert (allDisplaysFrame.buttons [script_index], button) + allDisplaysFrame.y = allDisplaysFrame.y - 17 end --set the button to select the plugin @@ -462,9 +350,9 @@ do button.pluginName = ptable[4] button.text:SetText(ptable[1]) - _detalhes:SetFontSize(button.text, _detalhes.all_switch_config.font_size) + Details:SetFontSize(button.text, Details.all_switch_config.font_size) - all_switch.check_text_size(button.text) + allDisplaysFrame.check_text_size(button.text) button.texture:SetTexture (ptable[2]) button.texture:SetTexCoord (0.078125, 0.921875, 0.078125, 0.921875) button:Show() @@ -474,244 +362,138 @@ do end end - --check if the plugins list is the biggest list - button_index = button_index - 1 - if (button_index > all_switch.higher_counter) then - all_switch.higher_counter = button_index - end - - all_switch:SetHeight ((all_switch.higher_counter * 17) + 20 + 16) - all_switch:SetWidth ((120 * 6) + (6 * 2) + (12*4)) - - all_switch.last_up = GetTime() - local cursor_x, cursor_y = GetCursorPosition() - all_switch.cursor_x, all_switch.cursor_y = floor (cursor_x), floor (cursor_y) - all_switch:SetScript ("OnUpdate", on_update_all_switch) - - --updated colors (these colors are set inside the janela_principal file - all_switch:SetBackdrop (_detalhes.menu_backdrop_config.menus_backdrop) - all_switch:SetBackdropColor (unpack (_detalhes.menu_backdrop_config.menus_backdropcolor)) - all_switch:SetBackdropBorderColor (unpack (_detalhes.menu_backdrop_config.menus_bordercolor)) + --check if the plugins list is the biggest list + button_index = button_index - 1 + if (button_index > allDisplaysFrame.higher_counter) then + allDisplaysFrame.higher_counter = button_index + end - all_switch:SetScale(_detalhes.all_switch_config.scale) - end) - ---------------------------------------------------------------------------------------------------------------------------- + allDisplaysFrame:SetHeight((allDisplaysFrame.higher_counter * 17) + 20 + 16) + allDisplaysFrame:SetWidth((120 * 6) + (6 * 2) + (12 * 4)) - local open_options = function() - _detalhes:OpenOptionsWindow (_detalhes.switch.current_instancia) - _detalhes.switch:CloseMe() - end - local options_button = gump:CreateButton (frame.topbg_frame, open_options, 14, 14, "") - options_button:SetPoint ("right", window_color, "left", -2, 0) - - local options_button_texture = gump:CreateImage (options_button, [[Interface\AddOns\Details\images\icons]], 14, 14, "artwork", {396/512, 428/512, 277/512, 307/512}) - options_button_texture:SetAlpha (0.55) - options_button_texture:SetAllPoints() - - options_button:SetHook ("OnEnter", function() - options_button_texture:SetAlpha (1) - GameCooltip:Reset() - _detalhes:CooltipPreset (1) - GameCooltip:SetBackdrop (1, _detalhes.tooltip_backdrop, backgroundColor, _detalhes.tooltip_border_color) - GameCooltip:AddLine (Loc ["STRING_INTERFACE_OPENOPTIONS"]) - GameCooltip:SetOwner (window_color.widget) - GameCooltip:SetType ("tooltip") - GameCooltip:Show() + allDisplaysFrame.last_up = GetTime() + local cursorX, cursorY = GetCursorPosition() + allDisplaysFrame.cursor_x, allDisplaysFrame.cursor_y = floor(cursorX), floor(cursorY) + allDisplaysFrame:SetScript("OnUpdate", on_update_all_switch) + allDisplaysFrame:SetScale(Details.all_switch_config.scale) end) - options_button:SetHook ("OnLeave", function() - options_button_texture:SetAlpha (0.55) - GameCooltip:Hide() - end) - ---------------------------------------------------------------------------------------------------------------------------- - local open_forge = function() - _detalhes:OpenForge() - _detalhes.switch:CloseMe() - end - local forge_button = gump:CreateButton (frame.topbg_frame, open_forge, 14, 14, "open forge") - forge_button:SetPoint ("right", options_button, "left", -2, 0) - - local forge_button_texture = gump:CreateImage (forge_button, [[Interface\AddOns\Details\images\icons]], 14, 14, "artwork", {396/512, 428/512, 243/512, 273/512}) - forge_button_texture:SetAlpha (0.55) - forge_button_texture:SetAllPoints() - - forge_button:SetHook ("OnEnter", function() - forge_button_texture:SetAlpha (1) - GameCooltip:Reset() - _detalhes:CooltipPreset (1) - GameCooltip:SetBackdrop (1, _detalhes.tooltip_backdrop, backgroundColor, _detalhes.tooltip_border_color) - GameCooltip:AddLine ("Open Forge") - GameCooltip:SetOwner (window_color.widget) - GameCooltip:SetType ("tooltip") - GameCooltip:Show() - end) - forge_button:SetHook ("OnLeave", function() - forge_button_texture:SetAlpha (0.55) - GameCooltip:Hide() - end) - ---------------------------------------------------------------------------------------------------------------------------- - - local open_history = function() - _detalhes:OpenRaidHistoryWindow() - _detalhes.switch:CloseMe() - end - local history_button = gump:CreateButton (frame.topbg_frame, open_history, 14, 14, "open history") - history_button:SetPoint ("right", forge_button, "left", -2, 0) - - local history_button_texture = gump:CreateImage (history_button, [[Interface\AddOns\Details\images\icons]], 14, 14, "artwork", {434/512, 466/512, 243/512, 273/512}) - history_button_texture:SetAlpha (0.55) - history_button_texture:SetAllPoints() - - history_button:SetHook ("OnEnter", function() - history_button_texture:SetAlpha (1) - GameCooltip:Reset() - _detalhes:CooltipPreset (1) - GameCooltip:SetBackdrop (1, _detalhes.tooltip_backdrop, backgroundColor, _detalhes.tooltip_border_color) - GameCooltip:AddLine ("Open History Panel") - GameCooltip:SetOwner (window_color.widget) - GameCooltip:SetType ("tooltip") - GameCooltip:Show() - end) - history_button:SetHook ("OnLeave", function() - history_button_texture:SetAlpha (0.55) - GameCooltip:Hide() - end) - - window_color:Hide() - options_button:Hide() - forge_button:Hide() - history_button:Hide() - + --------------------------------------------------------------------------------------------------------------------------- --animation has been disabled (July 2019) --they aren't called anymore on showing and hiding the bookmark frame --show animation - local animHub = _detalhes.gump:CreateAnimationHub (frame, function() frame:Show() end) - _detalhes.gump:CreateAnimation (animHub, "scale", 1, 0.04, 0, 1, 1, 1, "LEFT", 0, 0) - _detalhes.gump:CreateAnimation (animHub, "alpha", 1, 0.04, 0, 1) - frame.ShowAnimation = animHub + local animHub = Details.gump:CreateAnimationHub (bookmarkFrame, function() bookmarkFrame:Show() end) + Details.gump:CreateAnimation (animHub, "scale", 1, 0.04, 0, 1, 1, 1, "LEFT", 0, 0) + Details.gump:CreateAnimation (animHub, "alpha", 1, 0.04, 0, 1) + bookmarkFrame.ShowAnimation = animHub --hide animation - local animHub = _detalhes.gump:CreateAnimationHub (frame, function() frame:Show() end, function() frame:Hide() end) - _detalhes.gump:CreateAnimation (animHub, "scale", 1, 0.04, 1, 1, 0, 1, "RIGHT", 0, 0) - _detalhes.gump:CreateAnimation (animHub, "alpha", 1, 0.04, 1, 0) - frame.HideAnimation = animHub + local animHub = Details.gump:CreateAnimationHub (bookmarkFrame, function() bookmarkFrame:Show() end, function() bookmarkFrame:Hide() end) + Details.gump:CreateAnimation (animHub, "scale", 1, 0.04, 1, 1, 0, 1, "RIGHT", 0, 0) + Details.gump:CreateAnimation (animHub, "alpha", 1, 0.04, 1, 0) + bookmarkFrame.HideAnimation = animHub --------------------------------------------------------------------------------------------------------------------------- - - function _detalhes.switch:CloseMe() - _detalhes.switch.frame:Hide() - _detalhes.switch.frame:ClearAllPoints() - - --_detalhes.switch.frame.HideAnimation:Play() - - GameCooltip:Hide() - _detalhes.switch.frame:SetBackdropColor (0, 0, 0, .7) - _detalhes.switch.current_instancia:StatusBarAlert (nil) - _detalhes.switch.current_instancia = nil + function Details.switch:CloseMe() + Details.switch.frame:Hide() + Details.switch.frame:ClearAllPoints() + + gameCooltip:Hide() + Details.switch.current_instancia:StatusBarAlert(nil) + Details.switch.current_instancia = nil end - - --> limita��o: n�o tenho como pegar o base frame da inst�ncia por aqui - frame.close = gump:NewDetailsButton (frame, frame, _, function() end, nil, nil, 1, 1, "", "", "", "", {rightFunc = {func = _detalhes.switch.CloseMe, param1 = nil, param2 = nil}}, "DetailsSwitchPanelClose") - frame.close:SetPoint ("topleft", frame, "topleft") - frame.close:SetPoint ("bottomright", frame, "bottomright") - frame.close:SetFrameLevel (9) - frame:Hide() - - _detalhes.switch.frame = frame - _detalhes.switch.button_height = 24 + + bookmarkFrame.close = gump:NewDetailsButton(bookmarkFrame, bookmarkFrame, _, function() end, nil, nil, 1, 1, "", "", "", "", {rightFunc = {func = Details.switch.CloseMe, param1 = nil, param2 = nil}}, "DetailsSwitchPanelClose") + bookmarkFrame.close:SetPoint("topleft", bookmarkFrame, "topleft") + bookmarkFrame.close:SetPoint("bottomright", bookmarkFrame, "bottomright") + bookmarkFrame.close:SetFrameLevel(9) + bookmarkFrame:Hide() + + Details.switch.frame = bookmarkFrame + Details.switch.button_height = 24 end -_detalhes.switch.buttons = {} -_detalhes.switch.slots = _detalhes.switch.slots or 6 -_detalhes.switch.showing = 0 -_detalhes.switch.table = _detalhes.switch.table or {} -_detalhes.switch.current_instancia = nil -_detalhes.switch.current_button = nil -_detalhes.switch.height_necessary = (_detalhes.switch.button_height * _detalhes.switch.slots) / 2 +Details.switch.buttons = {} +Details.switch.slots = Details.switch.slots or 6 +Details.switch.showing = 0 +Details.switch.table = Details.switch.table or {} +Details.switch.current_instancia = nil +Details.switch.current_button = nil +Details.switch.height_necessary = (Details.switch.button_height * Details.switch.slots) / 2 -function _detalhes.switch:HideAllBookmarks() - for _, bookmark in ipairs (_detalhes.switch.buttons) do +function Details.switch:HideAllBookmarks() + for _, bookmark in ipairs(Details.switch.buttons) do bookmark:Hide() end end -function _detalhes.switch:ShowMe (instancia) - - _detalhes.switch.current_instancia = instancia +function Details.switch:ShowMe(instancia) + Details.switch.current_instancia = instancia if (IsControlKeyDown()) then - - if (not _detalhes.tutorial.ctrl_click_close_tutorial) then + if (not Details.tutorial.ctrl_click_close_tutorial) then if (not DetailsCtrlCloseWindowPanelTutorial) then - local tutorial_frame = CreateFrame ("frame", "DetailsCtrlCloseWindowPanelTutorial", _detalhes.switch.frame, "BackdropTemplate") - tutorial_frame:SetFrameStrata ("FULLSCREEN_DIALOG") - tutorial_frame:SetAllPoints() - tutorial_frame:EnableMouse (true) - tutorial_frame:SetBackdrop ({bgFile = "Interface\\AddOns\\Details\\images\\background", tile = true, tileSize = 16 }) - tutorial_frame:SetBackdropColor (0.05, 0.05, 0.05, 0.95) + local tutorialFrame = CreateFrame("frame", "DetailsCtrlCloseWindowPanelTutorial", Details.switch.frame, "BackdropTemplate") + tutorialFrame:SetFrameStrata("FULLSCREEN_DIALOG") + tutorialFrame:SetAllPoints() + tutorialFrame:EnableMouse(true) + tutorialFrame:SetBackdrop({bgFile = "Interface\\AddOns\\Details\\images\\background", tile = true, tileSize = 16 }) + tutorialFrame:SetBackdropColor(0.05, 0.05, 0.05, 0.95) - tutorial_frame.info_label = tutorial_frame:CreateFontString (nil, "overlay", "GameFontNormal") - tutorial_frame.info_label:SetPoint ("topleft", tutorial_frame, "topleft", 10, -10) - tutorial_frame.info_label:SetText (Loc ["STRING_MINITUTORIAL_CLOSECTRL1"]) - tutorial_frame.info_label:SetJustifyH ("left") - - tutorial_frame.mouse = tutorial_frame:CreateTexture (nil, "overlay") - tutorial_frame.mouse:SetTexture ([[Interface\TUTORIALFRAME\UI-TUTORIAL-FRAME]]) - tutorial_frame.mouse:SetTexCoord (0.0019531, 0.1484375, 0.6269531, 0.8222656) - tutorial_frame.mouse:SetSize (20, 22) - tutorial_frame.mouse:SetPoint ("topleft", tutorial_frame.info_label, "bottomleft", -3, -10) + tutorialFrame.info_label = tutorialFrame:CreateFontString(nil, "overlay", "GameFontNormal") + tutorialFrame.info_label:SetPoint("topleft", tutorialFrame, "topleft", 10, -10) + tutorialFrame.info_label:SetText(Loc["STRING_MINITUTORIAL_CLOSECTRL1"]) + tutorialFrame.info_label:SetJustifyH("left") - tutorial_frame.close_label = tutorial_frame:CreateFontString (nil, "overlay", "GameFontHighlightSmall") - tutorial_frame.close_label:SetPoint ("left", tutorial_frame.mouse, "right", 4, 0) - tutorial_frame.close_label:SetText (Loc ["STRING_MINITUTORIAL_CLOSECTRL2"]) - tutorial_frame.close_label:SetJustifyH ("left") - - local checkbox = CreateFrame ("CheckButton", "DetailsCtrlCloseWindowPanelTutorialCheckBox", tutorial_frame, "ChatConfigCheckButtonTemplate") - checkbox:SetPoint ("topleft", tutorial_frame.mouse, "bottomleft", -1, -5) - _G [checkbox:GetName().."Text"]:SetText (Loc ["STRING_MINITUTORIAL_BOOKMARK4"]) - - tutorial_frame:SetScript ("OnMouseDown", function() + tutorialFrame.mouse = tutorialFrame:CreateTexture(nil, "overlay") + tutorialFrame.mouse:SetTexture([[Interface\TUTORIALFRAME\UI-TUTORIAL-FRAME]]) + tutorialFrame.mouse:SetTexCoord(0.0019531, 0.1484375, 0.6269531, 0.8222656) + tutorialFrame.mouse:SetSize(20, 22) + tutorialFrame.mouse:SetPoint("topleft", tutorialFrame.info_label, "bottomleft", -3, -10) + + tutorialFrame.close_label = tutorialFrame:CreateFontString(nil, "overlay", "GameFontHighlightSmall") + tutorialFrame.close_label:SetPoint("left", tutorialFrame.mouse, "right", 4, 0) + tutorialFrame.close_label:SetText(Loc["STRING_MINITUTORIAL_CLOSECTRL2"]) + tutorialFrame.close_label:SetJustifyH("left") + + local checkbox = CreateFrame("CheckButton", "DetailsCtrlCloseWindowPanelTutorialCheckBox", tutorialFrame, "ChatConfigCheckButtonTemplate") + checkbox:SetPoint("topleft", tutorialFrame.mouse, "bottomleft", -1, -5) + _G[checkbox:GetName().."Text"]:SetText(Loc["STRING_MINITUTORIAL_BOOKMARK4"]) + + tutorialFrame:SetScript("OnMouseDown", function() if (checkbox:GetChecked()) then - _detalhes.tutorial.ctrl_click_close_tutorial = true + Details.tutorial.ctrl_click_close_tutorial = true end - - tutorial_frame:Hide() - + + tutorialFrame:Hide() if (instancia:IsEnabled()) then return instancia:ShutDown() end end) end - + DetailsCtrlCloseWindowPanelTutorial:Show() - DetailsCtrlCloseWindowPanelTutorial.info_label:SetWidth (_detalhes.switch.frame:GetWidth()-30) - DetailsCtrlCloseWindowPanelTutorial.close_label:SetWidth (_detalhes.switch.frame:GetWidth()-30) - - _detalhes.switch.frame:SetPoint ("topleft", instancia.baseframe, "topleft", 0, 1) - _detalhes.switch.frame:SetPoint ("bottomright", instancia.baseframe, "bottomright", 0, 1) - _detalhes.switch.frame:SetBackdropColor (0.094, 0.094, 0.094, .8) - _detalhes.switch.frame:Show() - + DetailsCtrlCloseWindowPanelTutorial.info_label:SetWidth(Details.switch.frame:GetWidth()-30) + DetailsCtrlCloseWindowPanelTutorial.close_label:SetWidth(Details.switch.frame:GetWidth()-30) + + Details.switch.frame:SetPoint("topleft", instancia.baseframe, "topleft", 0, 1) + Details.switch.frame:SetPoint("bottomright", instancia.baseframe, "bottomright", 0, 1) + Details.switch.frame:Show() return end - + return instancia:ShutDown() - + elseif (IsShiftKeyDown()) then - - if (not _detalhes.switch.segments_blocks) then - + if (not Details.switch.segments_blocks) then local segment_switch = function (self, button, segment) if (button == "LeftButton") then - _detalhes.switch.current_instancia:TrocaTabela (segment) - _detalhes.switch.CloseMe() + Details.switch.current_instancia:TrocaTabela (segment) + Details.switch.CloseMe() elseif (button == "RightButton") then - _detalhes.switch.CloseMe() + Details.switch.CloseMe() end end @@ -739,18 +521,18 @@ function _detalhes.switch:ShowMe (instancia) self.MyObject.boss_texture:SetBlendMode ("BLEND") end - function _detalhes.switch:CreateSegmentBlock() - local s = gump:CreateLabel (_detalhes.switch.frame) - _detalhes:SetFontSize (s, 9) + function Details.switch:CreateSegmentBlock() + local s = gump:CreateLabel (Details.switch.frame) + Details:SetFontSize (s, 9) - local index = #_detalhes.switch.segments_blocks + local index = #Details.switch.segments_blocks if (index == 1) then --overall button index = -1 elseif (index >= 2) then index = index - 1 end - local button = gump:CreateButton (_detalhes.switch.frame, segment_switch, 100, 20, "", index) + local button = gump:CreateButton (Details.switch.frame, segment_switch, 100, 20, "", index) button:SetPoint ("topleft", s, "topleft", -17, 0) button:SetPoint ("bottomright", s, "bottomright", 0, 0) button:SetClickFunction (segment_switch, nil, nil, "right") @@ -778,45 +560,45 @@ function _detalhes.switch:ShowMe (instancia) s.HideMe = hide_label s.ShowMe = show_label - tinsert (_detalhes.switch.segments_blocks, s) + tinsert (Details.switch.segments_blocks, s) return s end - function _detalhes.switch:GetSegmentBlock (index) - local block = _detalhes.switch.segments_blocks [index] + function Details.switch:GetSegmentBlock (index) + local block = Details.switch.segments_blocks [index] if (not block) then - return _detalhes.switch:CreateSegmentBlock() + return Details.switch:CreateSegmentBlock() else return block end end - function _detalhes.switch:ClearSegmentBlocks() - for _, block in ipairs (_detalhes.switch.segments_blocks) do + function Details.switch:ClearSegmentBlocks() + for _, block in ipairs (Details.switch.segments_blocks) do block:HideMe() end end - function _detalhes.switch:ResizeSegmentBlocks() + function Details.switch:ResizeSegmentBlocks() local x = 7 local y = 5 - local window_width, window_height = _detalhes.switch.current_instancia:GetSize() + local window_width, window_height = Details.switch.current_instancia:GetSize() local horizontal_amt = floor (math.max (window_width / 100, 2)) local vertical_amt = floor ((window_height - y) / 20) local size = window_width / horizontal_amt - local frame = _detalhes.switch.frame + local frame = Details.switch.frame - _detalhes.switch:ClearSegmentBlocks() + Details.switch:ClearSegmentBlocks() local i = 1 for vertical = 1, vertical_amt do x = 7 for horizontal = 1, horizontal_amt do - local button = _detalhes.switch:GetSegmentBlock (i) + local button = Details.switch:GetSegmentBlock (i) button:SetPoint ("topleft", frame, "topleft", x + 16, -y) button:SetSize (size - 22, 12) @@ -832,38 +614,38 @@ function _detalhes.switch:ShowMe (instancia) end end - _detalhes.switch.segments_blocks = {} + Details.switch.segments_blocks = {} --> current and overall - _detalhes.switch:CreateSegmentBlock() - _detalhes.switch:CreateSegmentBlock() + Details.switch:CreateSegmentBlock() + Details.switch:CreateSegmentBlock() - local block1 = _detalhes.switch:GetSegmentBlock (1) - block1:SetText (Loc ["STRING_CURRENTFIGHT"]) + local block1 = Details.switch:GetSegmentBlock (1) + block1:SetText (Loc["STRING_CURRENTFIGHT"]) block1.texture:SetTexture ([[Interface\Scenarios\ScenariosParts]]) block1.texture:SetTexCoord (55/512, 81/512, 368/512, 401/512) - local block2 = _detalhes.switch:GetSegmentBlock (2) - block2:SetText (Loc ["STRING_SEGMENT_OVERALL"]) + local block2 = Details.switch:GetSegmentBlock (2) + block2:SetText (Loc["STRING_SEGMENT_OVERALL"]) block2.texture:SetTexture ([[Interface\Scenarios\ScenariosParts]]) block2.texture:SetTexCoord (55/512, 81/512, 368/512, 401/512) end - _detalhes.switch:ClearSegmentBlocks() - _detalhes.switch:HideAllBookmarks() + Details.switch:ClearSegmentBlocks() + Details.switch:HideAllBookmarks() local segment_index = 1 - for i = 3, #_detalhes.tabela_historico.tabelas + 2 do + for i = 3, #Details.tabela_historico.tabelas + 2 do - local combat = _detalhes.tabela_historico.tabelas [segment_index] + local combat = Details.tabela_historico.tabelas [segment_index] - local block = _detalhes.switch:GetSegmentBlock (i) - local enemy, color, raid_type, killed, is_trash, portrait, background, background_coords = _detalhes:GetSegmentInfo (segment_index) + local block = Details.switch:GetSegmentBlock (i) + local enemy, color, raid_type, killed, is_trash, portrait, background, background_coords = Details:GetSegmentInfo (segment_index) block:SetText ("#" .. segment_index .. " " .. enemy) if (combat.is_boss and combat.instance_type == "raid") then - local L, R, T, B, Texture = _detalhes:GetBossIcon (combat.is_boss.mapid, combat.is_boss.index) + local L, R, T, B, Texture = Details:GetBossIcon (combat.is_boss.mapid, combat.is_boss.index) if (L) then block.texture:SetTexture (Texture) block.texture:SetTexCoord (L, R, T, B) @@ -878,23 +660,22 @@ function _detalhes.switch:ShowMe (instancia) segment_index = segment_index + 1 end - _detalhes.switch.frame:SetScale (instancia.window_scale) - _detalhes.switch:ResizeSegmentBlocks() + Details.switch.frame:SetScale (instancia.window_scale) + Details.switch:ResizeSegmentBlocks() - for i = segment_index+2, #_detalhes.switch.segments_blocks do - _detalhes.switch.segments_blocks [i]:HideMe() + for i = segment_index+2, #Details.switch.segments_blocks do + Details.switch.segments_blocks [i]:HideMe() end - _detalhes.switch.frame:SetPoint ("topleft", instancia.baseframe, "topleft", 0, 1) - _detalhes.switch.frame:SetPoint ("bottomright", instancia.baseframe, "bottomright", 0, 1) - _detalhes.switch.frame:SetBackdropColor (0.094, 0.094, 0.094, .8) - _detalhes.switch.frame:Show() + Details.switch.frame:SetPoint ("topleft", instancia.baseframe, "topleft", 0, 1) + Details.switch.frame:SetPoint ("bottomright", instancia.baseframe, "bottomright", 0, 1) + Details.switch.frame:Show() return else - if (_detalhes.switch.segments_blocks) then - _detalhes.switch:ClearSegmentBlocks() + if (Details.switch.segments_blocks) then + Details.switch:ClearSegmentBlocks() end end @@ -909,19 +690,18 @@ function _detalhes.switch:ShowMe (instancia) end end - _detalhes.switch.frame:SetPoint ("topleft", instancia.baseframe, "topleft", 0, 1) - _detalhes.switch.frame:SetPoint ("bottomright", instancia.baseframe, "bottomright", 0, 1) - _detalhes.switch.frame:SetBackdropColor (0, 0, 0, .7) - + Details.switch.frame:SetPoint ("topleft", instancia.baseframe, "topleft", 0, 1) + Details.switch.frame:SetPoint ("bottomright", instancia.baseframe, "bottomright", 0, 1) + local altura = instancia.baseframe:GetHeight() - local mostrar_quantas = _math_floor (altura / _detalhes.switch.button_height) * 2 + local mostrar_quantas = floor (altura / Details.switch.button_height) * 2 local precisa_mostrar = 0 - for i = 1, #_detalhes.switch.table do - local slot = _detalhes.switch.table [i] + for i = 1, #Details.switch.table do + local slot = Details.switch.table [i] if (not slot) then - _detalhes.switch.table [i] = {} - slot = _detalhes.switch.table [i] + Details.switch.table [i] = {} + slot = Details.switch.table [i] end if (slot.atributo) then precisa_mostrar = precisa_mostrar + 1 @@ -930,29 +710,29 @@ function _detalhes.switch:ShowMe (instancia) end end - if (_detalhes.switch.mostrar_quantas ~= mostrar_quantas) then - for i = 1, #_detalhes.switch.buttons do + if (Details.switch.mostrar_quantas ~= mostrar_quantas) then + for i = 1, #Details.switch.buttons do if (i <= mostrar_quantas) then - _detalhes.switch.buttons [i]:Show() + Details.switch.buttons [i]:Show() else - _detalhes.switch.buttons [i]:Hide() + Details.switch.buttons [i]:Hide() end end - if (#_detalhes.switch.buttons < mostrar_quantas) then - _detalhes.switch.slots = mostrar_quantas + if (#Details.switch.buttons < mostrar_quantas) then + Details.switch.slots = mostrar_quantas end - _detalhes.switch.mostrar_quantas = mostrar_quantas + Details.switch.mostrar_quantas = mostrar_quantas end - _detalhes.switch:Resize (precisa_mostrar) - _detalhes.switch:Update() + Details.switch:Resize (precisa_mostrar) + Details.switch:Update() - _detalhes.switch.frame:SetScale (instancia.window_scale) - _detalhes.switch.frame:Show() + Details.switch.frame:SetScale (instancia.window_scale) + Details.switch.frame:Show() - _detalhes.switch:Resize (precisa_mostrar) + Details.switch:Resize (precisa_mostrar) if (DetailsSwitchPanel.all_switch:IsShown()) then return DetailsSwitchPanel.all_switch:Hide() @@ -960,138 +740,125 @@ function _detalhes.switch:ShowMe (instancia) end -- ~setting -function _detalhes.switch:Config (_, _, atributo, sub_atributo) - if (not sub_atributo) then +function Details.switch:Config(_, _, atributo, sub_atributo) + if (not sub_atributo) then return end - if (type (atributo) == "string") then - --> is a plugin? - local plugin = _detalhes:GetPlugin (atributo) - if (plugin) then - _detalhes.switch.table [_detalhes.switch.editing_bookmark].atributo = "plugin" - _detalhes.switch.table [_detalhes.switch.editing_bookmark].sub_atributo = atributo + if (type(atributo) == "string") then + --is a plugin? + local plugin = Details:GetPlugin(atributo) + if(plugin) then + Details.switch.table[Details.switch.editing_bookmark].atributo = "plugin" + Details.switch.table[Details.switch.editing_bookmark].sub_atributo = atributo end else - --> is a attribute or custom script - _detalhes.switch.table [_detalhes.switch.editing_bookmark].atributo = atributo - _detalhes.switch.table [_detalhes.switch.editing_bookmark].sub_atributo = sub_atributo + --is a attribute or custom script + Details.switch.table[Details.switch.editing_bookmark].atributo = atributo + Details.switch.table[Details.switch.editing_bookmark].sub_atributo = sub_atributo end - - _detalhes.switch.editing_bookmark = nil - GameCooltip:Hide() - _detalhes.switch:Update() + + Details.switch.editing_bookmark = nil + gameCooltip:Hide() + Details.switch:Update() end ---[[global]] function DetailsChangeDisplayFromBookmark (number, instance) +--[[global]] function DetailsChangeDisplayFromBookmark(number, instance) if (not instance) then - local lower = _detalhes:GetLowerInstanceNumber() - if (lower) then - instance = _detalhes:GetInstance (lower) + local lowerInstanceId = Details:GetLowerInstanceNumber() + if (lowerInstanceId) then + instance = Details:GetInstance(lowerInstanceId) end if (not instance) then - return _detalhes:Msg (Loc ["STRING_WINDOW_NOTFOUND"]) + return Details:Msg(Loc["STRING_WINDOW_NOTFOUND"]) end end - - local bookmark = _detalhes.switch.table [number] + + local bookmark = Details.switch.table[number] if (bookmark) then - _detalhes.switch.current_instancia = instance - + Details.switch.current_instancia = instance if (not bookmark.atributo) then - return _detalhes:Msg (string.format (Loc ["STRING_SWITCH_SELECTMSG"], number)) + return Details:Msg(string.format(Loc["STRING_SWITCH_SELECTMSG"], number)) end - - _detalhes:FastSwitch (nil, bookmark, number) + + Details:FastSwitch(nil, bookmark, number) end end -function _detalhes:FastSwitch (button, bookmark, bookmark_number, select_new) +function Details:FastSwitch(button, bookmark, bookmarkNumber, selectNew) + local unknownPlugin = bookmark and bookmark.atributo == "plugin" and not Details:GetPlugin(bookmark.sub_atributo) - local UnknownPlugin = bookmark and bookmark.atributo == "plugin" and not _detalhes:GetPlugin (bookmark.sub_atributo) + if (selectNew or not bookmark.atributo or unknownPlugin) then + gameCooltip:Reset() + gameCooltip:SetOwner(button) + gameCooltip:SetType(3) + gameCooltip:SetFixedParameter(Details.switch.current_instancia) - if (select_new or not bookmark.atributo or UnknownPlugin) then - - --> monta o menu para escolher qual atributo colocar ~select - - GameCooltip:Reset() - GameCooltip:SetType (3) - GameCooltip:SetFixedParameter (_detalhes.switch.current_instancia) + Details.switch.editing_bookmark = bookmarkNumber - GameCooltip:SetOwner (button) - - _detalhes.switch.editing_bookmark = bookmark_number - - _detalhes:MontaAtributosOption (_detalhes.switch.current_instancia, _detalhes.switch.Config) - - --> build raid plugins list - GameCooltip:AddLine(Loc["STRING_MODE_PLUGINS"]) - GameCooltip:AddMenu(1, function() end, 4, true) - GameCooltip:AddIcon([[Interface\AddOns\Details\images\modo_icones]], 1, 1, 20, 20, 32/256*3, 32/256*4, 0, 1) - - local available_plugins = _detalhes.RaidTables:GetAvailablePlugins() - local amt = 0 + Details:MontaAtributosOption(Details.switch.current_instancia, Details.switch.Config) - if (#available_plugins >= 0) then - for index, ptable in ipairs (available_plugins) do - if (ptable [3].__enabled and not ptable[3].NoMenu) then - GameCooltip:AddMenu (2, _detalhes.switch.Config, _detalhes.switch.current_instancia, ptable [4], true, ptable [1], ptable [2], true) --PluginName, PluginIcon, PluginObject, PluginAbsoluteName - amt = amt + 1 - end + --build raid plugins list + gameCooltip:AddLine(Loc["STRING_MODE_PLUGINS"]) + gameCooltip:AddMenu(1, function() end, 4, true) + gameCooltip:AddIcon([[Interface\AddOns\Details\images\modo_icones]], 1, 1, 20, 20, 32/256*3, 32/256*4, 0, 1) + + local availablePlugins = Details.RaidTables:GetAvailablePlugins() + local amt = 0 + + if (#availablePlugins >= 0) then + for index, ptable in ipairs(availablePlugins) do + if (ptable [3].__enabled and not ptable[3].NoMenu) then + gameCooltip:AddMenu(2, Details.switch.Config, Details.switch.current_instancia, ptable [4], true, ptable [1], ptable [2], true) --PluginName, PluginIcon, PluginObject, PluginAbsoluteName + amt = amt + 1 end - GameCooltip:SetWallpaper (2, _detalhes.tooltip.menus_bg_texture, _detalhes.tooltip.menus_bg_coords, _detalhes.tooltip.menus_bg_color, true) end + gameCooltip:SetWallpaper(2, Details.tooltip.menus_bg_texture, Details.tooltip.menus_bg_coords, Details.tooltip.menus_bg_color, true) + end - if (#_detalhes.SoloTables.Menu > 0) then - for index, ptable in ipairs (_detalhes.SoloTables.Menu) do - if (ptable [3].__enabled and not ptable[3].NoMenu) then - GameCooltip:AddMenu (2, _detalhes.switch.Config, _detalhes.switch.current_instancia, ptable [4], true, ptable [1], ptable [2], true) - end + if (#Details.SoloTables.Menu > 0) then + for index, ptable in ipairs(Details.SoloTables.Menu) do + if (ptable [3].__enabled and not ptable[3].NoMenu) then + gameCooltip:AddMenu(2, Details.switch.Config, Details.switch.current_instancia, ptable [4], true, ptable [1], ptable [2], true) end - GameCooltip:SetWallpaper (2, _detalhes.tooltip.menus_bg_texture, _detalhes.tooltip.menus_bg_coords, _detalhes.tooltip.menus_bg_color, true) end + gameCooltip:SetWallpaper(2, Details.tooltip.menus_bg_texture, Details.tooltip.menus_bg_coords, Details.tooltip.menus_bg_color, true) + end - if (amt <= 3) then - GameCooltip:SetOption ("SubFollowButton", true) - end - - GameCooltip:SetColor (1, {.1, .1, .1, .3}) - GameCooltip:SetColor (2, {.1, .1, .1, .3}) - GameCooltip:SetOption ("HeightAnchorMod", -7) - GameCooltip:SetOption ("TextSize", _detalhes.font_sizes.menus) - GameCooltip:SetBackdrop (1, _detalhes.tooltip_backdrop, nil, _detalhes.tooltip_border_color) - GameCooltip:SetBackdrop (2, _detalhes.tooltip_backdrop, nil, _detalhes.tooltip_border_color) - return GameCooltip:ShowCooltip() + if (amt <= 3) then + gameCooltip:SetOption("SubFollowButton", true) + end + + gameCooltip:SetOption("HeightAnchorMod", -7) + gameCooltip:SetOption("TextSize", Details.font_sizes.menus) + return gameCooltip:ShowCooltip() end if (IsShiftKeyDown()) then - --> get a closed window or created a new one. - local instance = _detalhes:CreateInstance() - + --get a closed window or created a new one + local instance = Details:CreateInstance() if (not instance) then - _detalhes.switch.CloseMe() - return _detalhes:Msg (Loc ["STRING_WINDOW_NOTFOUND"]) + Details.switch.CloseMe() + return Details:Msg(Loc["STRING_WINDOW_NOTFOUND"]) end - - _detalhes.switch.current_instancia = instance + Details.switch.current_instancia = instance end - if (_detalhes.switch.current_instancia.modo == _detalhes._detalhes_props["MODO_ALONE"]) then - _detalhes.switch.current_instancia:AlteraModo (_detalhes.switch.current_instancia, 2) - elseif (_detalhes.switch.current_instancia.modo == _detalhes._detalhes_props["MODO_RAID"]) then - _detalhes.switch.current_instancia:AlteraModo (_detalhes.switch.current_instancia, 2) + if (Details.switch.current_instancia.modo == Details._detalhes_props["MODO_ALONE"]) then + Details.switch.current_instancia:AlteraModo (Details.switch.current_instancia, 2) + + elseif (Details.switch.current_instancia.modo == Details._detalhes_props["MODO_RAID"]) then + Details.switch.current_instancia:AlteraModo (Details.switch.current_instancia, 2) end - + if (bookmark.atributo == "plugin") then - - --> is a plugin, check if is a raid or solo plugin - if (_detalhes.RaidTables.NameTable [bookmark.sub_atributo]) then - - local raidPlugins = _detalhes.RaidTables:GetAvailablePlugins() + --is a plugin, check if is a raid or solo plugin + if (Details.RaidTables.NameTable [bookmark.sub_atributo]) then + local raidPlugins = Details.RaidTables:GetAvailablePlugins() local isAvailable = false if (#raidPlugins >= 0) then - for i, ptable in ipairs (raidPlugins) do + for i, ptable in ipairs(raidPlugins) do --check if the plugin is available if (ptable[4] == bookmark.sub_atributo) then isAvailable = true @@ -1100,88 +867,79 @@ function _detalhes:FastSwitch (button, bookmark, bookmark_number, select_new) end if (isAvailable) then - _detalhes.RaidTables:EnableRaidMode (_detalhes.switch.current_instancia, bookmark.sub_atributo) + Details.RaidTables:EnableRaidMode(Details.switch.current_instancia, bookmark.sub_atributo) else Details:Msg("plugin already in use in another window. If you are wondering where, check the Orange Gear > Window Control.") --localize-me end - elseif (_detalhes.SoloTables.NameTable [bookmark.sub_atributo]) then - _detalhes.SoloTables:EnableSoloMode (_detalhes.switch.current_instancia, bookmark.sub_atributo) + elseif (Details.SoloTables.NameTable [bookmark.sub_atributo]) then + Details.SoloTables:EnableSoloMode(Details.switch.current_instancia, bookmark.sub_atributo) else - _detalhes:Msg ("Plugin not found.") + Details:Msg("Plugin not found.") end else - _detalhes.switch.current_instancia:TrocaTabela (_detalhes.switch.current_instancia, true, bookmark.atributo, bookmark.sub_atributo) + Details.switch.current_instancia:TrocaTabela(Details.switch.current_instancia, true, bookmark.atributo, bookmark.sub_atributo) end - _detalhes.switch.CloseMe() + Details.switch.CloseMe() end --- nao tem suporte a solo mode tank mode --- nao tem suporte a custom at� agora, n�o sei como vai ficar - -function _detalhes.switch:InitSwitch() - local instancia = _detalhes.tabela_instancias [1] - _detalhes.switch:ShowMe (instancia) - _detalhes.switch:CloseMe() - --return _detalhes.switch:Update() +function Details.switch:InitSwitch() + local instancia = Details.tabela_instancias[1] + Details.switch:ShowMe (instancia) + Details.switch:CloseMe() end -function _detalhes.switch:OnRemoveCustom (CustomIndex) - for i = 1, _detalhes.switch.slots do - local options = _detalhes.switch.table [i] - if (options and options.atributo == 5 and options.sub_atributo == CustomIndex) then - --> precisa resetar esse aqui +function Details.switch:OnRemoveCustom(customIndex) + for i = 1, Details.switch.slots do + local options = Details.switch.table[i] + if (options and options.atributo == 5 and options.sub_atributo == customIndex) then options.atributo = nil options.sub_atributo = nil - --update if already shown once at least - if (_detalhes.switch.vertical_amt) then - _detalhes.switch:Update() + if (Details.switch.vertical_amt) then + Details.switch:Update() end end end end local default_coords = {5/64, 59/64, 5/64, 59/64} -local unknown_coords = {157/512, 206/512, 39/512, 89/512} local vertex_color_default = {1, 1, 1} local vertex_color_unknown = {1, 1, 1} local add_coords = {464/512, 473/512, 1/512, 11/512} -function _detalhes.switch:Update() - - if (not _detalhes.switch.vertical_amt) then - --wasn't opened yet, so doesn't matter if we update or not. +function Details.switch:Update() + if (not Details.switch.vertical_amt) then + --wasn't opened yet, so doesn't matter if we update or not return end - local slots = _detalhes.switch.slots + local slots = Details.switch.slots local x = 10 local y = 5 local jump = false local hide_the_rest - - local offset = FauxScrollFrame_GetOffset (DetailsSwitchPanelScroll) - local slots_shown = _detalhes.switch.slots - - for i = 1, slots_shown do + local offset = FauxScrollFrame_GetOffset(DetailsSwitchPanelScroll) + local slots_shown = Details.switch.slots + + for i = 1, slots_shown do --bookmark index - local index = (offset * _detalhes.switch.vertical_amt) + i + local index = (offset * Details.switch.vertical_amt) + i --button - local button = _detalhes.switch.buttons [i] + local button = Details.switch.buttons [i] if (not button) then - button = _detalhes.switch:NewSwitchButton (_detalhes.switch.frame, i, x, y, jump) - button:SetFrameLevel (_detalhes.switch.frame:GetFrameLevel()+2) - _detalhes.switch.showing = _detalhes.switch.showing + 1 + button = Details.switch:NewSwitchButton (Details.switch.frame, i, x, y, jump) + button:SetFrameLevel (Details.switch.frame:GetFrameLevel()+2) + Details.switch.showing = Details.switch.showing + 1 end - local options = _detalhes.switch.table [index] + local options = Details.switch.table [index] if (not options and index <= 40) then options = {} - _detalhes.switch.table [index] = options + Details.switch.table [index] = options end button.bookmark_number = index --button on icon @@ -1196,11 +954,11 @@ function _detalhes.switch:Update() if (options and options.sub_atributo) then if (options.atributo == 5) then --> custom - local CustomObject = _detalhes.custom [options.sub_atributo] + local CustomObject = Details.custom [options.sub_atributo] if (not CustomObject) then --> ele j� foi deletado icone = [[Interface\AddOns\Details\images\icons]] coords = add_coords - name = Loc ["STRING_SWITCH_CLICKME"] + name = Loc["STRING_SWITCH_CLICKME"] vcolor = vertex_color_unknown add = true else @@ -1212,10 +970,10 @@ function _detalhes.switch:Update() elseif (options.atributo == "plugin") then --> plugin - local plugin = _detalhes:GetPlugin (options.sub_atributo) + local plugin = Details:GetPlugin (options.sub_atributo) if (plugin) then - local raidPlugins = _detalhes.RaidTables:GetAvailablePlugins() + local raidPlugins = Details.RaidTables:GetAvailablePlugins() local isAvailable = false if (#raidPlugins >= 0) then for i, ptable in ipairs (raidPlugins) do @@ -1239,402 +997,303 @@ function _detalhes.switch:Update() else icone = [[Interface\AddOns\Details\images\icons]] coords = add_coords - name = Loc ["STRING_SWITCH_CLICKME"] + name = Loc["STRING_SWITCH_CLICKME"] vcolor = vertex_color_unknown add = true end else - icone = _detalhes.sub_atributos [options.atributo].icones [options.sub_atributo] [1] - coords = _detalhes.sub_atributos [options.atributo].icones [options.sub_atributo] [2] - name = _detalhes.sub_atributos [options.atributo].lista [options.sub_atributo] + icone = Details.sub_atributos [options.atributo].icones [options.sub_atributo] [1] + coords = Details.sub_atributos [options.atributo].icones [options.sub_atributo] [2] + name = Details.sub_atributos [options.atributo].lista [options.sub_atributo] vcolor = vertex_color_default end else icone = [[Interface\AddOns\Details\images\icons]] coords = add_coords - name = Loc ["STRING_SWITCH_CLICKME"] + name = Loc["STRING_SWITCH_CLICKME"] vcolor = vertex_color_unknown add = true end button:Show() button.button2:Show() - button.fundo:Show() local width, height = button.button2.texto:GetSize() - button.button2.texto:SetWidth (300) - button.button2.texto:SetText (name) + button.button2.texto:SetWidth(300) + button.button2.texto:SetText(name) local text_width = button.button2.texto:GetStringWidth() - while (text_width > _detalhes.switch.text_size) do - _detalhes:SetFontSize (button.button2.texto, _detalhes.bookmark_text_size) + + while (text_width > Details.switch.text_size) do + Details:SetFontSize(button.button2.texto, Details.bookmark_text_size) local text = button.button2.texto:GetText() - text = strsub (text, 1, #text-1) - button.button2.texto:SetText (text) + text = strsub(text, 1, #text-1) + button.button2.texto:SetText(text) text_width = button.button2.texto:GetStringWidth() end - - button.button2.texto:SetSize (width, height) + + button.button2.texto:SetSize(width, height) DetailsFramework:SetFontColor(button.button2.texto, textColor) - - button.textureNormal:SetTexture (icone, true) - button.textureNormal:SetTexCoord (_unpack (coords)) - button.textureNormal:SetVertexColor (_unpack (vcolor)) - button.texturePushed:SetTexture (icone, true) - button.texturePushed:SetTexCoord (_unpack (coords)) - button.texturePushed:SetVertexColor (_unpack (vcolor)) - button.textureH:SetTexture (icone, true) - button.textureH:SetVertexColor (_unpack (vcolor)) - button.textureH:SetTexCoord (_unpack (coords)) - button:ChangeIcon (button.textureNormal, button.texturePushed, nil, button.textureH) + + button.textureNormal:SetTexture(icone, true) + button.textureNormal:SetTexCoord(unpack(coords)) + button.textureNormal:SetVertexColor(unpack(vcolor)) + button.texturePushed:SetTexture(icone, true) + button.texturePushed:SetTexCoord(unpack(coords)) + button.texturePushed:SetVertexColor(unpack(vcolor)) + button.textureH:SetTexture(icone, true) + button.textureH:SetVertexColor(unpack(vcolor)) + button.textureH:SetTexCoord(unpack(coords)) + button:ChangeIcon(button.textureNormal, button.texturePushed, nil, button.textureH) if (add) then - button:SetSize (12, 12) + button:SetSize(12, 12) else - button:SetSize (15, 15) + button:SetSize(15, 15) end - - if (name == Loc ["STRING_SWITCH_CLICKME"]) then - --button.button2.texto:SetTextColor (.3, .3, .3, 1) - button:SetAlpha (0.3) - button.textureNormal:SetDesaturated (true) - button.button2.texto:SetPoint ("left", button, "right", 5, -1) + + if (name == Loc["STRING_SWITCH_CLICKME"]) then + button:SetAlpha(0.3) + button.textureNormal:SetDesaturated(true) + button.button2.texto:SetPoint("left", button, "right", 5, -1) else - --button.button2.texto:SetTextColor (.8, .8, .8, 1) - button:SetAlpha (1) - button.textureNormal:SetDesaturated (false) - button.button2.texto:SetPoint ("left", button, "right", 3, -1) + button:SetAlpha(1) + button.textureNormal:SetDesaturated(false) + button.button2.texto:SetPoint("left", button, "right", 3, -1) end - - if (jump) then + + if (jump) then x = x - 125 - y = y + _detalhes.switch.button_height + y = y + Details.switch.button_height jump = false else x = x + 1254 jump = true end - + end - - FauxScrollFrame_Update (DetailsSwitchPanelScroll, ceil (40 / _detalhes.switch.vertical_amt) , _detalhes.switch.horizontal_amt, 20) + + FauxScrollFrame_Update(DetailsSwitchPanelScroll, ceil (40 / Details.switch.vertical_amt) , Details.switch.horizontal_amt, 20) end local scroll = CreateFrame ("scrollframe", "DetailsSwitchPanelScroll", DetailsSwitchPanel, "FauxScrollFrameTemplate") scroll:SetAllPoints() -scroll:SetScript ("OnVerticalScroll", function (self, offset) FauxScrollFrame_OnVerticalScroll (self, offset, 20, _detalhes.switch.Update) end) --altura +scroll:SetScript ("OnVerticalScroll", function (self, offset) FauxScrollFrame_OnVerticalScroll (self, offset, 20, Details.switch.Update) end) --altura scroll.ScrollBar:Hide() scroll.ScrollBar.ScrollUpButton:Hide() scroll.ScrollBar.ScrollDownButton:Hide() -function _detalhes.switch:Resize (precisa_mostrar) - - local x, x_original = 5, 5 +function Details.switch:Resize() + local x, xOriginal = 5, 5 local y = 5 - local y_increment = 18 - - local window_width, window_height = _detalhes.switch.current_instancia:GetSize() - - local horizontal_amt = floor (math.max (window_width / 100, 2)) - local vertical_amt = floor ((window_height - y) / y_increment) - - local total_amt = horizontal_amt * vertical_amt - if (precisa_mostrar > total_amt) then - --vertical_amt = floor ((window_height - y) / 15) - --y_increment = 15 - end - - _detalhes.switch.y_increment = y_increment - - local size = window_width / horizontal_amt - local frame = _detalhes.switch.frame - - for index, button in ipairs (_detalhes.switch.buttons) do + local incrementY = 18 + local windowWidth, windowHeight = Details.switch.current_instancia:GetSize() + + local horizontalAmt = floor(math.max(windowWidth / 100, 2)) + local verticalAmt = floor((windowHeight - y) / incrementY) + + Details.switch.y_increment = incrementY + local size = windowWidth / horizontalAmt + local bookmarkFrame = Details.switch.frame + + for index, button in ipairs(Details.switch.buttons) do button:Hide() end - - _detalhes.switch.vertical_amt = vertical_amt - _detalhes.switch.horizontal_amt = horizontal_amt - - _detalhes.switch.text_size = size - 30 - + + Details.switch.vertical_amt = verticalAmt + Details.switch.horizontal_amt = horizontalAmt + Details.switch.text_size = size - 30 + local i = 1 - for vertical = 1, vertical_amt do - x = x_original - for horizontal = 1, horizontal_amt do - local button = _detalhes.switch.buttons [i] - - local options = _detalhes.switch.table [i] - if (not options) then + for vertical = 1, verticalAmt do + x = xOriginal + for horizontal = 1, horizontalAmt do + local button = Details.switch.buttons[i] + local options = Details.switch.table[i] + + if (not options) then options = {atributo = nil, sub_atributo = nil} - _detalhes.switch.table [i] = options + Details.switch.table[i] = options end - + if (not button) then - button = _detalhes.switch:NewSwitchButton (frame, i, x, y) - button:SetFrameLevel (frame:GetFrameLevel()+2) - _detalhes.switch.showing = _detalhes.switch.showing + 1 + button = Details.switch:NewSwitchButton(bookmarkFrame, i, x, y) + button:SetFrameLevel(bookmarkFrame:GetFrameLevel()+2) + Details.switch.showing = Details.switch.showing + 1 end - - button:SetPoint ("topleft", frame, "topleft", x, -y) - button.textureNormal:SetPoint ("topleft", frame, "topleft", x, -y) - button.texturePushed:SetPoint ("topleft", frame, "topleft", x, -y) - button.textureH:SetPoint ("topleft", frame, "topleft", x, -y) - button.button2.texto:SetSize (size - 30, 12) - button.button2:SetPoint ("bottomright", button, "bottomright", size - 30, 0) - button.line:SetWidth (size - 15) - button.line2:SetWidth (size - 15) - + + button:SetPoint("topleft", bookmarkFrame, "topleft", x, -y) + button.textureNormal:SetPoint("topleft", bookmarkFrame, "topleft", x, -y) + button.texturePushed:SetPoint("topleft", bookmarkFrame, "topleft", x, -y) + button.textureH:SetPoint("topleft", bookmarkFrame, "topleft", x, -y) + button.button2.texto:SetSize(size - 30, 12) + button.button2:SetPoint("bottomright", button, "bottomright", size - 30, 0) button:Show() - + i = i + 1 x = x + size if (i > 40) then break end end - y = y + y_increment + 2 + y = y + incrementY + 2 end - - _detalhes.switch.slots = i-1 - + + Details.switch.slots = i - 1 end -function _detalhes.switch:Resize2() +local bookmarkButtonBodyOnEnter = function(self) + if (not Details.switch.table[self.id].atributo) then + gameCooltip:Reset() + gameCooltip:SetOwner(self) - local x = 7 - local y = 5 - local xPlus = (_detalhes.switch.current_instancia:GetSize()/2)-5 - local frame = _detalhes.switch.frame - - for index, button in ipairs (_detalhes.switch.buttons) do - - if (button.rightButton) then - button:SetPoint ("topleft", frame, "topleft", x, -y) - button.textureNormal:SetPoint ("topleft", frame, "topleft", x, -y) - button.texturePushed:SetPoint ("topleft", frame, "topleft", x, -y) - button.textureH:SetPoint ("topleft", frame, "topleft", x, -y) - button.button2.texto:SetSize (xPlus - 30, 12) - button.button2:SetPoint ("bottomright", button, "bottomright", xPlus - 30, 0) - button.line:SetWidth (xPlus - 15) - button.line2:SetWidth (xPlus - 15) - - x = x - xPlus - y = y + _detalhes.switch.button_height - jump = false - else - button:SetPoint ("topleft", frame, "topleft", x, -y) - button.textureNormal:SetPoint ("topleft", frame, "topleft", x, -y) - button.texturePushed:SetPoint ("topleft", frame, "topleft", x, -y) - button.textureH:SetPoint ("topleft", frame, "topleft", x, -y) - button.button2.texto:SetSize (xPlus - 30, 12) - button.button2:SetPoint ("topleft", button, "topright", 1, 0) - button.button2:SetPoint ("bottomright", button, "bottomright", xPlus - 30, 0) - button.line:SetWidth (xPlus - 20) - button.line2:SetWidth (xPlus - 20) - - x = x + xPlus - jump = true - end - - end -end + gameCooltip:SetOption("TextSize", 10) + gameCooltip:SetOption("ButtonsYMod", 0) + gameCooltip:SetOption("YSpacingMod", 0) + gameCooltip:SetOption("IgnoreButtonAutoHeight", false) -local onenter = function (self) - if (not _detalhes.switch.table [self.id].atributo) then - GameCooltip:Reset() - _detalhes:CooltipPreset (1) - GameCooltip:AddLine (Loc["STRING_SWITCH_CLICKME"]) --add bookmark - GameCooltip:AddIcon ([[Interface\Glues\CharacterSelect\Glues-AddOn-Icons]], 1, 1, 16, 16, 0.75, 1, 0, 1, {0, 1, 0}) - - GameCooltip:SetOwner (self) - GameCooltip:SetType ("tooltip") - - GameCooltip:SetOption ("TextSize", 10) - GameCooltip:SetOption ("ButtonsYMod", 0) - GameCooltip:SetOption ("YSpacingMod", 0) - GameCooltip:SetOption ("IgnoreButtonAutoHeight", false) - - GameCooltip:SetBackdrop (1, _detalhes.tooltip_backdrop, backgroundColor, _detalhes.tooltip_border_color) - GameCooltip:SetBackdrop (2, _detalhes.tooltip_backdrop, backgroundColor, _detalhes.tooltip_border_color) - - GameCooltip:Show() + gameCooltip:AddLine(Loc["STRING_SWITCH_CLICKME"]) --add bookmark + gameCooltip:AddIcon([[Interface\Glues\CharacterSelect\Glues-AddOn-Icons]], 1, 1, 16, 16, 0.75, 1, 0, 1, {0, 1, 0}) + gameCooltip:Show() else - GameCooltip:Hide() + gameCooltip:Hide() end - _detalhes:SetFontColor (self.texto, "orange") - --self.border:SetBlendMode ("ADD") - --self.button1_icon:SetBlendMode ("ADD") - - DetailsSwitchPanel.hover_over_texture:SetSize (self:GetWidth(), self:GetHeight()) --size of button - DetailsSwitchPanel.hover_over_texture:ClearAllPoints() - DetailsSwitchPanel.hover_over_texture:SetPoint ("topleft", self, "topleft", -18, 1) - DetailsSwitchPanel.hover_over_texture:SetPoint ("bottomright", self, "bottomright", 8, -1) - DetailsSwitchPanel.hover_over_texture:Show() - + Details:SetFontColor(self.texto, "orange") + + DetailsSwitchPanel.hoverOverTexture:SetSize(self:GetWidth(), self:GetHeight()) --size of button + DetailsSwitchPanel.hoverOverTexture:ClearAllPoints() + DetailsSwitchPanel.hoverOverTexture:SetPoint("topleft", self, "topleft", -18, 1) + DetailsSwitchPanel.hoverOverTexture:SetPoint("bottomright", self, "bottomright", 8, -1) + DetailsSwitchPanel.hoverOverTexture:Show() end -local onleave = function (self) - if (GameCooltip:IsTooltip()) then - GameCooltip:Hide() +local bookmarkButtonBodyOnLeave = function(self) + if (gameCooltip:IsTooltip()) then + gameCooltip:Hide() end - self.texto:SetTextColor (.9, .9, .9, .9) - self.border:SetBlendMode ("BLEND") - self.button1_icon:SetBlendMode ("BLEND") + self.texto:SetTextColor(.9, .9, .9, .9) + self.button1_icon:SetBlendMode("BLEND") end -local oniconenter = function (self) - - if (GameCooltip:IsMenu()) then +local bookmarkButtonIconOnEnter = function(self) + if (gameCooltip:IsMenu()) then return end - GameCooltip:Reset() - _detalhes:CooltipPreset (1) - GameCooltip:AddLine ("select bookmark") - GameCooltip:AddIcon ([[Interface\TUTORIALFRAME\UI-TUTORIAL-FRAME]], 1, 1, 12, 14, 0.0019531, 0.1484375, 0.6269531, 0.8222656) - - GameCooltip:SetOwner (self) - GameCooltip:SetType ("tooltip") - - GameCooltip:SetOption ("TextSize", 10) - GameCooltip:SetOption ("ButtonsYMod", 0) - GameCooltip:SetOption ("YSpacingMod", 0) - GameCooltip:SetOption ("IgnoreButtonAutoHeight", false) - - GameCooltip:SetBackdrop (1, _detalhes.tooltip_backdrop, backgroundColor, _detalhes.tooltip_border_color) - - _detalhes:SetFontColor (self.texto, "orange") - - GameCooltip:Show() + gameCooltip:Reset() + gameCooltip:SetOwner(self) + + gameCooltip:AddLine("select bookmark") + gameCooltip:AddIcon([[Interface\TUTORIALFRAME\UI-TUTORIAL-FRAME]], 1, 1, 12, 14, 0.0019531, 0.1484375, 0.6269531, 0.8222656) + + gameCooltip:SetOption("TextSize", 10) + gameCooltip:SetOption("ButtonsYMod", 0) + gameCooltip:SetOption("YSpacingMod", 0) + gameCooltip:SetOption("IgnoreButtonAutoHeight", false) + + Details:SetFontColor(self.texto, "orange") + gameCooltip:Show() end -local oniconleave = function (self) - if (GameCooltip:IsTooltip()) then - GameCooltip:Hide() +local bookmarkButtonIconOnLeave = function(self) + if (gameCooltip:IsTooltip()) then + gameCooltip:Hide() end - - self.texto:SetTextColor (.9, .9, .9, .9) + self.texto:SetTextColor(.9, .9, .9, .9) end -local left_box_on_click = function (self, button) +local bookmarkButtonIconOnClick = function(self, button) if (button == "RightButton") then --select another bookmark - _detalhes:FastSwitch (self, nil, self.bookmark_number, true) + Details:FastSwitch(self, nil, self.bookmark_number, true) else --change the display - local bookmark = _detalhes.switch.table [self.bookmark_number] + local bookmark = Details.switch.table[self.bookmark_number] if (bookmark.atributo) then - _detalhes:FastSwitch (self, bookmark, self.bookmark_number) + Details:FastSwitch(self, bookmark, self.bookmark_number) else --invalid bookmark, select another bookmark - _detalhes:FastSwitch (self, bookmark, self.bookmark_number, true) + Details:FastSwitch(self, bookmark, self.bookmark_number, true) end end end -local right_box_on_click = function (self, button) +local bookmarkButtonBodyOnClick = function(self, button) if (button == "RightButton") then --close the bookmark menu - _detalhes.switch:CloseMe() + Details.switch:CloseMe() else --change the display - local bookmark = _detalhes.switch.table [self.bookmark_number] + local bookmark = Details.switch.table[self.bookmark_number] if (bookmark.atributo) then - _detalhes:FastSwitch (self, bookmark, self.bookmark_number) + Details:FastSwitch(self, bookmark, self.bookmark_number) else --invalid bookmark, select another bookmark - _detalhes:FastSwitch (self, bookmark, self.bookmark_number, true) + Details:FastSwitch(self, bookmark, self.bookmark_number, true) end end end -local change_icon = function (self, icon1, icon2, icon3, icon4) - self:SetNormalTexture (icon1 or "") - self:SetPushedTexture (icon2 or "") - self:SetDisabledTexture (icon3 or "") - self:SetHighlightTexture (icon4 or "", "ADD") -end - -function _detalhes.switch:NewSwitchButton (frame, index, x, y, rightButton) - --botao dentro da caixa - local button = CreateFrame ("button", "DetailsSwitchPanelButton_1_"..index, frame, "BackdropTemplate") --botao com o icone - button:SetSize (15, 24) - button:SetPoint ("topleft", frame, "topleft", x, -y) - button:SetScript ("OnMouseDown", left_box_on_click) - button:SetScript ("OnEnter", oniconenter) - button:SetScript ("OnLeave", oniconleave) - button.ChangeIcon = change_icon - button.id = index - - --borda - button.fundo = button:CreateTexture (nil, "overlay") - button.fundo:SetTexCoord (0.00390625, 0.27734375, 0.44140625,0.69531250) - button.fundo:SetWidth (26) - button.fundo:SetHeight (24) - button.fundo:SetPoint ("topleft", button, "topleft", -5, 5) - - --fundo marrom - local fundo_x = -3 - local fundo_y = -5 - button.line = button:CreateTexture (nil, "background") - button.line:SetTexCoord (0.31250000, 0.96484375, 0.37109375, 0.52343750) - button.line:SetWidth (85) - button.line:SetPoint ("topleft", button, "topright", fundo_x-14, 0) - button.line:SetPoint ("bottomleft", button, "bottomright", fundo_x, fundo_y) - button.line:SetAlpha (0.6) - - --fundo marrom 2 - button.line2 = button:CreateTexture (nil, "background") - button.line2:SetTexCoord (0.31250000, 0.96484375, 0.37109375, 0.52343750) - button.line2:SetWidth (85) - button.line2:SetPoint ("topleft", button, "topright", fundo_x, 0) - button.line2:SetPoint ("bottomleft", button, "bottomright", fundo_x, fundo_y) - - --botao do fundo marrom - local button2 = CreateFrame ("button", "DetailsSwitchPanelButton_2_"..index, button, "BackdropTemplate") --botao com o texto - button2:SetSize (1, 1) - button2:SetPoint ("topleft", button, "topright", 1, 0) - button2:SetPoint ("bottomright", button, "bottomright", 90, 0) - button2:SetScript ("OnMouseDown", right_box_on_click) - button2:SetScript ("OnEnter", onenter) - button2:SetScript ("OnLeave", onleave) - button2.id = index - - button.button2 = button2 - - --icone - button.textureNormal = button:CreateTexture (nil, "background") - button.textureNormal:SetAllPoints (button) - - --icone pushed - button.texturePushed = button:CreateTexture (nil, "background") - button.texturePushed:SetAllPoints (button) - - --highlight - button.textureH = button:CreateTexture (nil, "background") - button.textureH:SetAllPoints (button) - - --texto do atributo - gump:NewLabel (button2, button2, nil, "texto", "", "GameFontNormal") - button2.texto:SetPoint ("left", button, "right", 5, -1) - button2.texto:SetTextColor (.9, .9, .9, .9) - - _detalhes:SetFontSize (button2.texto, _detalhes.bookmark_text_size) - - button.texto = button2.texto - - button2.button1_icon = button.textureNormal - button2.button1_icon2 = button.texturePushed - button2.button1_icon3 = button.textureH - button2.border = button.fundo - - button2.MouseOnEnterHook = onenter - button2.MouseOnLeaveHook = onleave - - _detalhes.switch.buttons [index] = button - - return button +local changeIconFunc = function(self, icon1, icon2, icon3, icon4) + self:SetNormalTexture(icon1 or "") + self:SetPushedTexture(icon2 or "") + self:SetDisabledTexture(icon3 or "") + self:SetHighlightTexture(icon4 or "", "ADD") +end + +function Details.switch:NewSwitchButton(frame, index, x, y, rightButton) + local newSwitchButton = CreateFrame("button", "DetailsSwitchPanelButton_1_" .. index, frame, "BackdropTemplate") + newSwitchButton:SetSize(15, 24) + newSwitchButton:SetPoint("topleft", frame, "topleft", x, -y) + newSwitchButton:SetScript("OnMouseDown", bookmarkButtonIconOnClick) + newSwitchButton:SetScript("OnEnter", bookmarkButtonIconOnEnter) + newSwitchButton:SetScript("OnLeave", bookmarkButtonIconOnLeave) + newSwitchButton.ChangeIcon = changeIconFunc + newSwitchButton.id = index + + local backgroundTexture = DetailsFramework:CreateTexture(newSwitchButton, {gradient = "vertical", fromColor = {0, 0, 0, 0.3}, toColor = "transparent"}, 1, 1, "artwork", {0, 1, 0, 1}) + backgroundTexture:SetAllPoints() + + local button2 = CreateFrame("button", "DetailsSwitchPanelButton_2_" .. index, newSwitchButton, "BackdropTemplate") + button2:SetSize(1, 1) + button2:SetPoint("topleft", newSwitchButton, "topright", 1, 0) + button2:SetPoint("bottomright", newSwitchButton, "bottomright", 90, 0) + button2:SetScript("OnMouseDown", bookmarkButtonBodyOnClick) + button2:SetScript("OnEnter", bookmarkButtonBodyOnEnter) + button2:SetScript("OnLeave", bookmarkButtonBodyOnLeave) + button2.id = index + newSwitchButton.button2 = button2 + + --icon + newSwitchButton.textureNormal = newSwitchButton:CreateTexture(nil, "background") + newSwitchButton.textureNormal:SetAllPoints() + + --icon pushed + newSwitchButton.texturePushed = newSwitchButton:CreateTexture(nil, "background") + newSwitchButton.texturePushed:SetAllPoints() + + --highlight + newSwitchButton.textureH = newSwitchButton:CreateTexture(nil, "background") + newSwitchButton.textureH:SetAllPoints() + + --text + gump:NewLabel(button2, button2, nil, "texto", "", "GameFontNormal") + button2.texto:SetPoint("left", newSwitchButton, "right", 5, -1) + button2.texto:SetTextColor(.9, .9, .9, 1) + + Details:SetFontSize(button2.texto, Details.bookmark_text_size) + + newSwitchButton.texto = button2.texto + + button2.button1_icon = newSwitchButton.textureNormal + button2.button1_icon2 = newSwitchButton.texturePushed + button2.button1_icon3 = newSwitchButton.textureH + + button2.MouseOnEnterHook = bookmarkButtonBodyOnEnter + button2.MouseOnLeaveHook = bookmarkButtonBodyOnLeave + + Details.switch.buttons[index] = newSwitchButton + return newSwitchButton end