- Added options for Micro Displayer over Window Settings on Options Panel.

This commit is contained in:
tercio
2014-10-20 22:23:49 -02:00
parent 5a783e8c60
commit 92e5b40570
4 changed files with 282 additions and 19 deletions
+5 -8
View File
File diff suppressed because one or more lines are too long
+11 -1
View File
@@ -89,7 +89,17 @@ _detalhes.instance_defaults = {
--auto hide menu buttons
auto_hide_menu = {left = false, right = false},
--attribute text
attribute_text = {enabled = false, anchor = {5, 1}, text_face = "Friz Quadrata TT", text_size = 12, text_color = {1, 1, 1, 1}, side = 1, shadow = false},
attribute_text = {
enabled = false,
anchor = {5, 1},
text_face = "Friz Quadrata TT",
text_size = 12,
text_color = {1, 1, 1, 1},
side = 1,
shadow = false,
enable_custom_text = false,
custom_text = "{name}"
},
--auto hide window borders statusbar main menu
menu_alpha = {enabled = false, iconstoo = true, onenter = 1, onleave = 1, ignorebars = false},
--instance button anchor store the anchor point of instance and delete button
+26 -10
View File
@@ -31,17 +31,21 @@
--> hida all micro frames
function _detalhes.StatusBar:Hide (instance, side)
if (not side) then
instance.StatusBar.center.frame:Hide()
instance.StatusBar.left.frame:Hide()
instance.StatusBar.right.frame:Hide()
if (instance.StatusBar.center and instance.StatusBar.left and instance.StatusBar.right) then
instance.StatusBar.center.frame:Hide()
instance.StatusBar.left.frame:Hide()
instance.StatusBar.right.frame:Hide()
end
end
end
function _detalhes.StatusBar:Show (instance, side)
if (not side) then
instance.StatusBar.center.frame:Show()
instance.StatusBar.left.frame:Show()
instance.StatusBar.right.frame:Show()
if (instance.StatusBar.center and instance.StatusBar.left and instance.StatusBar.right) then
instance.StatusBar.center.frame:Show()
instance.StatusBar.left.frame:Show()
instance.StatusBar.right.frame:Show()
end
end
end
@@ -189,6 +193,10 @@
if (instance.StatusBar.left) then
_detalhes.StatusBar:SetLeftPlugin (instance, instance.StatusBar.left)
end
if (not instance.show_statusbar and instance.micro_displays_side == 2) then
_detalhes.StatusBar:Hide (instance)
end
end
@@ -265,10 +273,15 @@
end
function _detalhes.StatusBar:SetPlugin (instance, absolute_name, anchor)
local index = _detalhes.StatusBar:GetIndexFromAbsoluteName (absolute_name)
if (index and anchor) then
if (absolute_name == -1) then --> none
anchor = string.lower (anchor)
ChoosePlugin (nil, nil, index, instance.StatusBar [anchor], anchor)
ChoosePlugin (nil, nil, -1, instance.StatusBar [anchor], anchor)
else
local index = _detalhes.StatusBar:GetIndexFromAbsoluteName (absolute_name)
if (index and anchor) then
anchor = string.lower (anchor)
ChoosePlugin (nil, nil, index, instance.StatusBar [anchor], anchor)
end
end
end
@@ -464,7 +477,7 @@
--> build-in function for create a frame for an plugin child
function _detalhes.StatusBar:CreateChildFrame (instance, name, w, h)
--local frame = _detalhes.gump:NewPanel (instance.baseframe.cabecalho.fechar, nil, name..instance:GetInstanceId(), nil, w or DEFAULT_CHILD_WIDTH, h or DEFAULT_CHILD_HEIGHT, false)
local frame = _detalhes.gump:NewPanel (instance.baseframe.DOWNFrame, nil, name..instance:GetInstanceId(), nil, w or DEFAULT_CHILD_WIDTH, h or DEFAULT_CHILD_HEIGHT, false)
local frame = _detalhes.gump:NewPanel (instance.baseframe, nil, name..instance:GetInstanceId(), nil, w or DEFAULT_CHILD_WIDTH, h or DEFAULT_CHILD_HEIGHT, false)
--create widgets
local text = _detalhes.gump:NewLabel (frame, nil, "$parentText", "text", "0")
@@ -1453,6 +1466,8 @@ window.locked = false
window.close_with_right = true
window.child = nil
window.instance = nil
window:SetFrameStrata ("FULLSCREEN")
window:DisableGradient()
local extraWindow = _detalhes.gump:NewPanel (window, nil, "DetailsStatusBarOptions2", "extra", 300, 180)
extraWindow:SetPoint ("left", window, "right")
@@ -1461,6 +1476,7 @@ extraWindow.locked = false
extraWindow:SetHook ("OnHide", function()
window:Hide()
end)
extraWindow:DisableGradient()
--> text style
_detalhes.gump:NewLabel (window, _, "$parentTextStyleLabel", "textstyle", Loc ["STRING_PLUGINOPTIONS_TEXTSTYLE"])
+240
View File
@@ -5518,11 +5518,194 @@ function window:CreateFrame6()
frame6.instanceMicroDisplaysSideSlider:SetPoint ("left", frame6.instanceMicroDisplaysSideLabel, "right", 2)
frame6.instanceMicroDisplaysSideSlider.OnSwitch = function (self, instance, value)
instance:MicroDisplaysSide (value, true)
window:update_microframes()
end
frame6.instanceMicroDisplaysSideSlider.thumb:SetSize (50, 12)
window:CreateLineBackground2 (frame6, "instanceMicroDisplaysSideSlider", "instanceMicroDisplaysSideLabel", Loc ["STRING_OPTIONS_MICRODISPLAYSSIDE_DESC"])
--> micro displays selection
g:NewLabel (frame6, _, "$parentMicroDisplaysAnchor", "MicroDisplaysAnchor", Loc ["STRING_OPTIONS_MICRODISPLAY_ANCHOR"], "GameFontNormal")
g:NewLabel (frame6, _, "$parentMicroDisplayLeftLabel", "MicroDisplayLeftLabel", Loc ["STRING_ANCHOR_LEFT"], "GameFontHighlightLeft")
g:NewLabel (frame6, _, "$parentMicroDisplayCenterLabel", "MicroDisplayCenterLabel", Loc ["STRING_CENTER_UPPER"], "GameFontHighlightLeft")
g:NewLabel (frame6, _, "$parentMicroDisplayRightLabel", "MicroDisplayRightLabel", Loc ["STRING_ANCHOR_RIGHT"], "GameFontHighlightLeft")
g:NewLabel (frame6, _, "$parentMicroDisplayWarningLabel", "MicroDisplayWarningLabel", Loc ["STRING_OPTIONS_MICRODISPLAYS_WARNING"], "GameFontHighlightSmall", 10, "orange")
local OnMicroDisplaySelect = function (_, instance, micro_display)
local anchor, index = unpack (micro_display)
if (index == -1) then
return _detalhes.StatusBar:SetPlugin (instance, -1, anchor)
end
local absolute_name = _detalhes.StatusBar.Plugins [index].real_name
_detalhes.StatusBar:SetPlugin (instance, absolute_name, anchor)
window:update_microframes()
end
local BuildLeftMicroMenu = function()
local options = {}
--options [1] = {value = {"left", -1}, label = Loc ["STRING_PLUGIN_CLEAN"], onclick = OnMicroDisplaySelect, icon = [[Interface\Buttons\UI-GroupLoot-Pass-Down]]}
for index, _name_and_icon in ipairs (_detalhes.StatusBar.Menu) do
options [#options+1] = {value = {"left", index}, label = _name_and_icon [1], onclick = OnMicroDisplaySelect, icon = _name_and_icon [2]}
end
return options
end
local BuildCenterMicroMenu = function()
local options = {}
--options [1] = {value = {"center", -1}, label = Loc ["STRING_PLUGIN_CLEAN"], onclick = OnMicroDisplaySelect, icon = [[Interface\Buttons\UI-GroupLoot-Pass-Down]]}
for index, _name_and_icon in ipairs (_detalhes.StatusBar.Menu) do
options [#options+1] = {value = {"center", index}, label = _name_and_icon [1], onclick = OnMicroDisplaySelect, icon = _name_and_icon [2]}
end
return options
end
local BuildRightMicroMenu = function()
local options = {}
--options [1] = {value = {"right", -1}, label = Loc ["STRING_PLUGIN_CLEAN"], onclick = OnMicroDisplaySelect, icon = [[Interface\Buttons\UI-GroupLoot-Pass-Down]]}
for index, _name_and_icon in ipairs (_detalhes.StatusBar.Menu) do
options [#options+1] = {value = {"right", index}, label = _name_and_icon [1], onclick = OnMicroDisplaySelect, icon = _name_and_icon [2]}
end
return options
end
local d = g:NewDropDown (frame6, _, "$parentMicroDisplayLeftDropdown", "MicroDisplayLeftDropdown", DROPDOWN_WIDTH, 20, BuildLeftMicroMenu, nil)
d.onenter_backdrop = dropdown_backdrop_onenter
d.onleave_backdrop = dropdown_backdrop_onleave
d:SetBackdrop (dropdown_backdrop)
d:SetBackdropColor (unpack (dropdown_backdrop_onleave))
local d = g:NewDropDown (frame6, _, "$parentMicroDisplayCenterDropdown", "MicroDisplayCenterDropdown", DROPDOWN_WIDTH, 20, BuildCenterMicroMenu, nil)
d.onenter_backdrop = dropdown_backdrop_onenter
d.onleave_backdrop = dropdown_backdrop_onleave
d:SetBackdrop (dropdown_backdrop)
d:SetBackdropColor (unpack (dropdown_backdrop_onleave))
local d = g:NewDropDown (frame6, _, "$parentMicroDisplayRightDropdown", "MicroDisplayRightDropdown", DROPDOWN_WIDTH, 20, BuildRightMicroMenu, nil)
d.onenter_backdrop = dropdown_backdrop_onenter
d.onleave_backdrop = dropdown_backdrop_onleave
d:SetBackdrop (dropdown_backdrop)
d:SetBackdropColor (unpack (dropdown_backdrop_onleave))
frame6.MicroDisplayLeftDropdown:SetPoint ("left", frame6.MicroDisplayLeftLabel, "right", 2)
frame6.MicroDisplayCenterDropdown:SetPoint ("left", frame6.MicroDisplayCenterLabel, "right", 2)
frame6.MicroDisplayRightDropdown:SetPoint ("left", frame6.MicroDisplayRightLabel, "right", 2)
window:CreateLineBackground2 (frame6, "MicroDisplayLeftDropdown", "MicroDisplayLeftLabel", Loc ["STRING_OPTIONS_MICRODISPLAYS_DROPDOWN_TOOLTIP"])
window:CreateLineBackground2 (frame6, "MicroDisplayCenterDropdown", "MicroDisplayCenterLabel", Loc ["STRING_OPTIONS_MICRODISPLAYS_DROPDOWN_TOOLTIP"])
window:CreateLineBackground2 (frame6, "MicroDisplayRightDropdown", "MicroDisplayRightLabel", Loc ["STRING_OPTIONS_MICRODISPLAYS_DROPDOWN_TOOLTIP"])
local HideLeftMicroFrameButton = g:NewButton (frame6.MicroDisplayLeftDropdown, _, "$parentHideLeftMicroFrameButton", "HideLeftMicroFrameButton", 22, 22, function (_, _, self)
if (_G.DetailsOptionsWindow.instance.StatusBar ["left"].options.isHidden) then
_detalhes.StatusBar:SetPlugin (_G.DetailsOptionsWindow.instance, _G.DetailsOptionsWindow.instance.StatusBar ["left"].real_name, "left")
else
_detalhes.StatusBar:SetPlugin (_G.DetailsOptionsWindow.instance, -1, "left")
end
if (_G.DetailsOptionsWindow.instance.StatusBar ["left"].options.isHidden) then
self:GetNormalTexture():SetDesaturated (false)
else
self:GetNormalTexture():SetDesaturated (true)
end
end)
HideLeftMicroFrameButton:SetPoint ("left", frame6.MicroDisplayLeftDropdown, "right", 2, 0)
HideLeftMicroFrameButton:SetNormalTexture ([[Interface\Buttons\UI-GroupLoot-Pass-Down]])
--HideLeftMicroFrameButton:SetHighlightTexture ([[Interface\Buttons\UI-GROUPLOOT-PASS-HIGHLIGHT]])
HideLeftMicroFrameButton:SetPushedTexture ([[Interface\Buttons\UI-GroupLoot-Pass-Up]])
HideLeftMicroFrameButton:GetNormalTexture():SetDesaturated (true)
HideLeftMicroFrameButton.tooltip = Loc ["STRING_OPTIONS_MICRODISPLAYS_SHOWHIDE_TOOLTIP"]
HideLeftMicroFrameButton:SetHook ("OnEnter", function (self, capsule)
self:GetNormalTexture():SetBlendMode("ADD")
end)
HideLeftMicroFrameButton:SetHook ("OnLeave", function (self, capsule)
self:GetNormalTexture():SetBlendMode("BLEND")
end)
local HideCenterMicroFrameButton = g:NewButton (frame6.MicroDisplayCenterDropdown, _, "$parentHideCenterMicroFrameButton", "HideCenterMicroFrameButton", 22, 22, function (_, _, self)
if (_G.DetailsOptionsWindow.instance.StatusBar ["center"].options.isHidden) then
_detalhes.StatusBar:SetPlugin (_G.DetailsOptionsWindow.instance, _G.DetailsOptionsWindow.instance.StatusBar ["center"].real_name, "center")
else
_detalhes.StatusBar:SetPlugin (_G.DetailsOptionsWindow.instance, -1, "center")
end
if (_G.DetailsOptionsWindow.instance.StatusBar ["center"].options.isHidden) then
self:GetNormalTexture():SetDesaturated (false)
else
self:GetNormalTexture():SetDesaturated (true)
end
end)
HideCenterMicroFrameButton:SetPoint ("left", frame6.MicroDisplayCenterDropdown, "right", 2, 0)
HideCenterMicroFrameButton:SetNormalTexture ([[Interface\Buttons\UI-GroupLoot-Pass-Down]])
--HideCenterMicroFrameButton:SetHighlightTexture ([[Interface\Buttons\UI-GROUPLOOT-PASS-HIGHLIGHT]])
HideCenterMicroFrameButton:SetPushedTexture ([[Interface\Buttons\UI-GroupLoot-Pass-Up]])
HideCenterMicroFrameButton:GetNormalTexture():SetDesaturated (true)
HideCenterMicroFrameButton.tooltip = Loc ["STRING_OPTIONS_MICRODISPLAYS_SHOWHIDE_TOOLTIP"]
HideCenterMicroFrameButton:SetHook ("OnEnter", function (self, capsule)
self:GetNormalTexture():SetBlendMode("ADD")
end)
HideCenterMicroFrameButton:SetHook ("OnLeave", function (self, capsule)
self:GetNormalTexture():SetBlendMode("BLEND")
end)
local HideRightMicroFrameButton = g:NewButton (frame6.MicroDisplayRightDropdown, _, "$parentHideRightMicroFrameButton", "HideRightMicroFrameButton", 20, 20, function (_, _, self)
if (_G.DetailsOptionsWindow.instance.StatusBar ["right"].options.isHidden) then
_detalhes.StatusBar:SetPlugin (_G.DetailsOptionsWindow.instance, _G.DetailsOptionsWindow.instance.StatusBar ["right"].real_name, "right")
else
_detalhes.StatusBar:SetPlugin (_G.DetailsOptionsWindow.instance, -1, "right")
end
if (_G.DetailsOptionsWindow.instance.StatusBar ["right"].options.isHidden) then
self:GetNormalTexture():SetDesaturated (false)
else
self:GetNormalTexture():SetDesaturated (true)
end
end)
HideRightMicroFrameButton:SetPoint ("left", frame6.MicroDisplayRightDropdown, "right", 2, 0)
HideRightMicroFrameButton:SetNormalTexture ([[Interface\Buttons\UI-GroupLoot-Pass-Down]])
--HideRightMicroFrameButton:SetHighlightTexture ([[Interface\Buttons\UI-GROUPLOOT-PASS-HIGHLIGHT]])
HideRightMicroFrameButton:SetPushedTexture ([[Interface\Buttons\UI-GroupLoot-Pass-Up]])
HideRightMicroFrameButton:GetNormalTexture():SetDesaturated (true)
HideRightMicroFrameButton.tooltip = Loc ["STRING_OPTIONS_MICRODISPLAYS_SHOWHIDE_TOOLTIP"]
HideRightMicroFrameButton:SetHook ("OnEnter", function (self, capsule)
self:GetNormalTexture():SetBlendMode("ADD")
end)
HideRightMicroFrameButton:SetHook ("OnLeave", function (self, capsule)
self:GetNormalTexture():SetBlendMode("BLEND")
end)
-------------
local ConfigRightMicroFrameButton = g:NewButton (frame6.MicroDisplayRightDropdown, _, "$parentConfigRightMicroFrameButton", "ConfigRightMicroFrameButton", 18, 18, function (_, _, self)
_G.DetailsOptionsWindow.instance.StatusBar ["right"]:Setup()
_G.DetailsOptionsWindow.instance.StatusBar ["right"]:Setup()
end)
ConfigRightMicroFrameButton:SetPoint ("left", HideRightMicroFrameButton, "right", 1, -1)
ConfigRightMicroFrameButton:SetNormalTexture ([[Interface\Buttons\UI-OptionsButton]])
ConfigRightMicroFrameButton:SetHighlightTexture ([[Interface\Buttons\UI-OptionsButton]])
ConfigRightMicroFrameButton.tooltip = Loc ["STRING_OPTIONS_MICRODISPLAYS_OPTION_TOOLTIP"]
local ConfigCenterMicroFrameButton = g:NewButton (frame6.MicroDisplayCenterDropdown, _, "$parentConfigCenterMicroFrameButton", "ConfigCenterMicroFrameButton", 18, 18, function (_, _, self)
_G.DetailsOptionsWindow.instance.StatusBar ["center"]:Setup()
_G.DetailsOptionsWindow.instance.StatusBar ["center"]:Setup()
end)
ConfigCenterMicroFrameButton:SetPoint ("left", HideCenterMicroFrameButton, "right", 1, -1)
ConfigCenterMicroFrameButton:SetNormalTexture ([[Interface\Buttons\UI-OptionsButton]])
ConfigCenterMicroFrameButton:SetHighlightTexture ([[Interface\Buttons\UI-OptionsButton]])
ConfigCenterMicroFrameButton.tooltip = Loc ["STRING_OPTIONS_MICRODISPLAYS_OPTION_TOOLTIP"]
local ConfigLeftMicroFrameButton = g:NewButton (frame6.MicroDisplayLeftDropdown, _, "$parentConfigLeftMicroFrameButton", "ConfigLeftMicroFrameButton", 18, 18, function (_, _, self)
_G.DetailsOptionsWindow.instance.StatusBar ["left"]:Setup()
_G.DetailsOptionsWindow.instance.StatusBar ["left"]:Setup()
end)
ConfigLeftMicroFrameButton:SetPoint ("left", HideLeftMicroFrameButton, "right", 1, -1)
ConfigLeftMicroFrameButton:SetNormalTexture ([[Interface\Buttons\UI-OptionsButton]])
ConfigLeftMicroFrameButton:SetHighlightTexture ([[Interface\Buttons\UI-OptionsButton]])
ConfigLeftMicroFrameButton.tooltip = Loc ["STRING_OPTIONS_MICRODISPLAYS_OPTION_TOOLTIP"]
-- local instance = _G.DetailsOptionsWindow.instance
-- /dump _detalhes:GetInstance(1).StatusBar ["left"].real_name
--> show side bars
g:NewLabel (frame6, _, "$parentSideBarsLabel", "sideBarsLabel", Loc ["STRING_OPTIONS_SHOW_SIDEBARS"], "GameFontHighlightLeft")
@@ -5550,6 +5733,7 @@ function window:CreateFrame6()
instance:HideStatusBar()
end
instance:BaseFrameSnap()
window:update_microframes()
end
window:CreateLineBackground2 (frame6, "statusbarSlider", "statusbarLabel", Loc ["STRING_OPTIONS_SHOW_STATUSBAR_DESC"])
@@ -5668,6 +5852,11 @@ function window:CreateFrame6()
{"statusbarAnchorLabel", 1, true},
{"statusbarLabel", 2},
{"statusbarColorLabel", 3},
{"MicroDisplaysAnchor", 4, true},
{"MicroDisplayLeftLabel", 5},
{"MicroDisplayCenterLabel", 6},
{"MicroDisplayRightLabel", 7},
{"MicroDisplayWarningLabel", 8, true},
}
window:arrange_menu (frame6, right_side, window.right_start_at, window.top_start_at)
@@ -7903,6 +8092,46 @@ end --> if not window
_G.DetailsOptionsWindow1LockButton.MyObject:SetText (Loc ["STRING_OPTIONS_WC_LOCK"])
end
end
function window:update_microframes()
local instance = _G.DetailsOptionsWindow.instance
local hide_left_button = _G.DetailsOptionsWindow6MicroDisplayLeftDropdown.MyObject.HideLeftMicroFrameButton
if (instance.StatusBar ["left"].options.isHidden) then
hide_left_button:GetNormalTexture():SetDesaturated (false)
else
hide_left_button:GetNormalTexture():SetDesaturated (true)
end
local hide_center_button = _G.DetailsOptionsWindow6MicroDisplayCenterDropdown.MyObject.HideCenterMicroFrameButton
if (instance.StatusBar ["center"].options.isHidden) then
hide_center_button:GetNormalTexture():SetDesaturated (false)
else
hide_center_button:GetNormalTexture():SetDesaturated (true)
end
local hide_right_button = _G.DetailsOptionsWindow6MicroDisplayRightDropdown.MyObject.HideRightMicroFrameButton
if (instance.StatusBar ["right"].options.isHidden) then
hide_right_button:GetNormalTexture():SetDesaturated (false)
else
hide_right_button:GetNormalTexture():SetDesaturated (true)
end
local left = instance.StatusBar ["left"].__name
local center = instance.StatusBar ["center"].__name
local right = instance.StatusBar ["right"].__name
_G.DetailsOptionsWindow6MicroDisplayLeftDropdown.MyObject:Select (left)
_G.DetailsOptionsWindow6MicroDisplayCenterDropdown.MyObject:Select (center)
_G.DetailsOptionsWindow6MicroDisplayRightDropdown.MyObject:Select (right)
if (not instance.show_statusbar and instance.micro_displays_side == 2) then
_G.DetailsOptionsWindow6.MicroDisplayWarningLabel:Show()
else
_G.DetailsOptionsWindow6.MicroDisplayWarningLabel:Hide()
end
end
function window:update_all (editing_instance, section)
@@ -8097,6 +8326,17 @@ end --> if not window
_G.DetailsOptionsWindow6WindowScaleSlider.MyObject:SetFixedParameter (editing_instance)
_G.DetailsOptionsWindow6WindowScaleSlider.MyObject:SetValue (editing_instance.window_scale)
----
_G.DetailsOptionsWindow6MicroDisplayLeftDropdown.MyObject:SetFixedParameter (editing_instance)
_G.DetailsOptionsWindow6MicroDisplayCenterDropdown.MyObject:SetFixedParameter (editing_instance)
_G.DetailsOptionsWindow6MicroDisplayRightDropdown.MyObject:SetFixedParameter (editing_instance)
--_detalhes.StatusBar.Plugins[1].real_name
--_detalhes.StatusBar.Plugins[1].__name
window:update_microframes()
--> window 7
_G.DetailsOptionsWindow7MenuIconShadowSlider.MyObject:SetFixedParameter (editing_instance)
_G.DetailsOptionsWindow7MenuIconShadowSlider.MyObject:SetValue (editing_instance.menu_icons.shadow)