- fixed issue with panic mode where sometimes his effects isn't triggered.
- added new small tutorial bubles for common tasks. - tutorials now are account wide and not trigger on new characters. - small improvements on details framework. - added new hook type: HOOK_BUFF, triggered with buff or debuff parser. - new skin: simple gray. - added a minimap button and a button on addons interface panel. new Api: instance:LockInstance (boolean)
This commit is contained in:
+36
-2
@@ -189,6 +189,19 @@ local ButtonMetaFunctions = {}
|
||||
return
|
||||
end
|
||||
end
|
||||
--> text align
|
||||
local smember_textalign = function (_object, _value)
|
||||
if (_value == "left" or _value == "<") then
|
||||
_object.button.text:SetPoint ("left", _object.button, "left", 2, 0)
|
||||
_object.capsule_textalign = "left"
|
||||
elseif (_value == "center" or _value == "|") then
|
||||
_object.button.text:SetPoint ("center", _object.button, "center", 0, 0)
|
||||
_object.capsule_textalign = "center"
|
||||
elseif (_value == "right" or _value == ">") then
|
||||
_object.button.text:SetPoint ("right", _object.button, "right", -2, 0)
|
||||
_object.capsule_textalign = "right"
|
||||
end
|
||||
end
|
||||
|
||||
local set_members_function_index = {
|
||||
["tooltip"] = smember_tooltip,
|
||||
@@ -203,6 +216,7 @@ local ButtonMetaFunctions = {}
|
||||
["textsize"] = smember_textsize,
|
||||
["texture"] = smember_texture,
|
||||
["locked"] = smember_locked,
|
||||
["textalign"] = smember_textalign,
|
||||
}
|
||||
|
||||
ButtonMetaFunctions.__newindex = function (_table, _key, _value)
|
||||
@@ -540,7 +554,17 @@ local ButtonMetaFunctions = {}
|
||||
end
|
||||
end
|
||||
|
||||
button.text:SetPoint ("center", button,"center", 1, -1)
|
||||
if (button.MyObject.capsule_textalign) then
|
||||
if (button.MyObject.capsule_textalign == "left") then
|
||||
button.text:SetPoint ("left", button, "left", 3, -1)
|
||||
elseif (button.MyObject.capsule_textalign == "center") then
|
||||
button.text:SetPoint ("center", button, "center", 1, -1)
|
||||
elseif (button.MyObject.capsule_textalign == "right") then
|
||||
button.text:SetPoint ("right", button, "right", -1, -1)
|
||||
end
|
||||
else
|
||||
button.text:SetPoint ("center", button,"center", 1, -1)
|
||||
end
|
||||
|
||||
button.mouse_down = GetTime()
|
||||
local x, y = GetCursorPosition()
|
||||
@@ -595,7 +619,17 @@ local ButtonMetaFunctions = {}
|
||||
end
|
||||
end
|
||||
|
||||
button.text:SetPoint ("center", button,"center", 0, 0)
|
||||
if (button.MyObject.capsule_textalign) then
|
||||
if (button.MyObject.capsule_textalign == "left") then
|
||||
button.text:SetPoint ("left", button, "left", 2, 0)
|
||||
elseif (button.MyObject.capsule_textalign == "center") then
|
||||
button.text:SetPoint ("center", button, "center", 0, 0)
|
||||
elseif (button.MyObject.capsule_textalign == "right") then
|
||||
button.text:SetPoint ("right", button, "right", -2, 0)
|
||||
end
|
||||
else
|
||||
button.text:SetPoint ("center", button,"center", 0, 0)
|
||||
end
|
||||
|
||||
if (button.MyObject.container.isMoving) then
|
||||
button.MyObject.container:StopMovingOrSizing()
|
||||
|
||||
+99
-19
@@ -90,9 +90,12 @@ function DetailsCreateCoolTip()
|
||||
["NoLastSelectedBar"] = true,
|
||||
["SubMenuIsTooltip"] = true,
|
||||
["LeftBorderSize"] = true,
|
||||
["RightBorderSize"] = true
|
||||
|
||||
["RightBorderSize"] = true,
|
||||
["HeighMod"] = true,
|
||||
["IconBlendMode"] = true,
|
||||
["IconBlendModeHover"] = true,
|
||||
}
|
||||
|
||||
CoolTip.OptionsTable = {
|
||||
["IconSize"] = nil,
|
||||
["HeightAnchorMod"] = nil,
|
||||
@@ -122,7 +125,10 @@ function DetailsCreateCoolTip()
|
||||
["NoLastSelectedBar"] = nil,
|
||||
["SubMenuIsTooltip"] = nil,
|
||||
["LeftBorderSize"] = nil,
|
||||
["RightBorderSize"] = nil
|
||||
["RightBorderSize"] = nil,
|
||||
["HeighMod"] = nil,
|
||||
["IconBlendMode"] = nil,
|
||||
["IconBlendModeHover"] = nil,
|
||||
}
|
||||
|
||||
--cprops
|
||||
@@ -152,6 +158,7 @@ function DetailsCreateCoolTip()
|
||||
local frame2 = CreateFrame ("Frame", "CoolTipFrame2", UIParent, "CooltipMainFrameTemplate")
|
||||
tinsert (UISpecialFrames, "CoolTipFrame2")
|
||||
gump:CreateFlashAnimation (frame2)
|
||||
frame2:SetClampedToScreen (true)
|
||||
|
||||
frame2:SetPoint ("bottomleft", frame1, "bottomright")
|
||||
|
||||
@@ -377,7 +384,7 @@ function DetailsCreateCoolTip()
|
||||
|
||||
--> serach key: ~onenter
|
||||
botao:SetScript ("OnEnter", function()
|
||||
if (CoolTip.Type ~= 1 and CoolTip.Type ~= 2) then
|
||||
if (CoolTip.Type ~= 1 and CoolTip.Type ~= 2 and not botao.isDiv) then
|
||||
CoolTip.active = true
|
||||
CoolTip.mouseOver = true
|
||||
|
||||
@@ -385,6 +392,12 @@ function DetailsCreateCoolTip()
|
||||
frame2:SetScript ("OnUpdate", nil)
|
||||
|
||||
botao.background:Show()
|
||||
|
||||
if (CoolTip.OptionsTable.IconBlendModeHover) then
|
||||
botao.leftIcon:SetBlendMode (CoolTip.OptionsTable.IconBlendModeHover)
|
||||
else
|
||||
botao.leftIcon:SetBlendMode ("BLEND")
|
||||
end
|
||||
|
||||
if (CoolTip.IndexesSub [botao.index] and CoolTip.IndexesSub [botao.index] > 0) then
|
||||
if (CoolTip.OptionsTable.SubMenuIsTooltip) then
|
||||
@@ -412,13 +425,21 @@ function DetailsCreateCoolTip()
|
||||
end)
|
||||
|
||||
botao:SetScript ("OnLeave", function()
|
||||
if (CoolTip.Type ~= 1 and CoolTip.Type ~= 2) then
|
||||
if (CoolTip.Type ~= 1 and CoolTip.Type ~= 2 and not botao.isDiv) then
|
||||
CoolTip.active = false
|
||||
CoolTip.mouseOver = false
|
||||
botao:SetScript ("OnUpdate", nil)
|
||||
|
||||
botao.background:Hide()
|
||||
|
||||
if (CoolTip.OptionsTable.IconBlendMode) then
|
||||
botao.leftIcon:SetBlendMode (CoolTip.OptionsTable.IconBlendMode)
|
||||
botao.rightIcon:SetBlendMode (CoolTip.OptionsTable.IconBlendMode)
|
||||
else
|
||||
botao.leftIcon:SetBlendMode ("BLEND")
|
||||
botao.rightIcon:SetBlendMode ("BLEND")
|
||||
end
|
||||
|
||||
elapsedTime = 0
|
||||
frame1:SetScript ("OnUpdate", OnLeaveUpdateButton)
|
||||
--CoolTip:HideSub (i)
|
||||
@@ -460,6 +481,12 @@ function DetailsCreateCoolTip()
|
||||
|
||||
botao.background:Show()
|
||||
|
||||
if (CoolTip.OptionsTable.IconBlendModeHover) then
|
||||
botao.leftIcon:SetBlendMode (CoolTip.OptionsTable.IconBlendModeHover)
|
||||
else
|
||||
botao.leftIcon:SetBlendMode ("BLEND")
|
||||
end
|
||||
|
||||
frame1:SetScript ("OnUpdate", nil)
|
||||
frame2:SetScript ("OnUpdate", nil)
|
||||
|
||||
@@ -477,6 +504,14 @@ function DetailsCreateCoolTip()
|
||||
|
||||
botao.background:Hide()
|
||||
|
||||
if (CoolTip.OptionsTable.IconBlendMode) then
|
||||
botao.leftIcon:SetBlendMode (CoolTip.OptionsTable.IconBlendMode)
|
||||
botao.rightIcon:SetBlendMode (CoolTip.OptionsTable.IconBlendMode)
|
||||
else
|
||||
botao.leftIcon:SetBlendMode ("BLEND")
|
||||
botao.rightIcon:SetBlendMode ("BLEND")
|
||||
end
|
||||
|
||||
elapsedTime = 0
|
||||
frame2:SetScript ("OnUpdate", OnLeaveUpdateButtonSec)
|
||||
else
|
||||
@@ -595,14 +630,19 @@ function DetailsCreateCoolTip()
|
||||
menuButton.leftIcon:SetWidth (leftIconTable [2])
|
||||
menuButton.leftIcon:SetHeight (leftIconTable [3])
|
||||
menuButton.leftIcon:SetTexCoord (leftIconTable [4], leftIconTable [5], leftIconTable [6], leftIconTable [7])
|
||||
|
||||
local ColorR, ColorG, ColorB, ColorA = gump:ParseColors (leftIconTable [8])
|
||||
menuButton.leftIcon:SetVertexColor (ColorR, ColorG, ColorB, ColorA)
|
||||
--menuButton.leftText:SetPoint ("left", menuButton.leftIcon, "right", 3, 0)
|
||||
|
||||
if (CoolTip.OptionsTable.IconBlendMode) then
|
||||
menuButton.leftIcon:SetBlendMode (CoolTip.OptionsTable.IconBlendMode)
|
||||
else
|
||||
menuButton.leftIcon:SetBlendMode ("BLEND")
|
||||
end
|
||||
else
|
||||
menuButton.leftIcon:SetTexture (nil)
|
||||
menuButton.leftIcon:SetWidth (3)
|
||||
menuButton.leftIcon:SetHeight (3)
|
||||
--menuButton.leftText:SetPoint ("left", menuButton.leftIcon, "left", -5, 0)
|
||||
end
|
||||
|
||||
--> right icon
|
||||
@@ -611,14 +651,19 @@ function DetailsCreateCoolTip()
|
||||
menuButton.rightIcon:SetWidth (rightIconTable [2])
|
||||
menuButton.rightIcon:SetHeight (rightIconTable [3])
|
||||
menuButton.rightIcon:SetTexCoord (rightIconTable [4], rightIconTable [5], rightIconTable [6], rightIconTable [7])
|
||||
|
||||
local ColorR, ColorG, ColorB, ColorA = gump:ParseColors (rightIconTable [8])
|
||||
menuButton.rightIcon:SetVertexColor (ColorR, ColorG, ColorB, ColorA)
|
||||
--menuButton.rightText:SetPoint ("right", menuButton.rightIcon, "left", -3, 0)
|
||||
|
||||
if (CoolTip.OptionsTable.IconBlendMode) then
|
||||
menuButton.rightIcon:SetBlendMode (CoolTip.OptionsTable.IconBlendMode)
|
||||
else
|
||||
menuButton.rightIcon:SetBlendMode ("BLEND")
|
||||
end
|
||||
else
|
||||
menuButton.rightIcon:SetTexture (nil)
|
||||
menuButton.rightIcon:SetWidth (1)
|
||||
menuButton.rightIcon:SetHeight (1)
|
||||
--menuButton.rightText:SetPoint ("right", menuButton.rightIcon, "right", 5, 0)
|
||||
end
|
||||
|
||||
--> overwrite icon size
|
||||
@@ -1022,6 +1067,14 @@ function DetailsCreateCoolTip()
|
||||
end
|
||||
end
|
||||
|
||||
function CoolTip:CreateDivBar (button)
|
||||
button.divbar = button:CreateTexture (nil, "overlay")
|
||||
button.divbar:SetTexture ("Interface\\TALENTFRAME\\talent-main")
|
||||
button.divbar:SetTexCoord (0, 0.7890625, 0.248046875, 0.264625)
|
||||
button.divbar:SetHeight (3)
|
||||
button.divbar:SetDesaturated (true)
|
||||
end
|
||||
|
||||
function CoolTip:monta_cooltip (host, instancia, options, sub_menus, icones, tamanho1, tamanho2, font, fontsize)
|
||||
|
||||
if (CoolTip.Indexes == 0) then
|
||||
@@ -1104,6 +1157,15 @@ function DetailsCreateCoolTip()
|
||||
spacing = CoolTip.OptionsTable.YSpacingMod
|
||||
end
|
||||
|
||||
if (not CoolTip.OptionsTable.FixedWidth) then
|
||||
if (CoolTip.OptionsTable.MinWidth) then
|
||||
local w = frame1.w + 24
|
||||
frame1:SetWidth (math.max (w, CoolTip.OptionsTable.MinWidth))
|
||||
else
|
||||
frame1:SetWidth (frame1.w + 24)
|
||||
end
|
||||
end
|
||||
|
||||
--> normalize height of all rows
|
||||
for i = 1, CoolTip.Indexes do
|
||||
local menuButton = frame1.Lines [i]
|
||||
@@ -1120,21 +1182,36 @@ function DetailsCreateCoolTip()
|
||||
menuButton:SetPoint ("right", frame1, "right")
|
||||
|
||||
menuButton:EnableMouse (true)
|
||||
end
|
||||
|
||||
if (not CoolTip.OptionsTable.FixedWidth) then
|
||||
if (CoolTip.OptionsTable.MinWidth) then
|
||||
local w = frame1.w + 24
|
||||
frame1:SetWidth (math.max (w, CoolTip.OptionsTable.MinWidth))
|
||||
|
||||
if (menuButton.leftText:GetText() == "$div") then
|
||||
|
||||
menuButton.leftText:SetText ("")
|
||||
menuButton.isDiv = true
|
||||
|
||||
if (not menuButton.divbar) then
|
||||
CoolTip:CreateDivBar (menuButton)
|
||||
else
|
||||
menuButton.divbar:Show()
|
||||
end
|
||||
|
||||
menuButton.divbar:SetPoint ("left", menuButton, "left", frame1:GetWidth()*0.10, 0)
|
||||
menuButton.divbar:SetPoint ("right", menuButton, "right", -frame1:GetWidth()*0.10, 0)
|
||||
|
||||
else
|
||||
frame1:SetWidth (frame1.w + 24)
|
||||
if (menuButton.divbar) then
|
||||
menuButton.divbar:Hide()
|
||||
menuButton.isDiv = false
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
if (CoolTip.OptionsTable.FixedHeight) then
|
||||
frame1:SetHeight (CoolTip.OptionsTable.FixedHeight)
|
||||
else
|
||||
frame1:SetHeight (_math_max ( (frame1.hHeight * CoolTip.Indexes) + 12 + (-spacing), 22 ))
|
||||
local mod = CoolTip.OptionsTable.HeighMod or 0
|
||||
frame1:SetHeight (_math_max ( (frame1.hHeight * CoolTip.Indexes) + 12 + (-spacing) + mod, 22 ))
|
||||
end
|
||||
|
||||
frame1:ClearAllPoints()
|
||||
@@ -1266,6 +1343,8 @@ function DetailsCreateCoolTip()
|
||||
end
|
||||
|
||||
CoolTip.Host = frame
|
||||
|
||||
CoolTip.frame1:SetFrameLevel (frame:GetFrameLevel()+1)
|
||||
|
||||
--> defaults
|
||||
myPoint = myPoint or CoolTip.OptionsTable.MyAnchor or "bottom"
|
||||
@@ -1736,7 +1815,8 @@ function DetailsCreateCoolTip()
|
||||
end
|
||||
|
||||
if (color) then
|
||||
fontstring:SetTextColor (unpack (color))
|
||||
local r, g, b, a = gump:ParseColors (color)
|
||||
fontstring:SetTextColor (r, g, b, a)
|
||||
end
|
||||
|
||||
local face, size, flags = fontstring:GetFont()
|
||||
|
||||
+21
-4
@@ -91,15 +91,32 @@ function gump:NewColor (_colorname, _colortable, _green, _blue, _alpha)
|
||||
return true
|
||||
end
|
||||
|
||||
function gump:IsHtmlColor (color)
|
||||
return gump.alias_text_colors [color]
|
||||
end
|
||||
|
||||
local tn = tonumber
|
||||
function gump:ParseColors (_arg1, _arg2, _arg3, _arg4)
|
||||
if (_type (_arg1) == "table") then
|
||||
_arg1, _arg2, _arg3, _arg4 = _unpack (_arg1)
|
||||
|
||||
elseif (_type (_arg1) == "string") then
|
||||
local color = gump.alias_text_colors [_arg1]
|
||||
if (color) then
|
||||
_arg1, _arg2, _arg3, _arg4 = _unpack (color)
|
||||
|
||||
if (string.find (_arg1, "#")) then
|
||||
_arg1 = _arg1:gsub ("#","")
|
||||
if (string.len (_arg1) == 8) then --alpha
|
||||
_arg1, _arg2, _arg3, _arg4 = tn ("0x" .. _arg1:sub (3, 4))/255, tn ("0x" .. _arg1:sub (5, 6))/255, tn ("0x" .. _arg1:sub (7, 8))/255, tn ("0x" .. _arg1:sub (1, 2))/255
|
||||
else
|
||||
_arg1, _arg2, _arg3, _arg4 = tn ("0x" .. _arg1:sub (1, 2))/255, tn ("0x" .. _arg1:sub (3, 4))/255, tn ("0x" .. _arg1:sub (5, 6))/255, 1
|
||||
end
|
||||
|
||||
else
|
||||
_arg1, _arg2, _arg3, _arg4 = _unpack (gump.alias_text_colors.none)
|
||||
local color = gump.alias_text_colors [_arg1]
|
||||
if (color) then
|
||||
_arg1, _arg2, _arg3, _arg4 = _unpack (color)
|
||||
else
|
||||
_arg1, _arg2, _arg3, _arg4 = _unpack (gump.alias_text_colors.none)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
+231
-1
@@ -290,6 +290,31 @@ local APIFrameFunctions
|
||||
return _rawget (self, "have_tooltip")
|
||||
end
|
||||
|
||||
-- frame levels
|
||||
function PanelMetaFunctions:GetFrameLevel()
|
||||
return self.widget:GetFrameLevel()
|
||||
end
|
||||
function PanelMetaFunctions:SetFrameLevel (level, frame)
|
||||
if (not frame) then
|
||||
return self.widget:SetFrameLevel (level)
|
||||
else
|
||||
local framelevel = frame:GetFrameLevel (frame) + level
|
||||
return self.widget:SetFrameLevel (framelevel)
|
||||
end
|
||||
end
|
||||
|
||||
-- frame stratas
|
||||
function PanelMetaFunctions:SetFrameStrata()
|
||||
return self.widget:GetFrameStrata()
|
||||
end
|
||||
function PanelMetaFunctions:SetFrameStrata (strata)
|
||||
if (_type (strata) == "table") then
|
||||
self.widget:SetFrameStrata (strata:GetFrameStrata())
|
||||
else
|
||||
self.widget:SetFrameStrata (strata)
|
||||
end
|
||||
end
|
||||
|
||||
-- enable and disable gradients
|
||||
function PanelMetaFunctions:DisableGradient()
|
||||
self.GradientEnabled = false
|
||||
@@ -524,4 +549,209 @@ function gump:NewPanel (parent, container, name, member, w, h, backdrop, backdro
|
||||
end
|
||||
|
||||
return PanelObject
|
||||
end
|
||||
end
|
||||
|
||||
------------color pick
|
||||
|
||||
local color_pick_func = function()
|
||||
local r, g, b = ColorPickerFrame:GetColorRGB()
|
||||
local a = OpacitySliderFrame:GetValue()
|
||||
ColorPickerFrame:dcallback (r, g, b, a)
|
||||
end
|
||||
local color_pick_func_cancel = function()
|
||||
ColorPickerFrame:SetColorRGB (unpack (ColorPickerFrame.previousValues))
|
||||
local r, g, b = ColorPickerFrame:GetColorRGB()
|
||||
local a = OpacitySliderFrame:GetValue()
|
||||
ColorPickerFrame:dcallback (r, g, b, a)
|
||||
end
|
||||
|
||||
function gump:ColorPick (frame, r, g, b, alpha, callback)
|
||||
|
||||
ColorPickerFrame:SetPoint ("bottomleft", frame, "topright", 0, 0)
|
||||
|
||||
ColorPickerFrame.dcallback = callback
|
||||
|
||||
ColorPickerFrame.func = color_pick_func
|
||||
ColorPickerFrame.opacityFunc = color_pick_func
|
||||
ColorPickerFrame.cancelFunc = color_pick_func_cancel
|
||||
|
||||
ColorPickerFrame.opacity = alpha
|
||||
ColorPickerFrame.hasOpacity = alpha and true
|
||||
|
||||
ColorPickerFrame.previousValues = {r, g, b}
|
||||
ColorPickerFrame:SetParent (UIParent)
|
||||
ColorPickerFrame:SetFrameStrata ("tooltip")
|
||||
ColorPickerFrame:SetColorRGB (r, g, b)
|
||||
ColorPickerFrame:Show()
|
||||
|
||||
end
|
||||
|
||||
------------icon pick
|
||||
|
||||
function gump:IconPick (callback)
|
||||
|
||||
if (not gump.IconPickFrame) then
|
||||
|
||||
gump.IconPickFrame = CreateFrame ("frame", "DetailsIconPickFrame", UIParent)
|
||||
tinsert (UISpecialFrames, "DetailsIconPickFrame")
|
||||
|
||||
gump.IconPickFrame:SetPoint ("center", UIParent, "center")
|
||||
gump.IconPickFrame:SetWidth (350)
|
||||
gump.IconPickFrame:SetHeight (200)
|
||||
gump.IconPickFrame:EnableMouse (true)
|
||||
gump.IconPickFrame:SetMovable (true)
|
||||
gump.IconPickFrame:SetBackdrop ({bgFile = "Interface\\AddOns\\Details\\images\\background", edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border",
|
||||
tile = true, tileSize = 32, edgeSize = 32, insets = {left = 5, right = 5, top = 5, bottom = 5}})
|
||||
|
||||
gump.IconPickFrame:SetBackdropBorderColor (170/255, 170/255, 170/255)
|
||||
gump.IconPickFrame:SetBackdropColor (24/255, 24/255, 24/255, .8)
|
||||
gump.IconPickFrame:SetFrameLevel (1)
|
||||
|
||||
gump.IconPickFrame.emptyFunction = function() end
|
||||
gump.IconPickFrame.callback = gump.IconPickFrame.emptyFunction
|
||||
|
||||
--> close button
|
||||
local close_button = CreateFrame ("button", nil, gump.IconPickFrame, "UIPanelCloseButton")
|
||||
close_button:SetWidth (32)
|
||||
close_button:SetHeight (32)
|
||||
close_button:SetPoint ("TOPRIGHT", gump.IconPickFrame, "TOPRIGHT", -3, 20)
|
||||
close_button:SetFrameLevel (close_button:GetFrameLevel()+2)
|
||||
|
||||
local MACRO_ICON_FILENAMES = {}
|
||||
gump.IconPickFrame:SetScript ("OnShow", function()
|
||||
|
||||
MACRO_ICON_FILENAMES = {};
|
||||
MACRO_ICON_FILENAMES[1] = "INV_MISC_QUESTIONMARK";
|
||||
local index = 2;
|
||||
local numFlyouts = 0;
|
||||
|
||||
for i = 1, GetNumSpellTabs() do
|
||||
local tab, tabTex, offset, numSpells, _ = GetSpellTabInfo(i);
|
||||
offset = offset + 1;
|
||||
local tabEnd = offset + numSpells;
|
||||
for j = offset, tabEnd - 1 do
|
||||
--to get spell info by slot, you have to pass in a pet argument
|
||||
local spellType, ID = GetSpellBookItemInfo(j, "player");
|
||||
if (spellType ~= "FUTURESPELL") then
|
||||
local spellTexture = strupper(GetSpellBookItemTexture(j, "player"));
|
||||
if ( not string.match( spellTexture, "INTERFACE\\BUTTONS\\") ) then
|
||||
MACRO_ICON_FILENAMES[index] = gsub( spellTexture, "INTERFACE\\ICONS\\", "");
|
||||
index = index + 1;
|
||||
end
|
||||
end
|
||||
if (spellType == "FLYOUT") then
|
||||
local _, _, numSlots, isKnown = GetFlyoutInfo(ID);
|
||||
if (isKnown and numSlots > 0) then
|
||||
for k = 1, numSlots do
|
||||
local spellID, overrideSpellID, isKnown = GetFlyoutSlotInfo(ID, k)
|
||||
if (isKnown) then
|
||||
MACRO_ICON_FILENAMES[index] = gsub( strupper(GetSpellTexture(spellID)), "INTERFACE\\ICONS\\", "");
|
||||
index = index + 1;
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
GetMacroIcons (MACRO_ICON_FILENAMES)
|
||||
GetMacroItemIcons (MACRO_ICON_FILENAMES )
|
||||
|
||||
end)
|
||||
|
||||
gump.IconPickFrame:SetScript ("OnHide", function()
|
||||
MACRO_ICON_FILENAMES = nil;
|
||||
collectgarbage()
|
||||
end)
|
||||
|
||||
gump.IconPickFrame.buttons = {}
|
||||
|
||||
local OnClickFunction = function (index)
|
||||
local button = gump.IconPickFrame.buttons [index]
|
||||
local texture = button:GetNormalTexture()
|
||||
gump.IconPickFrame.callback ("INTERFACE\\ICONS\\"..MACRO_ICON_FILENAMES [button.IconID])
|
||||
end
|
||||
|
||||
for i = 0, 9 do
|
||||
local newcheck = gump:NewDetailsButton (gump.IconPickFrame, gump.IconPickFrame, _, OnClickFunction, i+1, i+1, 30, 28, "", "", "", "", _, "DetailsIconPickFrameButton"..(i+1))
|
||||
newcheck:SetPoint ("topleft", gump.IconPickFrame, "topleft", 12+(i*30), -13)
|
||||
newcheck:SetID (i+1)
|
||||
gump.IconPickFrame.buttons [#gump.IconPickFrame.buttons+1] = newcheck
|
||||
end
|
||||
for i = 11, 20 do
|
||||
local newcheck = gump:NewDetailsButton (gump.IconPickFrame, gump.IconPickFrame, _, OnClickFunction, i, i, 30, 28, "", "", "", "", _, "DetailsIconPickFrameButton"..i)
|
||||
newcheck:SetPoint ("topleft", "DetailsIconPickFrameButton"..(i-10), "bottomleft", 0, -1)
|
||||
newcheck:SetID (i)
|
||||
gump.IconPickFrame.buttons [#gump.IconPickFrame.buttons+1] = newcheck
|
||||
end
|
||||
for i = 21, 30 do
|
||||
local newcheck = gump:NewDetailsButton (gump.IconPickFrame, gump.IconPickFrame, _, OnClickFunction, i, i, 30, 28, "", "", "", "", _, "DetailsIconPickFrameButton"..i)
|
||||
newcheck:SetPoint ("topleft", "DetailsIconPickFrameButton"..(i-10), "bottomleft", 0, -1)
|
||||
newcheck:SetID (i)
|
||||
gump.IconPickFrame.buttons [#gump.IconPickFrame.buttons+1] = newcheck
|
||||
end
|
||||
for i = 31, 40 do
|
||||
local newcheck = gump:NewDetailsButton (gump.IconPickFrame, gump.IconPickFrame, _, OnClickFunction, i, i, 30, 28, "", "", "", "", _, "DetailsIconPickFrameButton"..i)
|
||||
newcheck:SetPoint ("topleft", "DetailsIconPickFrameButton"..(i-10), "bottomleft", 0, -1)
|
||||
newcheck:SetID (i)
|
||||
gump.IconPickFrame.buttons [#gump.IconPickFrame.buttons+1] = newcheck
|
||||
end
|
||||
for i = 41, 50 do
|
||||
local newcheck = gump:NewDetailsButton (gump.IconPickFrame, gump.IconPickFrame, _, OnClickFunction, i, i, 30, 28, "", "", "", "", _, "DetailsIconPickFrameButton"..i)
|
||||
newcheck:SetPoint ("topleft", "DetailsIconPickFrameButton"..(i-10), "bottomleft", 0, -1)
|
||||
newcheck:SetID (i)
|
||||
gump.IconPickFrame.buttons [#gump.IconPickFrame.buttons+1] = newcheck
|
||||
end
|
||||
for i = 51, 60 do
|
||||
local newcheck = gump:NewDetailsButton (gump.IconPickFrame, gump.IconPickFrame, _, OnClickFunction, i, i, 30, 28, "", "", "", "", _, "DetailsIconPickFrameButton"..i)
|
||||
newcheck:SetPoint ("topleft", "DetailsIconPickFrameButton"..(i-10), "bottomleft", 0, -1)
|
||||
newcheck:SetID (i)
|
||||
gump.IconPickFrame.buttons [#gump.IconPickFrame.buttons+1] = newcheck
|
||||
end
|
||||
|
||||
local scroll = CreateFrame ("ScrollFrame", "DetailsIconPickFrameScroll", gump.IconPickFrame, "ListScrollFrameTemplate")
|
||||
|
||||
local ChecksFrame_Update = function (self)
|
||||
--self = self or MacroPopupFrame;
|
||||
local numMacroIcons = #MACRO_ICON_FILENAMES;
|
||||
local macroPopupIcon, macroPopupButton;
|
||||
local macroPopupOffset = FauxScrollFrame_GetOffset (scroll);
|
||||
local index;
|
||||
|
||||
-- Icon list
|
||||
local texture;
|
||||
for i = 1, 60 do
|
||||
macroPopupIcon = _G["DetailsIconPickFrameButton"..i];
|
||||
macroPopupButton = _G["DetailsIconPickFrameButton"..i];
|
||||
index = (macroPopupOffset * 10) + i;
|
||||
texture = MACRO_ICON_FILENAMES [index]
|
||||
if ( index <= numMacroIcons and texture ) then
|
||||
macroPopupButton:ChangeIcon ("INTERFACE\\ICONS\\"..texture, "INTERFACE\\ICONS\\"..texture, "INTERFACE\\ICONS\\"..texture, "INTERFACE\\ICONS\\"..texture)
|
||||
macroPopupButton.IconID = index
|
||||
macroPopupButton:Show();
|
||||
else
|
||||
macroPopupButton:Hide();
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
-- Scrollbar stuff
|
||||
FauxScrollFrame_Update (scroll, ceil (numMacroIcons / 10) , 5, 20 );
|
||||
end
|
||||
|
||||
|
||||
scroll:SetPoint ("topleft", gump.IconPickFrame, "topleft", -18, -10)
|
||||
scroll:SetWidth (330)
|
||||
scroll:SetHeight (178)
|
||||
scroll:SetScript ("OnVerticalScroll", function (self, offset) FauxScrollFrame_OnVerticalScroll (scroll, offset, 20, ChecksFrame_Update) end)
|
||||
scroll.update = ChecksFrame_Update
|
||||
gump.IconPickFrameScroll = scroll
|
||||
gump.IconPickFrame:Hide()
|
||||
|
||||
end
|
||||
|
||||
gump.IconPickFrame:Show()
|
||||
gump.IconPickFrameScroll.update (gump.IconPickFrameScroll)
|
||||
gump.IconPickFrame.callback = callback or gump.IconPickFrame.emptyFunction
|
||||
|
||||
end
|
||||
|
||||
+42
-4
@@ -89,7 +89,17 @@ local ImageMetaFunctions = {}
|
||||
end
|
||||
--> texture
|
||||
local smember_texture = function (_object, _value)
|
||||
return _object.image:SetTexture (_value)
|
||||
if (type (_value) == "table") then
|
||||
local r, g, b, a = gump:ParseColors (_value)
|
||||
_object.image:SetTexture (r, g, b, a or 1)
|
||||
else
|
||||
if (gump:IsHtmlColor (_value)) then
|
||||
local r, g, b, a = gump:ParseColors (_value)
|
||||
_object.image:SetTexture (r, g, b, a or 1)
|
||||
else
|
||||
_object.image:SetTexture (_value)
|
||||
end
|
||||
end
|
||||
end
|
||||
--> width
|
||||
local smember_width = function (_object, _value)
|
||||
@@ -105,8 +115,25 @@ local ImageMetaFunctions = {}
|
||||
end
|
||||
--> color
|
||||
local smember_color = function (_object, _value)
|
||||
local _value1, _value2, _value3 = gump:ParseColors (_value)
|
||||
return _object.image:SetTexture (_value1, _value2, _value3)
|
||||
if (type (_value) == "table") then
|
||||
local r, g, b, a = gump:ParseColors (_value)
|
||||
_object.image:SetTexture (r,g,b, a or 1)
|
||||
else
|
||||
if (gump:IsHtmlColor (_value)) then
|
||||
local r, g, b, a = gump:ParseColors (_value)
|
||||
_object.image:SetTexture (r, g, b, a or 1)
|
||||
else
|
||||
_object.image:SetTexture (_value)
|
||||
end
|
||||
end
|
||||
end
|
||||
--> desaturated
|
||||
local smember_desaturated = function (_object, _value)
|
||||
if (_value) then
|
||||
_object:SetDesaturated (true)
|
||||
else
|
||||
_object:SetDesaturated (false)
|
||||
end
|
||||
end
|
||||
|
||||
local set_members_function_index = {
|
||||
@@ -117,6 +144,7 @@ local ImageMetaFunctions = {}
|
||||
["height"] = smember_height,
|
||||
["texture"] = smember_texture,
|
||||
["color"] = smember_color,
|
||||
["blackwhite"] = smember_desaturated,
|
||||
}
|
||||
|
||||
ImageMetaFunctions.__newindex = function (_table, _key, _value)
|
||||
@@ -225,7 +253,17 @@ function gump:NewImage (parent, container, name, member, w, h, texture, layer)
|
||||
ImageObject.image:SetHeight (h)
|
||||
end
|
||||
if (texture) then
|
||||
ImageObject.image:SetTexture (texture)
|
||||
if (type (texture) == "table") then
|
||||
local r, g, b = gump:ParseColors (texture)
|
||||
ImageObject.image:SetTexture (r,g,b)
|
||||
else
|
||||
if (gump:IsHtmlColor (texture)) then
|
||||
local r, g, b = gump:ParseColors (texture)
|
||||
ImageObject.image:SetTexture (r, g, b)
|
||||
else
|
||||
ImageObject.image:SetTexture (texture)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
setmetatable (ImageObject, ImageMetaFunctions)
|
||||
|
||||
+82
-5
@@ -10,6 +10,8 @@ local _type = type --> lua local
|
||||
local _math_floor = math.floor --> lua local
|
||||
local loadstring = loadstring --> lua local
|
||||
|
||||
local Loc = LibStub ("AceLocale-3.0"):GetLocale ( "Details" )
|
||||
|
||||
local cleanfunction = function() end
|
||||
local APISliderFunctions = false
|
||||
local SliderMetaFunctions = {}
|
||||
@@ -74,9 +76,13 @@ local SliderMetaFunctions = {}
|
||||
return _rawget (_object, "lockdown")
|
||||
end
|
||||
--> fractional
|
||||
local gmember_fractional = function (_object, _value)
|
||||
local gmember_fractional = function (_object)
|
||||
return _rawget (_object, "useDecimals")
|
||||
end
|
||||
--> value
|
||||
local gmember_value = function (_object)
|
||||
return _object()
|
||||
end
|
||||
|
||||
local get_members_function_index = {
|
||||
["tooltip"] = gmember_tooltip,
|
||||
@@ -85,6 +91,7 @@ local SliderMetaFunctions = {}
|
||||
["height"] = gmember_height,
|
||||
["locked"] = gmember_locked,
|
||||
["fractional"] = gmember_fractional,
|
||||
["value"] = gmember_value,
|
||||
}
|
||||
|
||||
SliderMetaFunctions.__index = function (_table, _member_requested)
|
||||
@@ -148,6 +155,10 @@ local SliderMetaFunctions = {}
|
||||
local smember_fractional = function (_object, _value)
|
||||
return _rawset (_object, "useDecimals", _value)
|
||||
end
|
||||
--> value
|
||||
local smember_value = function (_object, _value)
|
||||
_object (_value)
|
||||
end
|
||||
|
||||
local set_members_function_index = {
|
||||
["tooltip"] = smember_tooltip,
|
||||
@@ -158,6 +169,7 @@ local SliderMetaFunctions = {}
|
||||
["height"] = smember_height,
|
||||
["locked"] = smember_locked,
|
||||
["fractional"] = smember_fractional,
|
||||
["value"] = smember_value,
|
||||
}
|
||||
|
||||
SliderMetaFunctions.__newindex = function (_table, _key, _value)
|
||||
@@ -340,6 +352,59 @@ local SliderMetaFunctions = {}
|
||||
|
||||
end
|
||||
|
||||
function SliderMetaFunctions:TypeValue()
|
||||
if (not self.isSwitch) then
|
||||
|
||||
if (not SliderMetaFunctions.editbox_typevalue) then
|
||||
local editbox = CreateFrame ("EditBox", "DetailsFrameworkSliderEditBox", UIParent)
|
||||
editbox:SetSize (40, 20)
|
||||
editbox:SetJustifyH ("center")
|
||||
editbox:SetBackdrop ({bgFile = [[Interface\DialogFrame\UI-DialogBox-Background-Dark]],
|
||||
edgeFile = "Interface\\Buttons\\UI-SliderBar-Border", --edgeFile = [[Interface\Tooltips\UI-Tooltip-Border]],
|
||||
tile = true, edgeSize = 8, tileSize = 5})
|
||||
editbox:SetFontObject ("GameFontHighlightSmall")
|
||||
|
||||
editbox:SetScript ("OnEnterPressed", function()
|
||||
editbox:ClearFocus()
|
||||
editbox:Hide()
|
||||
editbox:GetParent().MyObject.value = tonumber (editbox:GetText())
|
||||
editbox:GetParent().MyObject.typing_value = false
|
||||
end)
|
||||
editbox:SetScript ("OnEscapePressed", function()
|
||||
editbox:ClearFocus()
|
||||
editbox:Hide()
|
||||
editbox:GetParent().MyObject.typing_value = false
|
||||
end)
|
||||
|
||||
SliderMetaFunctions.editbox_typevalue = editbox
|
||||
end
|
||||
|
||||
self.typing_value = true
|
||||
|
||||
SliderMetaFunctions.editbox_typevalue:SetSize (self.width, self.height)
|
||||
SliderMetaFunctions.editbox_typevalue:SetPoint ("center", self.widget, "center")
|
||||
SliderMetaFunctions.editbox_typevalue:SetFocus()
|
||||
SliderMetaFunctions.editbox_typevalue:SetParent (self.widget)
|
||||
SliderMetaFunctions.editbox_typevalue:SetFrameLevel (self.widget:GetFrameLevel()+1)
|
||||
|
||||
if (self.useDecimals) then
|
||||
SliderMetaFunctions.editbox_typevalue:SetText (tostring (string.format ("%.1f", self.value)))
|
||||
else
|
||||
SliderMetaFunctions.editbox_typevalue:SetText (tostring (math.floor (self.value)))
|
||||
end
|
||||
|
||||
SliderMetaFunctions.editbox_typevalue:HighlightText()
|
||||
|
||||
SliderMetaFunctions.editbox_typevalue:Show()
|
||||
end
|
||||
end
|
||||
|
||||
local OnMouseDown = function (slider, button)
|
||||
if (button == "RightButton") then
|
||||
slider.MyObject:TypeValue()
|
||||
end
|
||||
end
|
||||
|
||||
local OnHide = function (slider)
|
||||
if (slider.MyObject.OnHideHook) then
|
||||
local interrupt = slider.MyObject.OnHideHook (slider)
|
||||
@@ -347,6 +412,12 @@ local SliderMetaFunctions = {}
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
if (slider.MyObject.typing_value) then
|
||||
SliderMetaFunctions.editbox_typevalue:ClearFocus()
|
||||
SliderMetaFunctions.editbox_typevalue:SetText ("")
|
||||
slider.MyObject.typing_valu = false
|
||||
end
|
||||
end
|
||||
|
||||
local OnShow = function (slider)
|
||||
@@ -378,7 +449,7 @@ local SliderMetaFunctions = {}
|
||||
else
|
||||
slider.amt:SetText (math.floor (amt))
|
||||
end
|
||||
slider.MyObject.value = amt
|
||||
slider.MyObject.ivalue = amt
|
||||
end
|
||||
|
||||
|
||||
@@ -411,7 +482,7 @@ function gump:NewSwitch (parent, container, name, member, w, h, ltext, rtext, de
|
||||
end
|
||||
|
||||
--> build frames
|
||||
local slider = gump:NewSlider (parent, container, name, member, w, h, 1, 2, 1, defaultv)
|
||||
local slider = gump:NewSlider (parent, container, name, member, w, h, 1, 2, 1, defaultv, nil, true)
|
||||
|
||||
slider:SetBackdrop ({edgeFile = "Interface\\Buttons\\UI-SliderBar-Border", edgeSize = 8,
|
||||
bgFile = [[Interface\AddOns\Details\images\background]], insets = {left = 3, right = 3, top = 5, bottom = 5}})
|
||||
@@ -442,7 +513,7 @@ function gump:NewSwitch (parent, container, name, member, w, h, ltext, rtext, de
|
||||
return slider
|
||||
end
|
||||
|
||||
function gump:NewSlider (parent, container, name, member, w, h, min, max, step, defaultv, isDecemal)
|
||||
function gump:NewSlider (parent, container, name, member, w, h, min, max, step, defaultv, isDecemal, isSwitch)
|
||||
|
||||
--> early checks
|
||||
if (not name) then
|
||||
@@ -515,7 +586,7 @@ function gump:NewSlider (parent, container, name, member, w, h, min, max, step,
|
||||
SliderObject.slider:SetMinMaxValues (min, max)
|
||||
SliderObject.slider:SetValueStep (step)
|
||||
SliderObject.slider:SetValue (defaultv)
|
||||
SliderObject.value = defaultv
|
||||
SliderObject.ivalue = defaultv
|
||||
|
||||
--SliderObject.amt = _G [name .. "_Amt"]
|
||||
--SliderObject.lock = _G [name .. "_LockTexture"]
|
||||
@@ -532,6 +603,10 @@ function gump:NewSlider (parent, container, name, member, w, h, min, max, step,
|
||||
SliderObject.slider:SetThumbTexture (SliderObject.thumb)
|
||||
SliderObject.slider.thumb = SliderObject.thumb
|
||||
|
||||
if (not isSwitch) then
|
||||
SliderObject.have_tooltip = Loc ["STRING_RIGHTCLICK_TYPEVALUE"]
|
||||
end
|
||||
|
||||
SliderObject.amt = SliderObject.slider:CreateFontString (nil, "overlay", "GameFontHighlightSmall")
|
||||
|
||||
local amt = defaultv
|
||||
@@ -555,6 +630,8 @@ function gump:NewSlider (parent, container, name, member, w, h, min, max, step,
|
||||
SliderObject.slider:SetScript ("OnHide", OnHide)
|
||||
SliderObject.slider:SetScript ("OnShow", OnShow)
|
||||
SliderObject.slider:SetScript ("OnValueChanged", OnValueChanged)
|
||||
SliderObject.slider:SetScript ("OnMouseDown", OnMouseDown)
|
||||
|
||||
|
||||
_setmetatable (SliderObject, SliderMetaFunctions)
|
||||
|
||||
|
||||
@@ -191,6 +191,11 @@ local TextEntryMetaFunctions = {}
|
||||
end
|
||||
end
|
||||
|
||||
--> select all text
|
||||
function TextEntryMetaFunctions:SelectAll()
|
||||
self.editbox:HighlightText()
|
||||
end
|
||||
|
||||
--> set labal description
|
||||
function TextEntryMetaFunctions:SetLabelText (text)
|
||||
if (text) then
|
||||
|
||||
Reference in New Issue
Block a user