- Added hotcorner support.

This commit is contained in:
tercio
2014-08-10 14:03:33 -03:00
parent 6fab96bf5c
commit 334bcba985
6 changed files with 124 additions and 174 deletions
+5 -17
View File
File diff suppressed because one or more lines are too long
+31 -19
View File
@@ -170,24 +170,25 @@
end
local mostrando = self.mostrando
--
--> get sizes
local baseframe_width = self.baseframe:GetWidth()
local baseframe_height = self.baseframe:GetHeight()
if (not baseframe_width) then
return _detalhes:ScheduleTimer ("SaveMainWindowPosition", 1, self)
end
--
--> calc position
local xOfs, yOfs = self.baseframe:GetCenter()
if (not xOfs) then
return _detalhes:ScheduleTimer ("SaveMainWindowPosition", 1, self)
end
--
local _scale = self.baseframe:GetEffectiveScale()
local _UIscale = _UIParent:GetScale()
--
xOfs = xOfs*_scale - _GetScreenWidth()*_UIscale/2
yOfs = yOfs*_scale - _GetScreenHeight()*_UIscale/2
--> save the position
local _w = baseframe_width
local _h = baseframe_height
local _x = xOfs/_UIscale
@@ -198,6 +199,7 @@
self.posicao[mostrando].w = _w
self.posicao[mostrando].h = _h
--> update the 4 points for window groups
local metade_largura = _w/2
local metade_altura = _h/2
@@ -1459,7 +1461,7 @@
end
--> minimap icon and hotcorner
function _detalhes:RegisterMinimapAndHotCorner()
function _detalhes:RegisterMinimap()
local LDB = LibStub ("LibDataBroker-1.1", true)
local LDBIcon = LDB and LibStub ("LibDBIcon-1.0", true)
@@ -1572,7 +1574,9 @@
_detalhes.databroker = databroker
end
end
function _detalhes:DoRegisterHotCorner()
--register lib-hotcorners
local on_click_on_hotcorner_button = function (frame, button)
if (_detalhes.hotcorner_topleft.onclick_what_todo == 1) then
@@ -1589,20 +1593,19 @@
_detalhes.tabela_historico:resetar()
end
end
local quickclick_func1 = function (frame, button)
_detalhes.tabela_historico:resetar()
end
local on_click_on_quickclick_button = function (frame, button)
if (_detalhes.hotcorner_topleft.quickclick_what_todo == 1) then
local lower_instance = _detalhes:GetLowerInstanceNumber()
if (not lower_instance) then
local instance = _detalhes:GetInstance (1)
_detalhes.CriarInstancia (_, _, 1)
_detalhes:OpenOptionsWindow (instance)
else
_detalhes:OpenOptionsWindow (_detalhes:GetInstance (lower_instance))
end
elseif (_detalhes.hotcorner_topleft.quickclick_what_todo == 2) then
_detalhes.tabela_historico:resetar()
local quickclick_func2 = function (frame, button)
local lower_instance = _detalhes:GetLowerInstanceNumber()
if (not lower_instance) then
local instance = _detalhes:GetInstance (1)
_detalhes.CriarInstancia (_, _, 1)
_detalhes:OpenOptionsWindow (instance)
else
_detalhes:OpenOptionsWindow (_detalhes:GetInstance (lower_instance))
end
end
@@ -1636,7 +1639,16 @@
--> menus
nil,
--> quick click
on_click_on_quickclick_button
{
{func = quickclick_func1, name = "Details! - Reset Data"},
{func = quickclick_func2, name = "Details! - Open Options"}
},
--> onenter
nil,
--> onleave
nil,
--> is install
true
)
end
end
+2 -2
View File
@@ -664,9 +664,9 @@ local default_profile = {
},
--> minimap
minimap = {hide = false, radius = 160, minimapPos = 220, onclick_what_todo = 1, text_type = 1, HotCornerIgnore = true},
minimap = {hide = false, radius = 160, minimapPos = 220, onclick_what_todo = 1, text_type = 1},
--> horcorner
hotcorner_topleft = {hide = false, onclick_what_todo = 1, topleft_quickclick = true, quickclick_what_todo = 2},
hotcorner_topleft = {hide = false},
--> PvP
only_pvp_frags = false,
+5 -66
View File
@@ -1416,63 +1416,10 @@ function window:CreateFrame19()
frame19.hotcornerSlider:SetPoint ("left", frame19.hotcornerLabel, "right", 2, 0)
frame19.hotcornerSlider.OnSwitch = function (self, _, value)
_detalhes:HideHotCornerButton ("Details!", "TOPLEFT", not value)
_G.HotCorners:HideHotCornerButton ("Details!", "TOPLEFT", not value)
end
window:CreateLineBackground2 (frame19, "hotcornerSlider", "hotcornerLabel", Loc ["STRING_OPTIONS_HOTCORNER_DESC"])
--on click action
do
g:NewLabel (frame19, _, "$parentHotcornerActionLabel", "hotcornerActionLabel", Loc ["STRING_OPTIONS_HOTCORNER_ACTION"], "GameFontHighlightLeft")
local on_select = function (_, _, option)
_detalhes.hotcorner_topleft.onclick_what_todo = option
end
local build_menu = function()
return {
{value = 1, label = Loc ["STRING_OPTIONS_MINIMAP_ACTION1"], onclick = on_select, icon = [[Interface\FriendsFrame\FriendsFrameScrollIcon]]},
{value = 2, label = Loc ["STRING_OPTIONS_MINIMAP_ACTION2"], onclick = on_select, icon = [[Interface\Buttons\UI-GuildButton-PublicNote-Up]], iconcolor = {1, .8, 0, 1}},
}
end
local dropdown = g:NewDropDown (frame19, _, "$parentHotcornerActionDropdown", "hotcornerActionDropdown", 160, 20, build_menu, _detalhes.hotcorner_topleft.onclick_what_todo)
dropdown.onenter_backdrop = dropdown_backdrop_onenter
dropdown.onleave_backdrop = dropdown_backdrop_onleave
dropdown:SetBackdrop (dropdown_backdrop)
dropdown:SetBackdropColor (unpack (dropdown_backdrop_onleave))
frame19.hotcornerActionDropdown:SetPoint ("left", frame19.hotcornerActionLabel, "right", 2, 0)
window:CreateLineBackground2 (frame19, "hotcornerActionDropdown", "hotcornerActionLabel", Loc ["STRING_OPTIONS_HOTCORNER_ACTION_DESC"])
end
--quick click enabled
g:NewLabel (frame19, _, "$parentHotcornerQuickClickLabel", "hotcornerQuickClickLabel", Loc ["STRING_OPTIONS_HOTCORNER_QUICK_CLICK"], "GameFontHighlightLeft")
g:NewSwitch (frame19, _, "$parentHotcornerQuickClickSlider", "hotcornerQuickClickSlider", 60, 20, _, _, _detalhes.hotcorner_topleft.topleft_quick_click)
frame19.hotcornerQuickClickSlider:SetPoint ("left", frame19.hotcornerQuickClickLabel, "right", 2, 0)
frame19.hotcornerQuickClickSlider.OnSwitch = function (self, _, value)
_detalhes:QuickHotCornerEnable ("Details!", "TOPLEFT", value)
end
window:CreateLineBackground2 (frame19, "hotcornerQuickClickSlider", "hotcornerQuickClickLabel", Loc ["STRING_OPTIONS_HOTCORNER_QUICK_CLICK_DESC"])
--quick click function
do
g:NewLabel (frame19, _, "$parentQuickClickLabel", "quickClickLabel", Loc ["STRING_OPTIONS_HOTCORNER_QUICK_CLICK_FUNC"], "GameFontHighlightLeft")
local on_select = function (_, _, option)
_detalhes.hotcorner_topleft.quickclick_what_todo = option
end
local build_menu = function()
return {
{value = 1, label = Loc ["STRING_OPTIONS_MINIMAP_ACTION1"], onclick = on_select, icon = [[Interface\FriendsFrame\FriendsFrameScrollIcon]]},
{value = 2, label = Loc ["STRING_OPTIONS_MINIMAP_ACTION2"], onclick = on_select, icon = [[Interface\Buttons\UI-GuildButton-PublicNote-Up]], iconcolor = {1, .8, 0, 1}},
}
end
local dropdown = g:NewDropDown (frame19, _, "$parentQuickClickDropdown", "quickClickDropdown", 160, 20, build_menu, _detalhes.hotcorner_topleft.quickclick_what_todo)
dropdown.onenter_backdrop = dropdown_backdrop_onenter
dropdown.onleave_backdrop = dropdown_backdrop_onleave
dropdown:SetBackdrop (dropdown_backdrop)
dropdown:SetBackdropColor (unpack (dropdown_backdrop_onleave))
frame19.quickClickDropdown:SetPoint ("left", frame19.quickClickLabel, "right", 2, 0)
window:CreateLineBackground2 (frame19, "quickClickDropdown", "quickClickLabel", Loc ["STRING_OPTIONS_HOTCORNER_QUICK_CLICK_FUNC_DESC"])
end
--> broker
--anchor
g:NewLabel (frame19, _, "$parentHotcornerAnchor", "brokerAnchorLabel", Loc ["STRING_OPTIONS_DATABROKER"], "GameFontNormal")
@@ -1520,11 +1467,8 @@ function window:CreateFrame19()
{"minimapActionLabel", 3},
{"hotcornerAnchorLabel", 4, true},
{"hotcornerLabel", 5},
{"hotcornerActionLabel", 6},
{"hotcornerQuickClickLabel", 7},
{"quickClickLabel", 8},
{"brokerAnchorLabel", 9, true},
{"brokerTextLabel", 10},
{"brokerAnchorLabel", 6, true},
{"brokerTextLabel", 7},
}
window:arrange_menu (frame19, left_side, x, -90)
@@ -7679,20 +7623,15 @@ function window:update_all (editing_instance)
--> window 19
_G.DetailsOptionsWindow19MinimapSlider.MyObject:SetValue (not _detalhes.minimap.hide)
_G.DetailsOptionsWindow19MinimapActionDropdown.MyObject:Select (_detalhes.minimap.onclick_what_todo)
_G.DetailsOptionsWindow19HotcornerSlider.MyObject:SetValue (not _detalhes.hotcorner_topleft.hide)
_G.DetailsOptionsWindow19HotcornerActionDropdown.MyObject:Select (_detalhes.hotcorner_topleft.onclick_what_todo)
_G.DetailsOptionsWindow19HotcornerQuickClickSlider.MyObject:SetValue (_detalhes.hotcorner_topleft.topleft_quickclick)
_G.DetailsOptionsWindow19QuickClickDropdown.MyObject:Select (_detalhes.hotcorner_topleft.quickclick_what_todo)
_G.DetailsOptionsWindow19BrokerTextDropdown.MyObject:Select (_detalhes.minimap.text_type)
if (not _G.HotCorners) then
_G.DetailsOptionsWindow19HotcornerSlider.MyObject:Disable()
_G.DetailsOptionsWindow19HotcornerActionDropdown.MyObject:Disable()
_G.DetailsOptionsWindow19HotcornerQuickClickSlider.MyObject:Disable()
_G.DetailsOptionsWindow19QuickClickDropdown.MyObject:Disable()
if (not _G.DetailsOptionsWindow19HotcornerAnchor.MyObject:GetText():find ("not installed")) then
_G.DetailsOptionsWindow19HotcornerAnchor.MyObject:SetText (_G.DetailsOptionsWindow19HotcornerAnchor.MyObject:GetText() .. " |cFFFF5555(not installed)|r")
end
else
_G.DetailsOptionsWindow19HotcornerSlider.MyObject:SetValue (not _detalhes.hotcorner_topleft.hide)
end
--> window 20
+75 -68
View File
@@ -2310,24 +2310,29 @@ function gump:CriaJanelaPrincipal (ID, instancia, criando)
-- main frames -----------------------------------------------------------------------------------------------------------------------------------------------
local baseframe = CreateFrame ("scrollframe", "DetailsBaseFrame"..ID, _UIParent) --> main frame
--> create the base frame, everything connect in this frame except the rows.
local baseframe = CreateFrame ("scrollframe", "DetailsBaseFrame"..ID, _UIParent)
baseframe.instance = instancia
baseframe:SetFrameStrata (baseframe_strata)
baseframe:SetFrameLevel (2)
local backgroundframe = CreateFrame ("scrollframe", "Details_WindowFrame"..ID, baseframe) --> main window
local backgrounddisplay = CreateFrame ("frame", "Details_GumpFrame"..ID, backgroundframe) --> background window
--> background holds the wallpaper, alert strings ans textures, have setallpoints on baseframe
--> backgrounddisplay is a scrollschild of backgroundframe
local backgroundframe = CreateFrame ("scrollframe", "Details_WindowFrame"..ID, baseframe)
local backgrounddisplay = CreateFrame ("frame", "Details_GumpFrame"..ID, backgroundframe)
backgroundframe:SetFrameLevel (3)
backgrounddisplay:SetFrameLevel (3)
backgroundframe.instance = instancia
backgrounddisplay.instance = instancia
local rowframe = CreateFrame ("frame", "DetailsRowFrame"..ID, _UIParent) --> main frame
--> row frame is the parent of rows, it have setallpoints on baseframe
local rowframe = CreateFrame ("frame", "DetailsRowFrame"..ID, _UIParent)
rowframe:SetAllPoints (baseframe)
rowframe:SetFrameStrata (baseframe_strata)
rowframe:SetFrameLevel (2)
instancia.rowframe = rowframe
--> right click bookmark
local switchbutton = gump:NewDetailsButton (backgrounddisplay, baseframe, nil, function() end, nil, nil, 1, 1, "", "", "", "",
{rightFunc = {func = function() _detalhes.switch:ShowMe (instancia) end, param1 = nil, param2 = nil}}, "Details_SwitchButtonFrame" .. ID)
@@ -2335,15 +2340,16 @@ function gump:CriaJanelaPrincipal (ID, instancia, criando)
switchbutton:SetPoint ("bottomright", backgrounddisplay, "bottomright")
switchbutton:SetFrameLevel (backgrounddisplay:GetFrameLevel()+1)
--> avoid mouse hover over a high window when the menu is open for a lower instance.
local anti_menu_overlap = CreateFrame ("frame", "Details_WindowFrameAntiMenuOverlap" .. ID, baseframe)
anti_menu_overlap:SetSize (100, 13)
anti_menu_overlap:SetFrameStrata ("DIALOG")
anti_menu_overlap:EnableMouse (true)
anti_menu_overlap:Hide()
--anti_menu_overlap:SetBackdrop (gump_fundo_backdrop)
baseframe.anti_menu_overlap = anti_menu_overlap
-- scroll bar -----------------------------------------------------------------------------------------------------------------------------------------------
--> create the scrollbar, almost not used.
local scrollbar = CreateFrame ("slider", "Details_ScrollBar"..ID, backgrounddisplay) --> scroll
@@ -2400,7 +2406,7 @@ function gump:CriaJanelaPrincipal (ID, instancia, criando)
--> config set
scrollbar:SetOrientation ("VERTICAL")
scrollbar.scrollMax = 0 --default - tamanho da janela de fundo
scrollbar.scrollMax = 0
scrollbar:SetMinMaxValues (0, 0)
scrollbar:SetValue (0)
scrollbar.ultimo = 0
@@ -2441,8 +2447,6 @@ function gump:CriaJanelaPrincipal (ID, instancia, criando)
-- main window config -------------------------------------------------------------------------------------------------------------------------------------------------
baseframe:SetClampedToScreen (true)
--baseframe:SetClampRectInsets (unpack (_detalhes.window_clamp))
baseframe:SetSize (_detalhes.new_window_size.width, _detalhes.new_window_size.height)
baseframe:SetPoint ("center", _UIParent)
@@ -2779,95 +2783,98 @@ _detalhes.barras_criadas = 0
--> search key: ~row ~barra
function gump:CriaNovaBarra (instancia, index)
--> instancia = window object, index = row number
local baseframe = instancia.baseframe
local rowframe = instancia.rowframe
local esta_barra = CreateFrame ("button", "DetailsBarra_"..instancia.meu_id.."_"..index, rowframe)
--> create the bar with rowframe as parent
local new_row = CreateFrame ("button", "DetailsBarra_"..instancia.meu_id.."_"..index, rowframe)
esta_barra.row_id = index
esta_barra.instance_id = instancia.meu_id
esta_barra.animacao_fim = 0
esta_barra.animacao_fim2 = 0
new_row.row_id = index
new_row.instance_id = instancia.meu_id
new_row.animacao_fim = 0
new_row.animacao_fim2 = 0
local y = instancia.row_height*(index-1)
--> 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
esta_barra:SetPoint ("topleft", baseframe, "topleft", instancia.row_info.space.left, y)
new_row:SetPoint ("topleft", baseframe, "topleft", instancia.row_info.space.left, y)
elseif (instancia.bars_grow_direction == 2) then
esta_barra:SetPoint ("bottomleft", baseframe, "bottomleft", instancia.row_info.space.left, y + 2)
new_row:SetPoint ("bottomleft", baseframe, "bottomleft", instancia.row_info.space.left, y + 2)
end
esta_barra:SetHeight (instancia.row_info.height) --> altura determinada pela instância
esta_barra:SetWidth (baseframe:GetWidth()+instancia.row_info.space.right)
--> row height
new_row:SetHeight (instancia.row_info.height)
new_row:SetWidth (baseframe:GetWidth()+instancia.row_info.space.right)
new_row:SetFrameLevel (baseframe:GetFrameLevel() + 4)
new_row.last_value = 0
new_row.w_mod = 0
new_row:EnableMouse (true)
new_row:RegisterForClicks ("LeftButtonDown", "RightButtonDown")
esta_barra:SetFrameLevel (baseframe:GetFrameLevel() + 4)
--> statusbar
new_row.statusbar = CreateFrame ("StatusBar", "DetailsBarra_Statusbar_"..instancia.meu_id.."_"..index, new_row)
--> frame for hold the backdrop border
new_row.border = CreateFrame ("Frame", "DetailsBarra_Border_" .. instancia.meu_id .. "_" .. index, new_row.statusbar)
new_row.border:SetFrameLevel (new_row.statusbar:GetFrameLevel()+1)
new_row.border:SetAllPoints (new_row)
esta_barra.last_value = 0
esta_barra.w_mod = 0
esta_barra:EnableMouse (true)
esta_barra:RegisterForClicks ("LeftButtonDown", "RightButtonDown")
esta_barra.statusbar = CreateFrame ("StatusBar", "DetailsBarra_Statusbar_"..instancia.meu_id.."_"..index, esta_barra)
--> create textures and icons
new_row.textura = new_row.statusbar:CreateTexture (nil, "artwork")
new_row.textura:SetHorizTile (false)
new_row.textura:SetVertTile (false)
esta_barra.border = CreateFrame ("Frame", "DetailsBarra_Border_" .. instancia.meu_id .. "_" .. index, esta_barra.statusbar)
esta_barra.border:SetFrameLevel (esta_barra.statusbar:GetFrameLevel()+1)
esta_barra.border:SetAllPoints (esta_barra)
--> row background texture
new_row.background = new_row:CreateTexture (nil, "background")
new_row.background:SetTexture()
new_row.background:SetAllPoints (new_row)
esta_barra.textura = esta_barra.statusbar:CreateTexture (nil, "artwork")
esta_barra.textura:SetHorizTile (false)
esta_barra.textura:SetVertTile (false)
esta_barra.background = esta_barra:CreateTexture (nil, "background")
esta_barra.background:SetTexture()
esta_barra.background:SetAllPoints (esta_barra)
new_row.statusbar:SetStatusBarColor (0, 0, 0, 0)
new_row.statusbar:SetStatusBarTexture (new_row.textura)
new_row.statusbar:SetMinMaxValues (0, 100)
new_row.statusbar:SetValue (0)
esta_barra.statusbar:SetStatusBarColor (0, 0, 0, 0)
esta_barra.statusbar:SetStatusBarTexture (esta_barra.textura)
esta_barra.statusbar:SetMinMaxValues (0, 100)
esta_barra.statusbar:SetValue (0)
local icone_classe = esta_barra.statusbar:CreateTexture (nil, "overlay")
--> class icon
local icone_classe = new_row.statusbar: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)
icone_classe:SetTexCoord (.75, 1, .75, 1)
esta_barra.icone_classe = icone_classe
new_row.icone_classe = icone_classe
icone_classe:SetPoint ("left", esta_barra, "left")
icone_classe:SetPoint ("left", new_row, "left")
new_row.statusbar:SetPoint ("topleft", icone_classe, "topright")
new_row.statusbar:SetPoint ("bottomright", new_row, "bottomright")
esta_barra.statusbar:SetPoint ("topleft", icone_classe, "topright")
esta_barra.statusbar:SetPoint ("bottomright", esta_barra, "bottomright")
--> left text
new_row.texto_esquerdo = new_row.statusbar:CreateFontString (nil, "overlay", "GameFontHighlight")
new_row.texto_esquerdo:SetPoint ("left", new_row.icone_classe, "right", 3, 0)
new_row.texto_esquerdo:SetJustifyH ("left")
new_row.texto_esquerdo:SetNonSpaceWrap (true)
--> right text
new_row.texto_direita = new_row.statusbar:CreateFontString (nil, "overlay", "GameFontHighlight")
new_row.texto_direita:SetPoint ("right", new_row.statusbar, "right")
new_row.texto_direita:SetJustifyH ("right")
esta_barra.texto_esquerdo = esta_barra.statusbar:CreateFontString (nil, "overlay", "GameFontHighlight")
--> set the onclick, on enter scripts
barra_scripts (new_row, instancia, index)
esta_barra.texto_esquerdo:SetPoint ("left", esta_barra.icone_classe, "right", 3, 0)
esta_barra.texto_esquerdo:SetJustifyH ("left")
esta_barra.texto_esquerdo:SetNonSpaceWrap (true)
--> hide
gump:Fade (new_row, 1)
esta_barra.texto_direita = esta_barra.statusbar:CreateFontString (nil, "overlay", "GameFontHighlight")
esta_barra.texto_direita:SetPoint ("right", esta_barra.statusbar, "right")
esta_barra.texto_direita:SetJustifyH ("right")
--> adds the window container
instancia.barras [index] = new_row
--> inicia os scripts da barra
barra_scripts (esta_barra, instancia, index)
--> hida a barra
gump:Fade (esta_barra, 1)
--> adiciona ela ao container de barras
instancia.barras [index] = esta_barra
--> seta o texto da esqueda
esta_barra.texto_esquerdo:SetText (Loc ["STRING_NEWROW"])
--> set the left text
new_row.texto_esquerdo:SetText (Loc ["STRING_NEWROW"])
--> refresh rows
instancia:InstanceRefreshRows()
return esta_barra
return new_row
end
function _detalhes:SetBarTextSettings (size, font, fixedcolor, leftcolorbyclass, rightcolorbyclass, leftoutline, rightoutline, customrighttextenabled, customrighttext, percentage_type, showposition, customlefttextenabled, customlefttext)
+6 -2
View File
@@ -405,9 +405,13 @@ function _G._detalhes:Start()
end
--> minimap
_detalhes:RegisterMinimapAndHotCorner()
_detalhes:RegisterMinimap()
function _detalhes:RegisterHotCorner()
_detalhes:DoRegisterHotCorner()
end
_detalhes:ScheduleTimer ("RegisterHotCorner", 5)
function _detalhes:OpenOptionsWindowAtStart()
--_detalhes:OpenOptionsWindow (_detalhes.tabela_instancias[1])
--print (_G ["DetailsClearSegmentsButton1"]:GetSize())