This commit is contained in:
tercio
2014-04-16 22:17:50 -03:00
parent a569c7fbc4
commit 5c621d6c20
35 changed files with 2473 additions and 789 deletions
+5
View File
@@ -761,12 +761,17 @@ local set_colorpick_color = function (button, r, g, b, a)
button.color_texture:SetVertexColor (r, g, b, a)
end
local colorpick_cancel = function (self)
ColorPickerFrame:Hide()
end
function gump:NewColorPickButton (parent, name, member, callback, alpha)
--button
local button = gump:NewButton (parent, _, name, member, color_button_width, color_button_height, pickcolor, alpha, "param2")
button:InstallCustomTexture()
button.color_callback = callback
button.Cancel = colorpick_cancel
button.SetColor = set_colorpick_color
button:SetBackdrop ({edgeFile = [[Interface\Tooltips\UI-Tooltip-Border]], edgeSize = 6,
+79 -33
View File
@@ -2,6 +2,7 @@
local _detalhes = _G._detalhes
local AceLocale = LibStub ("AceLocale-3.0")
local Loc = AceLocale:GetLocale ( "Details" )
local SharedMedia = LibStub:GetLibrary("LibSharedMedia-3.0")
local gump = _detalhes.gump
local _
@@ -86,6 +87,7 @@ function DetailsCreateCoolTip()
["StatusBarTexture"] = true,
["TextSize"] = true,
["TextFont"] = true,
["TextColor"] = true,
["LeftTextWidth"] = true,
["RightTextWidth"] = true,
["LeftTextHeight"] = true,
@@ -126,6 +128,7 @@ function DetailsCreateCoolTip()
["StatusBarTexture"] = nil,
["TextSize"] = nil,
["TextFont"] = nil,
["TextColor"] = nil,
["LeftTextWidth"] = nil,
["RightTextWidth"] = nil,
["LeftTextHeight"] = nil,
@@ -592,7 +595,7 @@ function DetailsCreateCoolTip()
end
function CoolTip:TextAndIcon (index, frame, menuButton, leftTextTable, rightTextTable, leftIconTable, rightIconTable, isSub)
--> reset width
menuButton.leftText:SetWidth (0)
menuButton.leftText:SetHeight (0)
@@ -603,7 +606,19 @@ function DetailsCreateCoolTip()
if (leftTextTable) then
menuButton.leftText:SetText (leftTextTable [1])
menuButton.leftText:SetTextColor (leftTextTable [2], leftTextTable [3], leftTextTable [4], leftTextTable [5])
local r, g, b, a = leftTextTable [2], leftTextTable [3], leftTextTable [4], leftTextTable [5]
if (r == 0 and g == 0 and b == 0 and a == 0) then
if (CoolTip.OptionsTable.TextColor) then
r, g, b, a = gump:ParseColors (CoolTip.OptionsTable.TextColor)
menuButton.leftText:SetTextColor (r, g, b, a)
else
menuButton.leftText:SetTextColor (1, 1, 1, 1)
end
else
menuButton.leftText:SetTextColor (r, g, b, a)
end
if (CoolTip.OptionsTable.TextSize and not leftTextTable [6]) then
_detalhes:SetFontSize (menuButton.leftText, CoolTip.OptionsTable.TextSize)
@@ -622,22 +637,31 @@ function DetailsCreateCoolTip()
end
if (CoolTip.OptionsTable.TextFont and not leftTextTable [7]) then
menuButton.leftText:SetFontObject (CoolTip.OptionsTable.TextFont)
end
local face, size, flags = menuButton.leftText:GetFont()
if (_G [CoolTip.OptionsTable.TextFont]) then
menuButton.leftText:SetFontObject (GameFontRed or CoolTip.OptionsTable.TextFont)
else
local font = SharedMedia:Fetch ("font", CoolTip.OptionsTable.TextFont)
local _, size, flags = menuButton.leftText:GetFont()
menuButton.leftText:SetFont (font, size, flags)
end
if (_G [leftTextTable [7]]) then
menuButton.leftText:SetFontObject (leftTextTable [7])
local face, size, flags = menuButton.leftText:GetFont()
size = leftTextTable [6] or CoolTip.OptionsTable.TextSize or size
menuButton.leftText:SetFont (face, size, flags)
elseif (leftTextTable [7]) then
if (_G [leftTextTable [7]]) then
menuButton.leftText:SetFontObject (leftTextTable [7])
local face, size, flags = menuButton.leftText:GetFont()
size = leftTextTable [6] or CoolTip.OptionsTable.TextSize or size
menuButton.leftText:SetFont (face, size, flags)
else
local font = SharedMedia:Fetch ("font", leftTextTable [7])
local face, size, flags = menuButton.leftText:GetFont()
size = leftTextTable [6] or CoolTip.OptionsTable.TextSize or size
menuButton.leftText:SetFont (face, size, flags)
end
else
size = leftTextTable [6] or CoolTip.OptionsTable.TextSize or 10
face = leftTextTable [7] or [[Fonts\FRIZQT__.TTF]]
flags = leftTextTable [8]
menuButton.leftText:SetFont (face, size, flags)
end
@@ -647,7 +671,19 @@ function DetailsCreateCoolTip()
if (rightTextTable) then
menuButton.rightText:SetText (rightTextTable [1])
menuButton.rightText:SetTextColor (rightTextTable [2], rightTextTable [3], rightTextTable [4], rightTextTable [5])
local r, g, b, a = rightTextTable [2], rightTextTable [3], rightTextTable [4], rightTextTable [5]
if (r == 0 and g == 0 and b == 0 and a == 0) then
if (CoolTip.OptionsTable.TextColor) then
r, g, b, a = gump:ParseColors (CoolTip.OptionsTable.TextColor)
menuButton.rightText:SetTextColor (r, g, b, a)
else
menuButton.rightText:SetTextColor (1, 1, 1, 1)
end
else
menuButton.rightText:SetTextColor (r, g, b, a)
end
if (CoolTip.OptionsTable.TextSize and not rightTextTable [6]) then
_detalhes:SetFontSize (menuButton.rightText, CoolTip.OptionsTable.TextSize)
@@ -666,19 +702,29 @@ function DetailsCreateCoolTip()
end
if (CoolTip.OptionsTable.TextFont and not rightTextTable [7]) then
menuButton.rightText:SetFontObject (CoolTip.OptionsTable.TextFont)
end
if (_G [CoolTip.OptionsTable.TextFont]) then
menuButton.rightText:SetFontObject (CoolTip.OptionsTable.TextFont)
else
local font = SharedMedia:Fetch ("font", CoolTip.OptionsTable.TextFont)
local _, size, flags = menuButton.rightText:GetFont()
menuButton.rightText:SetFont (font, size, flags)
end
local face, size, flags = menuButton.rightText:GetFont()
elseif (rightTextTable [7]) then
if (_G [rightTextTable [7]]) then
menuButton.rightText:SetFontObject (rightTextTable [7])
local face, size, flags = menuButton.rightText:GetFont()
size = rightTextTable [6] or CoolTip.OptionsTable.TextSize or size
menuButton.rightText:SetFont (face, size, flags)
else
local font = SharedMedia:Fetch ("font", rightTextTable [7])
local face, size, flags = menuButton.rightText:GetFont()
size = rightTextTable [6] or CoolTip.OptionsTable.TextSize or size
menuButton.rightText:SetFont (face, size, flags)
end
if (_G [rightTextTable [7]]) then
menuButton.rightText:SetFontObject (rightTextTable [7])
local face, size, flags = menuButton.rightText:GetFont()
size = rightTextTable [6] or CoolTip.OptionsTable.TextSize or size
menuButton.rightText:SetFont (face, size, flags)
else
size = rightTextTable [6] or 10
size = rightTextTable [6] or CoolTip.OptionsTable.TextSize or 10
face = rightTextTable [7] or [[Fonts\FRIZQT__.TTF]]
flags = rightTextTable [8]
menuButton.rightText:SetFont (face, size, flags)
@@ -1784,10 +1830,10 @@ function DetailsCreateCoolTip()
end
lineTable_left [1] = leftText --> line text
lineTable_left [2] = 1
lineTable_left [3] = 1
lineTable_left [4] = 1
lineTable_left [5] = 1
lineTable_left [2] = 0
lineTable_left [3] = 0
lineTable_left [4] = 0
lineTable_left [5] = 0
lineTable_left [6] = false
lineTable_left [7] = false
lineTable_left [8] = false
@@ -1876,10 +1922,10 @@ function DetailsCreateCoolTip()
end
subMenuTablesTexts [1] = leftText --> line text
subMenuTablesTexts [2] = 1
subMenuTablesTexts [3] = 1
subMenuTablesTexts [4] = 1
subMenuTablesTexts [5] = 1
subMenuTablesTexts [2] = 0
subMenuTablesTexts [3] = 0
subMenuTablesTexts [4] = 0
subMenuTablesTexts [5] = 0
subMenuTablesTexts [6] = false
subMenuTablesTexts [7] = false
subMenuTablesTexts [8] = false
@@ -2233,7 +2279,7 @@ function DetailsCreateCoolTip()
ColorR2, ColorG2, ColorB2, ColorA2, fontSize, fontFace, fontFlag = ColorG1, ColorB1, ColorA1, ColorR2, ColorG2, ColorB2, ColorA2
if (type (ColorR1) == "boolean" or not ColorR1) then
ColorR1, ColorG1, ColorB1, ColorA1 = 1, 1, 1, 1
ColorR1, ColorG1, ColorB1, ColorA1 = 0, 0, 0, 0
else
ColorR1, ColorG1, ColorB1, ColorA1 = gump:ParseColors (ColorR1)
end
@@ -2243,7 +2289,7 @@ function DetailsCreateCoolTip()
fontSize, fontFace, fontFlag = ColorG2, ColorB2, ColorA2
if (type (ColorR2) == "boolean" or not ColorR2) then
ColorR2, ColorG2, ColorB2, ColorA2 = 1, 1, 1, 1
ColorR2, ColorG2, ColorB2, ColorA2 = 0, 0, 0, 0
else
ColorR2, ColorG2, ColorB2, ColorA2 = gump:ParseColors (ColorR2)
end
+28 -12
View File
@@ -613,7 +613,12 @@ function DetailsDropDownOnEnter (self)
end
end
self:SetBackdropColor (.2, .2, .2, .2)
if (self.MyObject.onenter_backdrop) then
self:SetBackdropColor (unpack (self.MyObject.onenter_backdrop))
else
self:SetBackdropColor (.2, .2, .2, .2)
end
self.arrowTexture2:Show()
if (self.MyObject.have_tooltip) then
@@ -635,15 +640,20 @@ function DetailsDropDownOnEnter (self)
end
function DetailsDropDownOnLeave (self)
self:SetBackdropColor (1, 1, 1, .5)
self.arrowTexture2:Hide()
if (self.MyObject.OnLeaveHook) then
local interrupt = self.MyObject.OnLeaveHook (self)
if (interrupt) then
return
end
end
if (self.MyObject.onleave_backdrop) then
self:SetBackdropColor (unpack (self.MyObject.onleave_backdrop))
else
self:SetBackdropColor (1, 1, 1, .5)
end
self.arrowTexture2:Hide()
if (self.MyObject.have_tooltip) then
_detalhes.popup:ShowMe (false)
@@ -790,17 +800,23 @@ function gump:NewDropDown (parent, container, name, member, w, h, func, default)
--> initialize first menu selected
local menu = func()
for i = default, #menu do
local _table = menu [i]
if (not _table) then
break
end
if (isOptionVisible (_table)) then
DropDownObject:Selected (_table)
break
if (type (default) == "string") then
DropDownObject:Select (default)
else
for i = default, #menu do
local _table = menu [i]
if (not _table) then
break
end
if (isOptionVisible (_table)) then
DropDownObject:Selected (_table)
break
end
end
end
return DropDownObject
end
+32 -79
View File
@@ -358,59 +358,11 @@ local _
--> flip
local flip = function (side)
if (side == 1) then
if (not haveHFlip) then
if (not haveVFlip) then
edit_texture:SetTexCoord (1, 0, 0, 1)
else
edit_texture:SetTexCoord (1, 0, 1, 0)
end
rightCoordTexture:Hide()
leftCoordTexture:Hide()
rightSlider:Hide()
leftSlider:Hide()
leftTexCoordButton:Disable()
rightTexCoordButton:Disable()
else
if (not haveVFlip) then
edit_texture:SetTexCoord (0, 1, 0, 1)
else
edit_texture:SetTexCoord (0, 1, 1, 0)
end
rightCoordTexture:Show()
leftCoordTexture:Show()
leftTexCoordButton:Enable()
rightTexCoordButton:Enable()
end
haveHFlip = not haveHFlip
if (window.callback_func) then
window.accept (true)
end
elseif (side == 2) then
if (not haveVFlip) then
if (not haveHFlip) then
edit_texture:SetTexCoord (0, 1, 1, 0)
else
edit_texture:SetTexCoord (1, 0, 1, 0)
end
topCoordTexture:Hide()
bottomCoordTexture:Hide()
topSlider:Hide()
bottomSlider:Hide()
topTexCoordButton:Disable()
bottomTexCoordButton:Disable()
else
if (not haveHFlip) then
edit_texture:SetTexCoord (0, 1, 0, 1)
else
edit_texture:SetTexCoord (1, 0, 0, 1)
end
topCoordTexture:Show()
bottomCoordTexture:Show()
topTexCoordButton:Enable()
bottomTexCoordButton:Enable()
end
haveVFlip = not haveVFlip
if (window.callback_func) then
window.accept (true)
@@ -437,20 +389,22 @@ local _
end
local coords = {}
local l, r, t, b = leftSlider.value/100, rightSlider.value/100, topSlider.value/100, bottomSlider.value/100
if (haveHFlip) then
coords [1] = 1
coords [2] = 0
coords [1] = r
coords [2] = l
else
coords [1] = leftSlider.value/100
coords [2] = rightSlider.value /100
coords [1] = l
coords [2] = r
end
if (haveVFlip) then
coords [3] = 1
coords [4] = 0
coords [3] = b
coords [4] = t
else
coords [3] = topSlider.value/100
coords [4] = bottomSlider.value/100
coords [3] = t
coords [4] = b
end
return window.callback_func (edit_texture.width, edit_texture.height, {edit_texture:GetVertexColor()}, edit_texture:GetAlpha(), coords, window.extra_param)
@@ -459,22 +413,19 @@ local _
local acceptButton = g:NewButton (buttonsBackground, nil, "$parentAcceptButton", nil, 100, 20, window.accept, nil, nil, nil, "DONE")
acceptButton:SetPoint ("topleft", window, "topright", 10, -200)
acceptButton:InstallCustomTexture()
-- fazer botao de editar a cor
-- fazer botao de editar o tamanho
-- fazer botao de okey e retornar os valores
window:Hide()
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
local ttexcoord
function g:ImageEditor (callback, texture, texcoord, colors, width, height, extraParam)
function g:ImageEditor (callback, texture, texcoord, colors, width, height, extraParam, alpha)
texcoord = texcoord or {0, 1, 0, 1}
ttexcoord = texcoord
colors = colors or {1, 1, 1, 1}
alpha = alpha or 1
edit_texture:SetTexture (texture)
edit_texture.width = width
@@ -482,7 +433,7 @@ window:Hide()
edit_texture:SetVertexColor (colors [1], colors [2], colors [3])
edit_texture:SetAlpha (colors [4] or 1)
edit_texture:SetAlpha (alpha)
_detalhes:ScheduleTimer ("RefreshImageEditor", 0.2)
@@ -499,26 +450,28 @@ window:Hide()
window.width = edit_texture.width
window.height = edit_texture.height
if (ttexcoord[1] == 1 and ttexcoord[2] == 0) then
haveHFlip = false
flip (1)
else
local l, r, t, b = unpack (ttexcoord)
if (l > r) then
haveHFlip = true
flip (1)
leftSlider:SetValue (ttexcoord[1]*100)
rightSlider:SetValue (ttexcoord[2]*100)
end
if (ttexcoord[3] == 1 and ttexcoord[4] == 0) then
haveVFlip = false
flip (2)
leftSlider:SetValue (r * 100)
rightSlider:SetValue (l * 100)
else
haveVFlip = true
flip (2)
topSlider:SetValue (ttexcoord[3]*100)
bottomSlider:SetValue (ttexcoord[4]*100)
haveHFlip = false
leftSlider:SetValue (l * 100)
rightSlider:SetValue (r * 100)
end
if (t > b) then
haveVFlip = true
topSlider:SetValue (b * 100)
bottomSlider:SetValue (t * 100)
else
haveVFlip = false
topSlider:SetValue (t * 100)
bottomSlider:SetValue (b * 100)
end
if (window.callback_func) then
window.accept (true)
end
+103 -51
View File
@@ -11,6 +11,7 @@ local _math_floor = math.floor --> lua local
local loadstring = loadstring --> lua local
local Loc = LibStub ("AceLocale-3.0"):GetLocale ( "Details" )
local SharedMedia = LibStub:GetLibrary("LibSharedMedia-3.0")
local cleanfunction = function() end
local APISliderFunctions = false
@@ -315,8 +316,11 @@ local SliderMetaFunctions = {}
slider.thumb:SetAlpha (1)
if (slider.MyObject.have_tooltip) then
GameCooltip:Reset()
_detalhes:CooltipPreset (1)
GameCooltip:AddLine (slider.MyObject.have_tooltip)
if (slider.MyObject.have_tooltip == Loc ["STRING_RIGHTCLICK_TYPEVALUE"]) then
GameCooltip:AddIcon ([[Interface\TUTORIALFRAME\UI-TUTORIAL-FRAME]], 1, 1, 16, 16, 0.015625, 0.15671875, 0.640625, 0.798828125)
end
GameCooltip:ShowCooltip (slider, "tooltip")
end
@@ -474,13 +478,73 @@ local SliderMetaFunctions = {}
end
slider.MyObject.ivalue = amt
end
------------------------------------------------------------------------------------------------------------
--> object constructor
function gump:NewSwitch (parent, container, name, member, w, h, ltext, rtext, defaultv, color_inverted)
local SwitchOnClick = function (self, button, forced_value, value)
local slider = self.MyObject
if (forced_value) then
rawset (slider, "value", not value)
end
if (rawget (slider, "value")) then --actived
rawset (slider, "value", false)
slider._text:SetText (slider._ltext)
slider._thumb:ClearAllPoints()
slider:SetBackdropColor (1, 0, 0, 0.4)
slider._thumb:SetPoint ("left", slider.widget, "left")
else
rawset (slider, "value", true)
slider._text:SetText (slider._rtext)
slider._thumb:ClearAllPoints()
slider:SetBackdropColor (0, 0, 1, 0.4)
slider._thumb:SetPoint ("right", slider.widget, "right")
end
if (slider.OnSwitch and not forced_value) then
local value = rawget (slider, "value")
if (slider.return_func) then
value = slider:return_func (value)
end
slider.OnSwitch (slider, slider.FixedValue, value)
end
end
local default_switch_func = function (self, passed_value)
if (self.value) then
return false
else
return true
end
end
local switch_get_value = function (self)
return self.value
end
local switch_set_value = function (self, value)
if (self.switch_func) then
value = self:switch_func (value)
end
SwitchOnClick (self.widget, nil, true, value)
end
local switch_set_fixparameter = function (self, value)
_rawset (self, "FixedValue", value)
end
function gump:NewSwitch (parent, container, name, member, w, h, ltext, rtext, default_value, color_inverted, switch_func, return_func)
--> early checks
if (not name) then
@@ -496,54 +560,47 @@ function gump:NewSwitch (parent, container, name, member, w, h, ltext, rtext, de
ltext = ltext or "OFF"
rtext = rtext or "ON"
if (type (defaultv) == "boolean" and not defaultv) then
defaultv = 1
elseif (type (defaultv) == "boolean" and defaultv) then
defaultv = 2
else
defaultv = defaultv or 1
end
--> build frames
local slider = gump:NewSlider (parent, container, name, member, w, h, 1, 2, 1, defaultv, nil, true)
local slider = gump:NewButton (parent, container, name, member, w, h)
slider.switch_func = switch_func
slider.return_func = return_func
slider.SetValue = switch_set_value
slider.GetValue = switch_get_value
slider.SetFixedParameter = switch_set_fixparameter
if (member) then
parent [member] = slider
end
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}})
local thumb = slider:CreateTexture (nil, "artwork")
thumb:SetTexture ("Interface\\Buttons\\UI-ScrollBar-Knob")
thumb:SetSize (34+(h*0.2), h*1.2)
thumb:SetAlpha (0.7)
thumb:SetPoint ("left", slider.widget, "left")
local text = slider:CreateFontString (nil, "overlay", "GameFontHighlightSmall")
text:SetTextColor (.8, .8, .8, 1)
text:SetPoint ("center", thumb, "center")
slider._text = text
slider._thumb = thumb
slider._ltext = ltext
slider._rtext = rtext
slider.thumb = thumb
slider.invert_colors = color_inverted
slider:SetHook ("OnValueChange", function (self)
if (slider:GetValue() == 1) then
slider.amt:SetText (ltext)
if (slider.OnSwitch) then
slider.OnSwitch (slider, slider.FixedValue, false)
end
if (not slider.invert_colors) then
slider:SetBackdropColor (1, 0, 0, 0.4)
else
slider:SetBackdropColor (0, 0, 1, 0.4)
end
else
slider.amt:SetText (rtext)
if (slider.OnSwitch) then
slider.OnSwitch (slider, slider.FixedValue, true)
end
if (not slider.invert_colors) then
slider:SetBackdropColor (0, 0, 1, 0.4)
else
slider:SetBackdropColor (1, 0, 0, 0.4)
end
end
return true
end)
slider:SetValue (1)
slider:SetValue (2)
slider:SetValue (defaultv)
slider:SetScript ("OnClick", SwitchOnClick)
slider:SetValue (default_value)
slider.isSwitch = true
return slider
end
@@ -621,17 +678,12 @@ function gump:NewSlider (parent, container, name, member, w, h, min, max, step,
SliderObject.slider:SetValueStep (step)
SliderObject.slider:SetValue (defaultv)
SliderObject.ivalue = defaultv
--SliderObject.amt = _G [name .. "_Amt"]
--SliderObject.lock = _G [name .. "_LockTexture"]
--SliderObject.thumb = _G [name .. "_ThumbTexture"]
SliderObject.slider:SetBackdrop ({edgeFile = "Interface\\Buttons\\UI-SliderBar-Border", edgeSize = 8})
SliderObject.slider:SetBackdropColor (0.9, 0.7, 0.7, 1.0)
SliderObject.thumb = SliderObject.slider:CreateTexture (nil, "artwork")
SliderObject.thumb:SetTexture ("Interface\\Buttons\\UI-ScrollBar-Knob")
--SliderObject.thumb:SetSize (30, 24)
SliderObject.thumb:SetSize (30+(h*0.2), h*1.2)
SliderObject.thumb:SetAlpha (0.7)
SliderObject.slider:SetThumbTexture (SliderObject.thumb)
+2 -5
View File
@@ -260,12 +260,9 @@ local TextEntryMetaFunctions = {}
end
if (textentry.MyObject.have_tooltip) then
GameCooltip:Reset()
GameCooltip:SetType ("tooltip")
GameCooltip:SetColor ("main", "transparent")
_detalhes:CooltipPreset (1)
GameCooltip:AddLine (textentry.MyObject.have_tooltip)
GameCooltip:SetOwner (textentry)
GameCooltip:ShowCooltip()
GameCooltip:ShowCooltip (textentry, "tooltip")
end
textentry.mouse_over = true