- Added keybinds to reset segments and scroll up/down.

- Added Spell Customization options where icon and the name of a spell can be changed.
- Added option to change the micro displays side, now it can be shown on the window top side.
- Added options to change the transparency when out of combat and out of a group.
- Added and Still under development the panel for create data captures for charts.
- Fixed a issue with flat skin where the close button was just too big.

- New API: _detalhes:InstanceCall (function, params ...) runs a function into all opened instances.
- New Framework: gump:NewSpellEntry() create a textfield for choose a spell.
- New Framework: gump:NewSpecialLuaEditorEntry() create a textbox with lua syntaxes highlight.
- New FrameWork: gump:NewFillPanel() create a panel with rows.
This commit is contained in:
tercio
2014-04-30 21:55:56 -03:00
parent 432eccb1b0
commit bc1d7965eb
36 changed files with 3446 additions and 420 deletions
+2 -2
View File
@@ -283,10 +283,10 @@ local ButtonMetaFunctions = {}
_rawset (self, "func", cleanfunction)
end
if (param1) then
if (param1 ~= nil) then
_rawset (self, "param1", param1)
end
if (param2) then
if (param2 ~= nil) then
_rawset (self, "param2", param2)
end
+279 -2
View File
@@ -551,8 +551,286 @@ function gump:NewPanel (parent, container, name, member, w, h, backdrop, backdro
return PanelObject
end
------------color pick
------------fill panel
local button_on_enter = function (self)
self.MyObject._icon:SetBlendMode ("ADD")
end
local button_on_leave = function (self)
self.MyObject._icon:SetBlendMode ("BLEND")
end
function gump:NewFillPanel (parent, rows, name, member, w, h, total_lines, fill_row, autowidth, options)
local panel = gump:NewPanel (parent, parent, name, member, w, h)
panel.backdrop = nil
options = options or {rowheight = 20}
panel.rows = {}
for index, t in ipairs (rows) do
local thisrow = gump:NewPanel (panel, panel, "$parentHeader_" .. name .. index, nil, 1, 20)
thisrow.backdrop = {bgFile = [[Interface\DialogFrame\UI-DialogBox-Gold-Background]]}
thisrow.color = "silver"
thisrow.type = t.type
thisrow.func = t.func
thisrow.name = t.name
thisrow.notext = t.notext
thisrow.icon = t.icon
thisrow.iconalign = t.iconalign
local text = gump:NewLabel (thisrow, nil, name .. "$parentLabel", "text")
text:SetPoint ("left", thisrow, "left", 2, 0)
text:SetText (t.name)
tinsert (panel.rows, thisrow)
end
local cur_width = 0
local row_width = w / #rows
local anchors = {}
for index, row in ipairs (panel.rows) do
if (autowidth) then
row:SetWidth (row_width)
row:SetPoint ("topleft", panel, "topleft", cur_width, 0)
tinsert (anchors, cur_width)
cur_width = cur_width + row_width + 1
else
row:SetPoint ("topleft", panel, "topleft", cur_width, 0)
row.width = rows [index].width
tinsert (anchors, cur_width)
cur_width = cur_width + rows [index].width + 1
end
end
if (autowidth) then
panel.rows [#panel.rows]:SetWidth (row_width - #rows + 1)
else
panel.rows [#panel.rows]:SetWidth (rows [#rows].width - #rows + 1)
end
local refresh_fillbox = function (self)
local offset = FauxScrollFrame_GetOffset (self)
local filled_lines = total_lines()
for index = 1, #self.lines do
local row = self.lines [index]
if (index <= filled_lines) then
local real_index = index + offset
local results = fill_row (real_index)
if (results [1]) then
row:Show()
for i = 1, #row.row_widgets do
row.row_widgets [i].index = real_index
if (panel.rows [i].type == "icon") then
local result = results [i]:gsub (".-%\\", "")
row.row_widgets [i].icon.texture = results [i]
elseif (panel.rows [i].type == "button") then
if (type (results [i]) == "table") then
if (results [i].text) then
row.row_widgets [i]:SetText (results [i].text)
end
if (results [i].icon) then
row.row_widgets [i]._icon:SetTexture (results [i].icon)
end
if (results [i].func) then
row.row_widgets [i]:SetClickFunction (results [i].func, real_index, results [i].value)
end
else
row.row_widgets [i]:SetText (results [i])
end
else
--< text
row.row_widgets [i]:SetText (results [i])
end
end
else
row:Hide()
for i = 1, #row.row_widgets do
row.row_widgets [i]:SetText ("")
if (panel.rows [i].type == "icon") then
row.row_widgets [i].icon.texture = ""
end
end
end
else
row:Hide()
for i = 1, #row.row_widgets do
row.row_widgets [i]:SetText ("")
if (panel.rows [i].type == "icon") then
row.row_widgets [i].icon.texture = ""
end
end
end
end
end
function panel:Refresh()
local filled_lines = total_lines()
local scroll_total_lines = #panel.scrollframe
local line_height = options.rowheight
FauxScrollFrame_Update (panel.scrollframe, filled_lines, scroll_total_lines, line_height)
refresh_fillbox (panel.scrollframe)
end
local scrollframe = CreateFrame ("scrollframe", name .. "Scroll", panel.widget, "FauxScrollFrameTemplate")
scrollframe:SetScript ("OnVerticalScroll", function (self, offset) FauxScrollFrame_OnVerticalScroll (self, offset, 20, panel.Refresh) end)
scrollframe:SetPoint ("topleft", panel.widget, "topleft", 0, -21)
scrollframe:SetPoint ("topright", panel.widget, "topright", -23, -21)
scrollframe:SetPoint ("bottomleft", panel.widget, "bottomleft")
scrollframe:SetPoint ("bottomright", panel.widget, "bottomright", -23, 0)
scrollframe:SetSize (w, h)
panel.scrollframe = scrollframe
scrollframe.lines = {}
--create lines
local size = options.rowheight
local amount = math.floor (((h-21) / size))
for i = 1, amount do
local row = gump:NewPanel (scrollframe, nil, "$parentRow_" .. i, nil, 1, size)
row.backdrop = {bgFile = [[Interface\DialogFrame\UI-DialogBox-Background]]}
row.color = {1, 1, 1, .2}
row:SetPoint ("topleft", scrollframe, "topleft", 0, (i-1) * size * -1)
row:SetPoint ("topright", scrollframe, "topright", 0, (i-1) * size * -1)
tinsert (scrollframe.lines, row)
row.row_widgets = {}
for o = 1, #rows do
local _type = panel.rows [o].type
if (_type == "text") then
--> create text
local text = gump:NewLabel (row, nil, name .. "$parentLabel" .. o, "text" .. o)
text:SetPoint ("left", row, "left", anchors [o], 0)
--> insert in the table
tinsert (row.row_widgets, text)
elseif (_type == "entry") then
--> create editbox
local editbox = gump:NewTextEntry (row, nil, "$parentEntry" .. o, "entry", panel.rows [o].width, 20, panel.rows [o].func, i, o)
editbox.align = "left"
editbox:SetHook ("OnEnterPressed", function()
editbox.widget.focuslost = true
editbox:ClearFocus()
editbox.func (editbox.index, editbox.text)
return true
end)
editbox:SetPoint ("left", row, "left", anchors [o], 0)
editbox:SetBackdrop ({bgFile = [[Interface\DialogFrame\UI-DialogBox-Background]], edgeFile = "Interface\\ChatFrame\\ChatFrameBackground", edgeSize = 1})
editbox:SetBackdropColor (1, 1, 1, 0.1)
editbox:SetBackdropBorderColor (1, 1, 1, 0.1)
--> insert in the table
tinsert (row.row_widgets, editbox)
elseif (_type == "button") then
--> create button
local button = gump:NewButton (row, nil, "$parentButton" .. o, "button", 60, 20)
--[
local func = function()
panel.rows [o].func (button.index, o)
panel:Refresh()
end
button:SetClickFunction (func)
--]]
button:SetPoint ("left", row, "left", anchors [o], 0)
--> create icon and the text
local icon = gump:NewImage (button, nil, 20, 20)
local text = gump:NewLabel (button)
button._icon = icon
button._text = text
button:SetHook ("OnEnter", button_on_enter)
button:SetHook ("OnLeave", button_on_leave)
if (panel.rows [o].icon) then
icon.texture = panel.rows [o].icon
if (panel.rows [o].iconalign) then
if (panel.rows [o].iconalign == "center") then
icon:SetPoint ("center", button, "center")
elseif (panel.rows [o].iconalign == "right") then
icon:SetPoint ("right", button, "right")
end
else
icon:SetPoint ("left", button, "left")
end
end
if (panel.rows [o].name and not panel.rows [o].notext) then
text:SetPoint ("left", icon, "right", 2, 0)
text.text = panel.rows [o].name
end
--> inser in the table
tinsert (row.row_widgets, button)
elseif (_type == "icon") then
--> create button and icon
local iconbutton = gump:NewButton (row, nil, "$parentIconButton" .. o, "iconbutton", 20, 20)
iconbutton:InstallCustomTexture()
local icon = gump:NewImage (iconbutton, nil, 20, 20, "artwork", nil, "icon", "$parentIcon" .. o)
iconbutton:SetPoint ("left", row, "left", anchors [o], 0)
icon:SetPoint ("left", iconbutton, "left", 0, 0)
--> set functions
local function iconcallback (texture)
iconbutton.icon.texture = texture
panel.rows [o].func (iconbutton.index, texture)
end
iconbutton:SetClickFunction (function()
gump:IconPick (iconcallback)
return true
end)
--> insert in the table
tinsert (row.row_widgets, iconbutton)
end
end
end
return panel
end
------------color pick
local color_pick_func = function()
local r, g, b = ColorPickerFrame:GetColorRGB()
local a = OpacitySliderFrame:GetValue()
@@ -588,7 +866,6 @@ function gump:ColorPick (frame, r, g, b, alpha, callback)
end
------------icon pick
function gump:IconPick (callback)
if (not gump.IconPickFrame) then
+4
View File
@@ -269,6 +269,10 @@ function gump:NewImage (parent, texture, w, h, layer, coords, member, name)
end
end
if (coords and type (coords) == "table" and coords [4]) then
ImageObject.image:SetTexCoord (unpack (coords))
end
setmetatable (ImageObject, ImageMetaFunctions)
return ImageObject
+141 -4
View File
@@ -268,6 +268,7 @@ local TextEntryMetaFunctions = {}
textentry.mouse_over = true
if (textentry:IsEnabled()) then
textentry.current_bordercolor = textentry.current_bordercolor or {textentry:GetBackdropBorderColor()}
textentry:SetBackdropBorderColor (0.5, 0.5, 0.5, 1)
end
@@ -295,7 +296,7 @@ local TextEntryMetaFunctions = {}
textentry.mouse_over = false
if (textentry:IsEnabled()) then
textentry:SetBackdropBorderColor(0.3, 0.3, 0.3, 0.8)
textentry:SetBackdropBorderColor (unpack (textentry.current_bordercolor))
end
local parent = textentry:GetParent().MyObject
@@ -360,8 +361,8 @@ local TextEntryMetaFunctions = {}
end
end
textentry:SetText("")
textentry.MyObject.currenttext = ""
--textentry:SetText("")
--textentry.MyObject.currenttext = ""
textentry.focuslost = true
textentry:ClearFocus()
end
@@ -491,9 +492,11 @@ function gump:NewTextEntry (parent, container, name, member, w, h, func, param1,
--> misc
TextEntryObject.container = container
TextEntryObject.have_tooltip = nil
TextEntryObject.editbox = CreateFrame ("EditBox", name, parent, "DetailsEditBoxTemplate2")
TextEntryObject.widget = TextEntryObject.editbox
TextEntryObject.editbox:SetTextInsets (3, 0, 0, -3)
if (not APITextEntryFunctions) then
APITextEntryFunctions = true
@@ -559,4 +562,138 @@ function gump:NewTextEntry (parent, container, name, member, w, h, func, param1,
return TextEntryObject
end
local SpellEntryOnEditFocusGained = function (self)
local start_build_cache = _detalhes:BuildSpellListSlow()
if (start_build_cache) then
DetailsLoadSpellCacheProgress:SetPoint ("left", self, "right", 2, 0)
end
end
local SpellEntryOnClickMenu = function (_, _, SpellID, editbox)
editbox:SetText (SpellID)
editbox:PressEnter()
editbox.HaveMenu = false
GameCooltip:ShowMe (false)
end
local SpellEntryOnTextChanged = function (editbox, userChanged)
if (not userChanged) then
return
elseif (not _detalhes.spellcachefull) then
return
end
editbox = editbox.MyObject
local text = editbox:GetText()
text = _detalhes:trim (text)
text = string.lower (text)
local LetterIndex = string.sub (text, 1, 1)
local LetterIndex_CacheContainer = _detalhes.spellcachefull [LetterIndex]
if (LetterIndex_CacheContainer) then
local GameCooltip = _G.GameCooltip
_detalhes:CooltipPreset (1)
GameCooltip:SetType ("menu")
GameCooltip:SetOwner (editbox.widget)
GameCooltip:SetOption ("NoLastSelectedBar", true)
GameCooltip:SetOption ("TextSize", 9)
local i = 1
for SpellID, SpellTable in pairs (LetterIndex_CacheContainer) do
if (string.lower (SpellTable[1]):find (text)) then
GameCooltip:AddMenu (1, SpellEntryOnClickMenu, SpellID, editbox, nil, SpellID..": "..SpellTable[1], SpellTable[2], true)
if (i > 20) then
break
else
i = i + 1
end
end
end
editbox.HaveMenu = true
GameCooltip.buttonOver = true
GameCooltip:ShowCooltip()
end
end
function gump:NewSpellEntry (parent, func, w, h, param1, param2, member, name)
local editbox = gump:NewTextEntry (parent, parent, name, member, w, h, func, param1, param2)
editbox:SetHook ("OnEditFocusGained", SpellEntryOnEditFocusGained)
editbox:SetHook ("OnTextChanged", SpellEntryOnTextChanged)
return editbox
end
local function_gettext = function (self)
return self.editbox:GetText()
end
local function_settext = function (self, text)
return self.editbox:SetText (text)
end
local function_clearfocus = function (self)
return self.editbox:ClearFocus()
end
local function_setfocus = function (self)
return self.editbox:SetFocus (true)
end
function gump:NewSpecialLuaEditorEntry (parent, w, h, member, name, nointent)
if (name:find ("$parent")) then
name = name:gsub ("$parent", parent:GetName())
end
local borderframe = CreateFrame ("Frame", name, parent)
borderframe:SetSize (w, h)
if (member) then
parent [member] = borderframe
end
local scrollframe = CreateFrame ("ScrollFrame", name, borderframe, "DetailsEditBoxMultiLineTemplate")
scrollframe:SetScript ("OnSizeChanged", function (self)
scrollframe.editbox:SetSize (self:GetSize())
end)
scrollframe:SetPoint ("topleft", borderframe, "topleft", 10, -10)
scrollframe:SetPoint ("bottomright", borderframe, "bottomright", -30, 10)
scrollframe.editbox:SetMultiLine (true)
scrollframe.editbox:SetJustifyH ("left")
scrollframe.editbox:SetJustifyV ("top")
scrollframe.editbox:SetMaxBytes (40960)
scrollframe.editbox:SetMaxLetters (20000)
borderframe.GetText = function_gettext
borderframe.SetText = function_settext
borderframe.ClearFocus = function_clearfocus
borderframe.SetFocus = function_setfocus
if (not nointent) then
IndentationLib.enable (scrollframe.editbox, nil, 4)
end
borderframe:SetBackdrop ({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], edgeFile = [[Interface\Tooltips\UI-Tooltip-Border]],
tile = 1, tileSize = 16, edgeSize = 16, insets = {left = 5, right = 5, top = 5, bottom = 5}})
borderframe:SetBackdropColor (0.090195, 0.090195, 0.188234, 1)
borderframe:SetBackdropBorderColor (1, 1, 1, 1)
borderframe.scroll = scrollframe
borderframe.editbox = scrollframe.editbox
return borderframe
end
+26
View File
@@ -33,4 +33,30 @@
</Layers>
</EditBox>
<ScrollFrame name="DetailsEditBoxMultiLineTemplate" inherits="UIPanelScrollFrameTemplate" virtual="true">
<Size x="232" y="20"/>
<ScrollChild>
<EditBox name="$parentEditBox" multiLine="true" letters="255" autoFocus="false" countInvisibleLetters="true" parentKey="editbox">
<Size x="232" y="20"/>
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parent" relativePoint="TOPLEFT" />
<Anchor point="BOTTOMLEFT" relativeTo="$parent" relativePoint="BOTTOMLEFT" />
<Anchor point="TOPRIGHT" relativeTo="$parent" relativePoint="TOPRIGHT" />
<Anchor point="BOTTOMRIGHT" relativeTo="$parent" relativePoint="BOTTOMRIGHT" />
</Anchors>
<Scripts>
<OnTextChanged>
<!-- ScrollingEdit_OnTextChanged (self, self:GetParent()); -->
</OnTextChanged>
<OnCursorChanged function="ScrollingEdit_OnCursorChanged"/>
<OnUpdate>
<!-- ScrollingEdit_OnUpdate (self, elapsed, self:GetParent());-->
</OnUpdate>
<OnEscapePressed function="EditBox_ClearFocus"/>
</Scripts>
<FontString inherits="GameFontHighlightSmall"/>
</EditBox>
</ScrollChild>
</ScrollFrame>
</Ui>