diff --git a/Titan/TitanPanel.lua b/Titan/TitanPanel.lua index 27ed9f5..3351b96 100644 --- a/Titan/TitanPanel.lua +++ b/Titan/TitanPanel.lua @@ -22,7 +22,8 @@ local numOfTexturesHider = 0; local L = LibStub("AceLocale-3.0"):GetLocale(TITAN_ID, true) local AceTimer = LibStub("AceTimer-3.0") local media = LibStub("LibSharedMedia-3.0") -local DDM = LibStub:GetLibrary("LibUIDropDownMenu-4.0") + +-- TitanDebug (cmd.." : "..p1.." "..p2.." "..p3.." "..#cmd_list) -------------------------------------------------------------- -- @@ -34,7 +35,7 @@ function TitanPanel_OkToReload() button2 = CANCEL, OnAccept = function(self) ReloadUI() - end, + end, showAlert = 1, timeout = 0, whileDead = 1, @@ -48,7 +49,7 @@ NAME: TitanPanel_ResetToDefault DESC: Give the user a 'are you sure'. If the user accepts then reset current toon back to default Titan settings. VAR: None OUT: None -NOTE: +NOTE: - Even if the user was using global profiles they will not when this is done. :NOTE --]] @@ -63,7 +64,7 @@ function TitanPanel_ResetToDefault() IsTitanPanelReset = true; --TitanPanel_OkToReload() ReloadUI() - end, + end, showAlert = 1, timeout = 0, whileDead = 1, @@ -83,12 +84,12 @@ NOTE: --]] function TitanPanel_SaveCustomProfile() -- Create the dialog box code we'll need... - + -- helper to actually write the profile to the Titan saved vars local function Write_profile(name) local currentprofilevalue, _, _ = TitanUtils_GetPlayer() local profileName = TitanUtils_CreateName(name, TITAN_CUSTOM_PROFILE_POSTFIX) - TitanSettings.Players[profileName] = + TitanSettings.Players[profileName] = TitanSettings.Players[currentprofilevalue] TitanPrint(L["TITAN_PANEL_MENU_PROFILE_SAVE_PENDING"] .."'"..name.."'" @@ -96,7 +97,7 @@ function TitanPanel_SaveCustomProfile() end -- helper to ask the user to overwrite a profile local function Overwrite_profile(name) - local dialogFrame = + local dialogFrame = StaticPopup_Show("TITAN_OVERWRITE_CUSTOM_PROFILE", name); if dialogFrame then dialogFrame.data = name; @@ -111,7 +112,7 @@ function TitanPanel_SaveCustomProfile() -- no '@' is allowed or it will mess with the Titan profile naming convention local concprofileName = string.gsub( conc2profileName, TITAN_AT, "-" ); local profileName = TitanUtils_CreateName(concprofileName, TITAN_CUSTOM_PROFILE_POSTFIX) - if TitanSettings.Players[profileName] then + if TitanSettings.Players[profileName] then -- Warn the user of an existing profile Overwrite_profile(rawprofileName) self:Hide(); @@ -136,7 +137,7 @@ function TitanPanel_SaveCustomProfile() whileDead = 1, timeout = 0, }; - + -- Dialog box to warn the user that an existing profile will be overwritten. StaticPopupDialogs["TITAN_OVERWRITE_CUSTOM_PROFILE"] = { text = TitanUtils_GetNormalText(L["TITAN_PANEL_MENU_TITLE"]).."\n\n" @@ -153,7 +154,7 @@ function TitanPanel_SaveCustomProfile() timeout = 0, hideOnEscape = 1 }; - + -- Dialog box to save the profile. StaticPopupDialogs["TITAN_SAVE_CUSTOM_PROFILE"] = { text = TitanUtils_GetNormalText(L["TITAN_PANEL_MENU_TITLE"]).."\n\n" @@ -191,7 +192,7 @@ function TitanPanel_SaveCustomProfile() -- StaticPopupDialogs["TITAN_RELOADUI"] = {} -- StaticPopupDialogs["TITAN_OVERWRITE_CUSTOM_PROFILE"] = {} -- StaticPopupDialogs["TITAN_SAVE_CUSTOM_PROFILE"] = {} - + end --[[ Titan @@ -237,15 +238,15 @@ end --[[ not_used local function TitanPanel_SetTransparent(frame, position) local frName = _G[frame]; - + if (position == TITAN_PANEL_PLACE_TOP) then frName:ClearAllPoints(); frName:SetPoint("TOPLEFT", "UIParent", "TOPLEFT", 0, 0); frName:SetPoint("BOTTOMRIGHT", "UIParent", "TOPRIGHT", 0, -TITAN_PANEL_BAR_HEIGHT); else frName:ClearAllPoints(); - frName:SetPoint("BOTTOMLEFT", "UIParent", "BOTTOMLEFT", 0, 0); - frName:SetPoint("TOPRIGHT", "UIParent", "BOTTOMRIGHT", 0, TITAN_PANEL_BAR_HEIGHT); + frName:SetPoint("BOTTOMLEFT", "UIParent", "BOTTOMLEFT", 0, 0); + frName:SetPoint("TOPRIGHT", "UIParent", "BOTTOMRIGHT", 0, TITAN_PANEL_BAR_HEIGHT); end end --]] @@ -276,11 +277,11 @@ local function TitanPanel_CreateABar(frame) _G[hide_name]:SetScript("OnEnter", function(self) TitanPanelBarButtonHider_OnEnter(self) end) _G[hide_name]:SetScript("OnLeave", function(self) TitanPanelBarButtonHider_OnLeave(self) end) _G[hide_name]:SetScript("OnClick", function(self, button) TitanPanelBarButton_OnClick(self, button) end) - + _G[hide_name]:SetFrameStrata("BACKGROUND") _G[hide_name]:SetHeight(TITAN_PANEL_BAR_HEIGHT/2); _G[hide_name]:SetWidth(2560); - + -- Set the display bar local container = _G[frame] container:SetHeight(TITAN_PANEL_BAR_HEIGHT); @@ -314,7 +315,7 @@ end) _G[TITAN_PANEL_CONTROL]:RegisterEvent("PET_BATTLE_OPENING_START"); _G[TITAN_PANEL_CONTROL]:RegisterEvent("PET_BATTLE_CLOSE"); - + --[[ Titan NAME: TitanPanel_PlayerEnteringWorld DESC: Do all the setup needed when a user logs in / reload UI / enter or leave an instance. @@ -352,8 +353,8 @@ function TitanPanel_PlayerEnteringWorld() TitanPanelBottomAnchor:ClearAllPoints(); TitanPanelBottomAnchor:SetPoint("BOTTOMLEFT", "UIParent", "BOTTOMLEFT", 0, 0); - -- Ensure the bars are created before the - -- plugins are registered. + -- Ensure the bars are created before the + -- plugins are registered. for idx, v in pairs (TitanBarData) do TitanPanel_CreateABar(idx) end @@ -365,7 +366,7 @@ function TitanPanel_PlayerEnteringWorld() elseif TitanGetVar(TITAN_CLOCK_ID, "OffsetHour") then ServerTimeOffsets[realmName] = TitanGetVar(TITAN_CLOCK_ID, "OffsetHour") end - + if ServerHourFormat[realmName] then TitanSetVar(TITAN_CLOCK_ID, "Format", ServerHourFormat[realmName]) elseif TitanGetVar(TITAN_CLOCK_ID, "Format") then @@ -399,7 +400,7 @@ function TitanPanel_PlayerEnteringWorld() -- Init detailed settings only after plugins are registered! TitanVariables_UseSettings(nil, TITAN_PROFILE_INIT) - + -- all addons are loaded so update the config (options) -- some could have registered late... TitanUpdateConfig("init") @@ -424,14 +425,14 @@ function TitanPanel_PlayerEnteringWorld() -- Move frames TitanMovable_SecureFrames() TitanPanel_AdjustFrames(true, "Init: PEW (Player Entering World)") - + -- Secondary failsafe check for bottom frame adjustment -- -- On longer game loads (log in, reload, instances, etc Titan will adjust -- then Blizz will adjust putting the action buttons over / under Titan -- if the user has aux 1/2 shown. TitanMovable_AdjustTimer("EnterWorld") - + end -------------------------------------------------------------- @@ -462,7 +463,7 @@ end function TitanPanelBarButton:PLAYER_ENTERING_WORLD() local call_success = nil local ret_val = nil - + call_success, -- needed for pcall ret_val = -- actual return values pcall (TitanPanel_PlayerEnteringWorld) @@ -477,7 +478,7 @@ function TitanPanelBarButton:PLAYER_ENTERING_WORLD() TitanPrint("--"..ret_val, "error") -- Clean up best we can and tell the user to submit a ticket. -- This could be the 1st log in or a reload (reload, instance, boat, ...) - + -- Hide the bars. At times they are there but at 0% transparency. -- They can be over the Blizz action bars creating havoc. TitanPrint("-- Hiding Titan bars...", "warning") @@ -486,7 +487,7 @@ function TitanPanelBarButton:PLAYER_ENTERING_WORLD() -- Remove the options pages TitanUpdateConfig("nuke") -- What else to clean up??? - + -- raise the error to WoW for display, if display errors is set. -- This *must be* the last statement of the routine! error(ret_val, 1) @@ -494,8 +495,8 @@ function TitanPanelBarButton:PLAYER_ENTERING_WORLD() end function TitanPanelBarButton:CVAR_UPDATE(cvarname, cvarvalue) - if cvarname == "USE_UISCALE" - or cvarname == "WINDOWED_MODE" + if cvarname == "USE_UISCALE" + or cvarname == "WINDOWED_MODE" or cvarname == "uiScale" then if TitanPlayerSettings and TitanPanelGetVar("Scale") then Titan_AdjustScale() @@ -520,14 +521,14 @@ end function TitanPanelBarButton:PLAYER_REGEN_DISABLED() -- If in combat close all control frames and menus - if TITAN_PANEL_VARS.debug.movable + if TITAN_PANEL_VARS.debug.movable or TITAN_PANEL_VARS.debug.events then TitanDebug ("PLAYER_REGEN_DISABLED" .." c: "..tostring(InCombatLockdown()) .." v: "..tostring(UnitInVehicle("player")) ) end - + TitanUtils_CloseAllControlFrames(); TitanUtils_CloseRightClickMenu(); end @@ -573,7 +574,7 @@ function TitanPanelBarButton:UNIT_ENTERED_VEHICLE(self, ...) --[[ NOTE: Hiding the Titan bottom bars is not desired here. We cannot (I do not know how :)) distinguish between a player on a quest or on flight path. - --]] + --]] end function TitanPanelBarButton:UNIT_EXITED_VEHICLE(self, ...) --[[ @@ -625,7 +626,7 @@ function TitanPanelBarButton_OnClick(self, button) local bar = self:GetName(); if (button == "LeftButton") then TitanUtils_CloseAllControlFrames(); - TitanUtils_CloseRightClickMenu(); + TitanUtils_CloseRightClickMenu(); elseif (button == "RightButton") then TitanUtils_CloseAllControlFrames(); TitanPanelRightClickMenu_Close(); @@ -651,12 +652,12 @@ local function TitanPanel_ParseSlashCmd(cmd) for w in string.gmatch (cmd, "%w+") do words [#words + 1] = (w and string.lower(w) or "?") end ---[[ +--[[ local tmp = "" for idx,v in pairs (words) do tmp = tmp.."'"..words[idx].."' " end - + TitanDebug (tmp.." : "..#words) --]] return words @@ -686,7 +687,7 @@ local function handle_slash_help(cmd) TitanPrint(L["TITAN_PANEL_SLASH_RESET_4"], "plain") TitanPrint(L["TITAN_PANEL_SLASH_RESET_5"], "plain") end - if cmd == "gui" then + if cmd == "gui" then TitanPrint(L["TITAN_PANEL_SLASH_GUI_0"], "plain") TitanPrint(L["TITAN_PANEL_SLASH_GUI_1"], "plain") TitanPrint(L["TITAN_PANEL_SLASH_GUI_2"], "plain") @@ -862,7 +863,7 @@ local function handle_orderhall_cmds(cmd_list) button2 = CANCEL, OnAccept = function(self) ReloadUI(); - end, + end, showAlert = 1, timeout = 0, whileDead = 1, @@ -879,7 +880,7 @@ local function handle_orderhall_cmds(cmd_list) button2 = CANCEL, OnAccept = function(self) ReloadUI(); - end, + end, showAlert = 1, timeout = 0, whileDead = 1, @@ -921,8 +922,6 @@ local function TitanPanel_RegisterSlashCmd(cmd_str) local p2 = cmd_list[3] or "" local p3 = cmd_list[4] or "" --- TitanDebug (cmd.." : "..p1.." "..p2.." "..p3.." "..#cmd_list) - if (cmd == "reset") then handle_reset_cmds(cmd_list) elseif (cmd == "gui") then @@ -983,7 +982,7 @@ function TitanPanel_CreateBarTextures() local screenWidth local lastTextureWidth local tex, tex_pre - + -- loop through the bars to set the texture for idx,v in pairs (TitanBarData) do bar_name = TITAN_PANEL_DISPLAY_PREFIX..TitanBarData[idx].name @@ -991,7 +990,7 @@ function TitanPanel_CreateBarTextures() numOfTextures = floor(screenWidth / 256 ) numOfTexturesHider = (numOfTextures * 2) + 1 lastTextureWidth = screenWidth - (numOfTextures * 256) - + for i = 0, numOfTextures do -- Create textures if they don't exist tex = TITAN_PANEL_BACKGROUND_PREFIX..TitanBarData[idx].name.."_"..i @@ -1122,7 +1121,7 @@ function TitanPanelBarButtonHider_OnEnter(self) if not index then return end -- sanity check -- so the bar does not 'appear' when moused over in combat - if TitanPanelGetVar("LockAutoHideInCombat") and InCombatLockdown() then return end + if TitanPanelGetVar("LockAutoHideInCombat") and InCombatLockdown() then return end -- find the relevant bar data local frame = nil @@ -1213,13 +1212,13 @@ function TitanPanelBarButton_ForceLDBLaunchersRight() local plugin, index, id; for index, id in pairs(TitanPluginsIndex) do plugin = TitanUtils_GetPlugin(id); - if plugin.ldb == "launcher" + if plugin.ldb == "launcher" and not TitanGetVar(id, "DisplayOnRightSide") then TitanToggleVar(id, "DisplayOnRightSide"); local button = TitanUtils_GetButton(id); local buttonText = _G[button:GetName()..TITAN_PANEL_TEXT]; if not TitanGetVar(id, "ShowIcon") then - TitanToggleVar(id, "ShowIcon"); + TitanToggleVar(id, "ShowIcon"); end TitanPanelButton_UpdateButton(id); if buttonText then @@ -1286,20 +1285,20 @@ function TitanPanelBarButton_DisplayBarsWanted(reason) -- Show / hide plus kick auto hide, if needed Titan_AutoHide_Init((_G[TitanBarData[idx].auto_hide_plugin] or nil)) end - + -- Set anchors for other addons to use. TitanAnchors() - + -- Adjust other frames because the bars shown / hidden may have changed TitanPanel_AdjustFrames(true, reason) end --[[ Titan NAME: TitanPanelBarButton_HideAllBars -DESC: This routine will hide all the Titan bars (and hiders) regardless of what the user has selected. +DESC: This routine will hide all the Titan bars (and hiders) regardless of what the user has selected. VAR: None OUT: None -NOTE: +NOTE: - For example when the pet battle is active. We cannot figure out how to move the pet battle frame so we are punting and hiding Titan... - We only need to hide the bars (and hiders) - not adjust frames :NOTE @@ -1322,7 +1321,7 @@ TitanDebug("_HideAllBars: " -- In case the user selected auto hide for this bar we need to hide it as well if (TitanPanelGetVar(bar.."_Show")) and (TitanPanelGetVar(bar.."_Hide")) then hider:ClearAllPoints(); - hider:SetPoint(hide.top.pt, hide.top.rel_fr, hide.top.rel_pt, hide.top.x, hide.top.y); + hider:SetPoint(hide.top.pt, hide.top.rel_fr, hide.top.rel_pt, hide.top.x, hide.top.y); hider:SetPoint(hide.bot.pt, hide.bot.rel_fr, hide.bot.rel_pt, hide.bot.x, hide.bot.y); end end @@ -1330,10 +1329,10 @@ end --[[ Titan NAME: TitanPanelBarButton_HideTopBars -DESC: This routine will hide the bars Titan bars (and hiders) regardless of what the user has selected. +DESC: This routine will hide the bars Titan bars (and hiders) regardless of what the user has selected. VAR: None OUT: None -NOTE: +NOTE: - For example when the class hall - We only need to hide the bars (and hiders) - not adjust frames :NOTE @@ -1349,10 +1348,10 @@ end --[[ Titan NAME: TitanPanelBarButton_HideBottomBars -DESC: This routine will hide the bottom Titan bars (and hiders) regardless of what the user has selected. +DESC: This routine will hide the bottom Titan bars (and hiders) regardless of what the user has selected. VAR: None OUT: None -NOTE: +NOTE: - For example when the override bar is being used - We only need to hide the bars (and hiders) - not adjust frames :NOTE @@ -1371,7 +1370,7 @@ NAME: TitanPanelBarButton_Show DESC: Show / hide the given Titan bar based on the user selection. VAR: frame - expected to be a Titan bar name (string) OUT: None -NOTE: +NOTE: - Hide moves rather than just 'not shown'. Otherwise the buttons will stay visible defeating the purpose of hide. :NOTE --]] @@ -1382,7 +1381,7 @@ function TitanPanelBarButton_Show(frame) local show = TitanBarData[frame] and TitanBarData[frame].show or nil local hider = _G[TitanBarData[frame].hider] or nil - if bar and display and hider and show and hide + if bar and display and hider and show and hide then -- Show the display bar if the user requested it if (TitanPanelGetVar(bar.."_Show")) then @@ -1409,7 +1408,7 @@ NAME: TitanPanelBarButton_Hide DESC: Hide the given Titan bar based on the user selection. VAR: frame - expected to be a Titan bar name (string) OUT: None -NOTE: +NOTE: - Hide moves rather than just 'not shown'. Otherwise the buttons will stay visible defeating the purpose of hide. - Also moves the hider bar if auto hide is not selected. :NOTE @@ -1497,40 +1496,40 @@ function TitanPanel_InitPanelButtons() local bar = TitanBarData[idx].name local y_off = TitanBarData[idx].plugin_y_offset prior[bar] = { - right = { - button = TITAN_PANEL_DISPLAY_PREFIX..bar, + right = { + button = TITAN_PANEL_DISPLAY_PREFIX..bar, anchor = "RIGHT", x = 5, -- Offset of first plugin to right side of screen y = y_off, }, left = { - button = TITAN_PANEL_DISPLAY_PREFIX..bar, + button = TITAN_PANEL_DISPLAY_PREFIX..bar, anchor = "LEFT", x = 0, -- Justify adjusts - center or not y = y_off, }, } end --- +-- TitanPanelBarButton_DisplayBarsWanted("TitanPanel_InitPanelButtons"); - -- Position all the buttons - for i = 1, table.maxn(TitanPanelSettings.Buttons) do - + -- Position all the buttons + for i = 1, table.maxn(TitanPanelSettings.Buttons) do + local id = TitanPanelSettings.Buttons[i]; if ( TitanUtils_IsPluginRegistered(id) ) then local i = TitanPanel_GetButtonNumber(id); button = TitanUtils_GetButton(id); -- If the plugin has asked to be on the right - if TitanUtils_ToRight(id) then + if TitanUtils_ToRight(id) then -- ========================= - -- position the plugin relative to the prior plugin + -- position the plugin relative to the prior plugin -- or the bar if it is the 1st r_prior = prior[TitanPanelSettings.Location[i]].right -- ========================= button:ClearAllPoints(); - button:SetPoint("RIGHT", _G[r_prior.button]:GetName(), r_prior.anchor, (-(r_prior.x) * scale), r_prior.y); + button:SetPoint("RIGHT", _G[r_prior.button]:GetName(), r_prior.anchor, (-(r_prior.x) * scale), r_prior.y); -- ========================= -- capture the button for the next plugin @@ -1544,14 +1543,14 @@ function TitanPanel_InitPanelButtons() -- handle plugins on the left side of the bar -- -- ========================= - -- position the plugin relative to the prior plugin + -- position the plugin relative to the prior plugin -- or the bar if it is the 1st l_prior = prior[TitanPanelSettings.Location[i]].left -- ========================= -- button:ClearAllPoints(); button:SetPoint("LEFT", _G[l_prior.button]:GetName(), l_prior.anchor, l_prior.x * scale, l_prior.y); - + -- ========================= -- capture the next plugin l_prior.button = "TitanPanel"..id.."Button" @@ -1593,11 +1592,11 @@ NOTE: function TitanPanel_RemoveButton(id) if ( not TitanPanelSettings ) then return; - end + end local i = TitanPanel_GetButtonNumber(id) local currentButton = TitanUtils_GetButton(id); - + -- safeguard ... if id then AceTimer.CancelAllTimers("TitanPanel"..id) end @@ -1690,7 +1689,7 @@ function TitanPanelButton_Justify() if ( align == TITAN_PANEL_BUTTONS_ALIGN_LEFT ) then -- Now offset the plugins firstLeftButton:ClearAllPoints(); - firstLeftButton:SetPoint("LEFT", idx, "LEFT", 5, y_offset); + firstLeftButton:SetPoint("LEFT", idx, "LEFT", 5, y_offset); end -- Center if requested if ( align == TITAN_PANEL_BUTTONS_ALIGN_CENTER ) then @@ -1702,14 +1701,14 @@ function TitanPanelButton_Justify() local button = TitanUtils_GetButton(id); if button and button:GetWidth() then if TitanUtils_GetWhichBar(id) == bar then - if ( TitanPanelButton_IsIcon(id) + if ( TitanPanelButton_IsIcon(id) or (TitanGetVar(id, "DisplayOnRightSide")) ) then - rightWidth = rightWidth - + icon_spacing + rightWidth = rightWidth + + icon_spacing + button:GetWidth(); else counter = counter + 1; - leftWidth = leftWidth + leftWidth = leftWidth + button_spacing + button:GetWidth() end @@ -1720,7 +1719,7 @@ function TitanPanelButton_Justify() firstLeftButton:ClearAllPoints(); -- remove the last spacing otherwise the buttons appear justified too far left center_offset = (0 - (leftWidth-button_spacing) / 2) - firstLeftButton:SetPoint("LEFT", idx, "CENTER", center_offset, y_offset); + firstLeftButton:SetPoint("LEFT", idx, "CENTER", center_offset, y_offset); end end end @@ -1780,10 +1779,10 @@ local function TitanPanel_MainMenu() local info = {}; ----------------- - -- Menu title + -- Menu title TitanPanelRightClickMenu_AddTitle(L["TITAN_PANEL_MENU_TITLE"]); - TitanPanelRightClickMenu_AddSpacer(L_UIDROPDOWNMENU_MENU_LEVEL); - + TitanPanelRightClickMenu_AddSeparator(TitanPanelRightClickMenu_GetDropdownLevel()); + TitanPanelRightClickMenu_AddTitle(L["TITAN_PANEL_MENU_PLUGINS"]); ----------------- @@ -1794,29 +1793,29 @@ local function TitanPanel_MainMenu() info.text = L["TITAN_PANEL_MENU_CATEGORIES"][index]; info.value = "Addons_" .. TITAN_PANEL_BUTTONS_PLUGIN_CATEGORY[index]; info.hasArrow = 1; - DDM:UIDropDownMenu_AddButton(info); + TitanPanelRightClickMenu_AddButton(info); end - TitanPanelRightClickMenu_AddSpacer(); + TitanPanelRightClickMenu_AddSeparator(TitanPanelRightClickMenu_GetDropdownLevel()); ----------------- -- Options - just one button to open the first Titan option screen info = {}; info.notCheckable = true info.text = L["TITAN_PANEL_MENU_CONFIGURATION"]; - info.value = "Bars"; - info.func = function() + info.value = "Bars"; + info.func = function() InterfaceOptionsFrame_OpenToCategory(L["TITAN_PANEL_MENU_TOP_BARS"]); InterfaceOptionsFrame_OpenToCategory(L["TITAN_PANEL_MENU_TOP_BARS"]); -- hack for a Blizz bug... end - DDM:UIDropDownMenu_AddButton(info); + TitanPanelRightClickMenu_AddButton(info); + + TitanPanelRightClickMenu_AddSeparator(TitanPanelRightClickMenu_GetDropdownLevel()); - TitanPanelRightClickMenu_AddSpacer(); - ----------------- -- Profiles TitanPanelRightClickMenu_AddTitle(L["TITAN_PANEL_MENU_PROFILES"]); - + ----------------- -- Load/Delete info = {}; @@ -1832,8 +1831,8 @@ local function TitanPanel_MainMenu() .._G["GREEN_FONT_COLOR_CODE"] ..L["TITAN_PANEL_MENU_IN_COMBAT_LOCKDOWN"]; end - DDM:UIDropDownMenu_AddButton(info); - + TitanPanelRightClickMenu_AddButton(info); + ----------------- -- Save info = {}; @@ -1848,32 +1847,32 @@ local function TitanPanel_MainMenu() .._G["GREEN_FONT_COLOR_CODE"] ..L["TITAN_PANEL_MENU_IN_COMBAT_LOCKDOWN"]; end - DDM:UIDropDownMenu_AddButton(info); + TitanPanelRightClickMenu_AddButton(info); local glob, toon, player, server = TitanUtils_GetGlobalProfile() info = {}; info.text = "Use Global Profile" info.value = "Use Global Profile" - info.func = function() + info.func = function() TitanUtils_SetGlobalProfile(not glob, toon) TitanVariables_UseSettings(nil, TITAN_PROFILE_USE) end; info.checked = glob --TitanAllGetVar("GlobalProfileUse") info.keepShownOnClick = nil - DDM:UIDropDownMenu_AddButton(info, L_UIDROPDOWNMENU_MENU_LEVEL); + TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); --[[ local player, server = TitanUtils_ParseName(TitanAllGetVar("GlobalProfileName")) info = {}; info.notCheckable = true info.text = " "..TitanUtils_GetGreenText(server) info.value = "server"; - DDM:UIDropDownMenu_AddButton(info); + TitanPanelRightClickMenu_AddButton(info); info = {}; info.notCheckable = true info.text = " "..TitanUtils_GetGreenText(player) info.value = "player"; - DDM:UIDropDownMenu_AddButton(info); + TitanPanelRightClickMenu_AddButton(info); --]] end @@ -1891,13 +1890,13 @@ local function TitanPanel_ServerSettingsMenu() local s, e, ident; local setonce = 0; - if ( L_UIDROPDOWNMENU_MENU_VALUE == "Settings" ) then + if ( TitanPanelRightClickMenu_GetDropdMenuValue() == "Settings" ) then TitanPanelRightClickMenu_AddTitle(L["TITAN_PANEL_MENU_PROFILE_SERVERS"], - L_UIDROPDOWNMENU_MENU_LEVEL); + TitanPanelRightClickMenu_GetDropdownLevel()); -- Normal profile per toon for index, id in pairs(TitanSettings.Players) do player, server = TitanUtils_ParseName(index) - + if TitanUtils_GetCurrentIndex(servers, server) == nil then if server ~= TITAN_CUSTOM_PROFILE_POSTFIX then table.insert(servers, server); @@ -1906,19 +1905,19 @@ local function TitanPanel_ServerSettingsMenu() info.text = server; info.value = server; info.hasArrow = 1; - DDM:UIDropDownMenu_AddButton(info, L_UIDROPDOWNMENU_MENU_LEVEL); + TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); end end end -- Custom profiles for index, id in pairs(TitanSettings.Players) do player, server = TitanUtils_ParseName(index) - + if TitanUtils_GetCurrentIndex(servers, server) == nil then if server == TITAN_CUSTOM_PROFILE_POSTFIX then if setonce and setonce == 0 then - TitanPanelRightClickMenu_AddTitle("", L_UIDROPDOWNMENU_MENU_LEVEL); - TitanPanelRightClickMenu_AddTitle(L["TITAN_PANEL_MENU_PROFILE_CUSTOM"], L_UIDROPDOWNMENU_MENU_LEVEL); + TitanPanelRightClickMenu_AddTitle("", TitanPanelRightClickMenu_GetDropdownLevel()); + TitanPanelRightClickMenu_AddTitle(L["TITAN_PANEL_MENU_PROFILE_CUSTOM"], TitanPanelRightClickMenu_GetDropdownLevel()); setonce = 1; end info = {}; @@ -1926,7 +1925,7 @@ local function TitanPanel_ServerSettingsMenu() info.text = player; info.value = player; info.hasArrow = 1; - DDM:UIDropDownMenu_AddButton(info, L_UIDROPDOWNMENU_MENU_LEVEL); + TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); end end end @@ -1954,7 +1953,7 @@ local function TitanPanel_PlayerSettingsMenu() local setonce = 0; local off = nil - -- + -- -- Handle the profiles -- for index, id in pairs(TitanSettings.Players) do @@ -1963,24 +1962,24 @@ local function TitanPanel_PlayerSettingsMenu() or ((index == TitanAllGetVar("GlobalProfileUse")) and (TitanAllGetVar("GlobalProfileUse"))) -- handle custom profiles here - if server == TITAN_CUSTOM_PROFILE_POSTFIX - and player == L_UIDROPDOWNMENU_MENU_VALUE then + if server == TITAN_CUSTOM_PROFILE_POSTFIX + and player == TitanPanelRightClickMenu_GetDropdMenuValue() then info = {}; info.notCheckable = true info.disabled = TitanAllGetVar("GlobalProfileUse") info.text = L["TITAN_PANEL_MENU_LOAD_SETTINGS"]; info.value = index; - info.func = function() + info.func = function() TitanVariables_UseSettings(index, TITAN_PROFILE_USE) end - DDM:UIDropDownMenu_AddButton(info, L_UIDROPDOWNMENU_MENU_LEVEL); - + TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); + info = {}; info.notCheckable = true info.disabled = off info.text = L["TITAN_PANEL_MENU_DELETE_SETTINGS"]; info.value = index; - info.func = function() + info.func = function() if TitanSettings.Players[info.value] then TitanSettings.Players[info.value] = nil; profname = TitanUtils_ParseName(index) @@ -1992,14 +1991,14 @@ local function TitanPanel_PlayerSettingsMenu() TitanPanelRightClickMenu_Close(); end end - DDM:UIDropDownMenu_AddButton(info, L_UIDROPDOWNMENU_MENU_LEVEL); + TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); end -- if server and player -- handle regular profiles here - if server == L_UIDROPDOWNMENU_MENU_VALUE then + if server == TitanPanelRightClickMenu_GetDropdMenuValue() then -- Set the label once if setonce and setonce == 0 then - TitanPanelRightClickMenu_AddTitle(L["TITAN_PANEL_MENU_PROFILE_CHARS"], L_UIDROPDOWNMENU_MENU_LEVEL); + TitanPanelRightClickMenu_AddTitle(L["TITAN_PANEL_MENU_PROFILE_CHARS"], TitanPanelRightClickMenu_GetDropdownLevel()); setonce = 1; end info = {}; @@ -2007,22 +2006,22 @@ local function TitanPanel_PlayerSettingsMenu() info.text = player; info.value = index; info.hasArrow = 1; - DDM:UIDropDownMenu_AddButton(info, L_UIDROPDOWNMENU_MENU_LEVEL); - end + TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); + end end -- for players -- Handle the plugins for index, id in pairs(TitanPluginsIndex) do plugin = TitanUtils_GetPlugin(id); - if plugin.id and plugin.id == L_UIDROPDOWNMENU_MENU_VALUE then + if plugin.id and plugin.id == TitanPanelRightClickMenu_GetDropdMenuValue() then --title info = {}; info.text = TitanPlugins[plugin.id].menuText; info.notCheckable = true info.notClickable = 1; info.isTitle = 1; - DDM:UIDropDownMenu_AddButton(info, L_UIDROPDOWNMENU_MENU_LEVEL); + TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); --ShowIcon if plugin.controlVariables.ShowIcon then @@ -2035,7 +2034,7 @@ local function TitanPanel_PlayerSettingsMenu() info.keepShownOnClick = 1; info.checked = TitanGetVar(id, "ShowIcon"); info.disabled = nil; - DDM:UIDropDownMenu_AddButton(info, L_UIDROPDOWNMENU_MENU_LEVEL); + TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); end --ShowLabel @@ -2049,7 +2048,7 @@ local function TitanPanel_PlayerSettingsMenu() info.keepShownOnClick = 1; info.checked = TitanGetVar(id, "ShowLabelText"); info.disabled = nil; - DDM:UIDropDownMenu_AddButton(info, L_UIDROPDOWNMENU_MENU_LEVEL); + TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); end --ShowRegularText (LDB data sources only atm) @@ -2063,7 +2062,7 @@ local function TitanPanel_PlayerSettingsMenu() info.keepShownOnClick = 1; info.checked = TitanGetVar(id, "ShowRegularText"); info.disabled = nil; - DDM:UIDropDownMenu_AddButton(info, L_UIDROPDOWNMENU_MENU_LEVEL); + TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); end --ShowColoredText @@ -2077,14 +2076,14 @@ local function TitanPanel_PlayerSettingsMenu() info.keepShownOnClick = 1; info.checked = TitanGetVar(id, "ShowColoredText"); info.disabled = nil; - DDM:UIDropDownMenu_AddButton(info, L_UIDROPDOWNMENU_MENU_LEVEL); + TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); end -- Right-side plugin if plugin.controlVariables.DisplayOnRightSide then info = {}; info.text = L["TITAN_PANEL_MENU_LDB_SIDE"]; - info.func = function () + info.func = function () TitanToggleVar(id, "DisplayOnRightSide") local bar = TitanUtils_GetWhichBar(id) TitanPanel_RemoveButton(id); @@ -2092,10 +2091,10 @@ local function TitanPanel_PlayerSettingsMenu() end info.checked = TitanGetVar(id, "DisplayOnRightSide"); info.disabled = nil; - DDM:UIDropDownMenu_AddButton(info, L_UIDROPDOWNMENU_MENU_LEVEL); + TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); end end - end + end end --[[ Titan @@ -2111,19 +2110,19 @@ local function TitanPanel_SettingsSelectionMenu() info.notCheckable = true info.disabled = TitanAllGetVar("GlobalProfileUse") info.text = L["TITAN_PANEL_MENU_LOAD_SETTINGS"]; - info.value = L_UIDROPDOWNMENU_MENU_VALUE; - info.func = function() - TitanVariables_UseSettings(L_UIDROPDOWNMENU_MENU_VALUE, TITAN_PROFILE_USE) + info.value = TitanPanelRightClickMenu_GetDropdMenuValue(); + info.func = function() + TitanVariables_UseSettings(TitanPanelRightClickMenu_GetDropdMenuValue(), TITAN_PROFILE_USE) end - DDM:UIDropDownMenu_AddButton(info, L_UIDROPDOWNMENU_MENU_LEVEL); + TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); info = {}; info.notCheckable = true - info.disabled = (L_UIDROPDOWNMENU_MENU_VALUE == TitanSettings.Player) - or ((L_UIDROPDOWNMENU_MENU_VALUE == TitanAllGetVar("GlobalProfileName")) + info.disabled = (TitanPanelRightClickMenu_GetDropdMenuValue() == TitanSettings.Player) + or ((TitanPanelRightClickMenu_GetDropdMenuValue() == TitanAllGetVar("GlobalProfileName")) and (TitanAllGetVar("GlobalProfileUse"))) info.text = L["TITAN_PANEL_MENU_DELETE_SETTINGS"]; - info.value = L_UIDROPDOWNMENU_MENU_VALUE; + info.value = TitanPanelRightClickMenu_GetDropdMenuValue(); info.func = function() -- do not delete if current profile - .disabled --[[ @@ -2144,7 +2143,7 @@ local function TitanPanel_SettingsSelectionMenu() TitanPanelRightClickMenu_Close(); end end - DDM:UIDropDownMenu_AddButton(info, L_UIDROPDOWNMENU_MENU_LEVEL); + TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); end --[[ Titan @@ -2162,8 +2161,8 @@ local function TitanPanel_BuildOtherPluginsMenu(frame) if not plugin.category then plugin.category = "General"; end - if ( L_UIDROPDOWNMENU_MENU_VALUE == "Addons_" .. plugin.category ) then - if not TitanGetVar(id, "ForceBar") + if ( TitanPanelRightClickMenu_GetDropdMenuValue() == "Addons_" .. plugin.category ) then + if not TitanGetVar(id, "ForceBar") or (TitanGetVar(id, "ForceBar") == TitanBarData[frame].name) then info = {}; if plugin.version ~= nil and TitanPanelGetVar("VersionShown") then @@ -2176,13 +2175,13 @@ local function TitanPanel_BuildOtherPluginsMenu(frame) info.hasArrow = 1; end info.value = id; - info.func = function() + info.func = function() local checked = TitanPanel_IsPluginShown(id) or nil; - TitanPanelRightClickMenu_BarOnClick(checked, id) + TitanPanelRightClickMenu_BarOnClick(checked, id) end; info.checked = TitanPanel_IsPluginShown(id) or nil info.keepShownOnClick = 1; - DDM:UIDropDownMenu_AddButton(info, L_UIDROPDOWNMENU_MENU_LEVEL); + TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); end end end @@ -2200,27 +2199,32 @@ function TitanPanelRightClickMenu_PrepareBarMenu(self) -- the dropdown menu. ($parentRightClickMenu) local s, e, frame = string.find(self:GetName(), "(.*)RightClickMenu"); + local lev = (TitanPanelRightClickMenu_GetDropdownLevel() or 1) + + -- Level 1 + if lev == 1 then + TitanPanel_MainMenu() + end + -- Level 2 - if ( L_UIDROPDOWNMENU_MENU_LEVEL == 2 ) then + if ( lev == 2 ) then TitanPanel_BuildOtherPluginsMenu(frame); TitanPanel_ServerSettingsMenu(); return; end -- Level 3 - if ( L_UIDROPDOWNMENU_MENU_LEVEL == 3 ) then + if ( lev == 3 ) then TitanPanel_PlayerSettingsMenu(); return; end -- Level 4 - if ( L_UIDROPDOWNMENU_MENU_LEVEL == 4 ) then + if ( lev == 4 ) then TitanPanel_SettingsSelectionMenu(); return; end - -- Level 1 - TitanPanel_MainMenu() end --[[ Titan diff --git a/Titan/TitanPanel.xml b/Titan/TitanPanel.xml index 63766ed..5a58554 100644 --- a/Titan/TitanPanel.xml +++ b/Titan/TitanPanel.xml @@ -1,6 +1,6 @@ <Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ -..\FrameXML\UI.xsd"> - +..\FrameXML\UI.xsd"> + <GameTooltip name="TitanPanelTooltip" inherits="GameTooltipTemplate" parent="UIParent" hidden="true"/> <Button name="TitanPanelBarButtonHiderTemplate" frameStrata="BACKGROUND" toplevel="true" movable="true" parent="UIParent" virtual="true"> <Scripts> @@ -10,17 +10,17 @@ </Scripts> <Size> <AbsDimension x="2560" y="24"/> - </Size> + </Size> </Button> <!-- - This is a control frame used to capture events Titan is interested in. + This is a control frame used to capture events Titan is interested in. Other buttons will be used for display. --> - <Button name="TitanPanelBarButton" frameStrata="BACKGROUND" parent="UIParent"> + <Button name="TitanPanelBarButton" frameStrata="BACKGROUND" parent="UIParent"> <Size> <AbsDimension x="0" y="0"/> - </Size> + </Size> </Button> <Button name="Titan_Bar__Display_Template" frameStrata="DIALOG" toplevel="true" movable="true" parent="UIParent" virtual="true"> @@ -35,12 +35,6 @@ </Anchors> </ButtonText> --> - <!-- Removed on 20181229 to deal with the new LibUIDropDownMenu - <Frames> - <Frame name="$parentRightClickMenu" inherits="L_UIDropDownMenuTemplate" hidden="true"> - </Frame> - </Frames> - --> </Button> <!-- @@ -49,7 +43,7 @@ - Hider - Auto hide plugin --> - <Button name="Titan_Bar__Display_Bar" frameStrata="DIALOG" parent="UIParent" inherits="Titan_Bar__Display_Template"> + <Button name="Titan_Bar__Display_Bar" frameStrata="DIALOG" parent="UIParent" inherits="Titan_Bar__Display_Template"> <Anchors> <Anchor point="TOPLEFT" relativeTo="UIParent" relativePoint="TOPLEFT"> <Offset> @@ -61,7 +55,7 @@ <AbsDimension x="0" y="-24"/> </Offset> </Anchor> - </Anchors> + </Anchors> </Button> <Button name="Titan_Bar__Hider_Bar" inherits="TitanPanelBarButtonHiderTemplate" hidden="false"> <Anchors> @@ -78,7 +72,7 @@ </Anchors> </Button> - <Button name="Titan_Bar__Display_Bar2" frameStrata="DIALOG" parent="UIParent" inherits="Titan_Bar__Display_Template"> + <Button name="Titan_Bar__Display_Bar2" frameStrata="DIALOG" parent="UIParent" inherits="Titan_Bar__Display_Template"> <Anchors> <Anchor point="TOPLEFT" relativeTo="UIParent" relativePoint="TOPLEFT"> <Offset> @@ -90,7 +84,7 @@ <AbsDimension x="0" y="-48"/> </Offset> </Anchor> - </Anchors> + </Anchors> </Button> <Button name="Titan_Bar__Hider_Bar2" inherits="TitanPanelBarButtonHiderTemplate" hidden="false"> <Anchors> @@ -102,7 +96,7 @@ </Anchors> </Button> - <Button name="Titan_Bar__Display_AuxBar2" frameStrata="DIALOG" parent="UIParent" inherits="Titan_Bar__Display_Template"> + <Button name="Titan_Bar__Display_AuxBar2" frameStrata="DIALOG" parent="UIParent" inherits="Titan_Bar__Display_Template"> <Anchors> <Anchor point="BOTTOMLEFT" relativeTo="UIParent" relativePoint="BOTTOMLEFT"> <Offset> @@ -114,7 +108,7 @@ <AbsDimension x="0" y="48"/> </Offset> </Anchor> - </Anchors> + </Anchors> </Button> <Button name="Titan_Bar__Hider_AuxBar2" inherits="TitanPanelBarButtonHiderTemplate" hidden="false"> <Anchors> @@ -126,7 +120,7 @@ </Anchors> </Button> - <Button name="Titan_Bar__Display_AuxBar" frameStrata="DIALOG" parent="UIParent" inherits="Titan_Bar__Display_Template"> + <Button name="Titan_Bar__Display_AuxBar" frameStrata="DIALOG" parent="UIParent" inherits="Titan_Bar__Display_Template"> <Anchors> <Anchor point="BOTTOMLEFT" relativeTo="UIParent" relativePoint="BOTTOMLEFT"> <Offset> @@ -138,7 +132,7 @@ <AbsDimension x="0" y="24"/> </Offset> </Anchor> - </Anchors> + </Anchors> </Button> <Button name="Titan_Bar__Hider_AuxBar" inherits="TitanPanelBarButtonHiderTemplate" hidden="false"> <Anchors> @@ -216,50 +210,21 @@ </Scripts> </Button> </Frames> - </Frame> + </Frame> <!-- These two frames are placed at the bottom of the top - and top of the bottom to give addons a notion of what + and top of the bottom to give addons a notion of what space Titan is using. A non zero size is needed for the anchors to respond properly. --> - <Button name="TitanPanelTopAnchor" frameStrata="DIALOG" parent="UIParent" > + <Button name="TitanPanelTopAnchor" frameStrata="DIALOG" parent="UIParent" > <Size> <AbsDimension x="1" y="1" /> </Size> </Button> - <Button name="TitanPanelBottomAnchor" frameStrata="DIALOG" parent="UIParent" > + <Button name="TitanPanelBottomAnchor" frameStrata="DIALOG" parent="UIParent" > <Size> <AbsDimension x="1" y="1" /> </Size> </Button> - - <!-- - <Button name="TitanPanelTopTest" frameStrata="DIALOG" parent="UIParent"> - <Anchors> - <Anchor point="TOPLEFT" relativeTo="TitanPanelTopAnchor" relativePoint="BOTTOMLEFT" /> - </Anchors> - <Size> - <AbsDimension x="10" y="1" /> - </Size> - <ButtonText name="$parentText" inherits="GameFontNormalSmall" justifyH="LEFT" > - <Anchors> - <Anchor point="TOPLEFT" relativeTo="$parent" relativePoint="TOPLEFT" /> - </Anchors> - </ButtonText> - </Button> - <Button name="TitanPanelBottomTest" frameStrata="DIALOG" parent="UIParent"> - <Anchors> - <Anchor point="BOTTOMLEFT" relativeTo="TitanPanelBottomAnchor" relativePoint="TOPLEFT" /> - </Anchors> - <Size> - <AbsDimension x="10" y="10" /> - </Size> - <ButtonText name="$parentText" inherits="GameFontNormalSmall" justifyH="LEFT" > - <Anchors> - <Anchor point="TOPLEFT" relativeTo="$parent" relativePoint="TOPLEFT" /> - </Anchors> - </ButtonText> - </Button> - --> -</Ui> \ No newline at end of file +</Ui> diff --git a/Titan/TitanPanelTemplate.xml b/Titan/TitanPanelTemplate.xml index 995d060..ab7d849 100644 --- a/Titan/TitanPanelTemplate.xml +++ b/Titan/TitanPanelTemplate.xml @@ -2,17 +2,8 @@ ..\FrameXML\UI.xsd"> <Script file="TitanPanelTemplate.lua" /> <Button name="TitanPanelButtonTemplate" hidden="true" movable="true" virtual="true"> - <!-- - inherits="BackdropTemplate" mixin="BackdropTemplateMixin" - --> - <!-- Removed on 20181229 to deal with the new LibUIDropDownMenu - <Frames> - <Frame name="$parentRightClickMenu" inherits="L_UIDropDownMenuTemplate" id="1" hidden="true"> - </Frame> - </Frames> - --> <Scripts> - <OnLoad> <!-- inherit="prepend" --> + <OnLoad> TitanPanelButton_OnLoad(self); </OnLoad> <OnShow> @@ -26,16 +17,10 @@ </OnEnter> <OnLeave> TitanPanelButton_OnLeave(self); - </OnLeave> + </OnLeave> </Scripts> </Button> <Button name="TitanPanelChildButtonTemplate" hidden="true" virtual="true"> - <!-- Removed on 20181229 to deal with the new LibUIDropDownMenu - <Frames> - <Frame name="$parentRightClickMenu" inherits="L_UIDropDownMenuTemplate" id="1" hidden="true"> - </Frame> - </Frames> - --> <Scripts> <OnLoad> TitanPanelButton_OnLoad(self, true); @@ -77,7 +62,7 @@ <Texture name="$parentIcon"> <Size> <AbsDimension x="16" y="16"/> - </Size> + </Size> <Anchors> <Anchor point="LEFT" /> </Anchors> @@ -94,7 +79,7 @@ <Texture name="$parentIcon"> <Size> <AbsDimension x="0" y="16"/> - </Size> + </Size> <Anchors> <Anchor point="LEFT" /> </Anchors> @@ -113,19 +98,6 @@ <HitRectInsets> <AbsInset left="-10" right="-10" top="0" bottom="0"/> </HitRectInsets> -<!-- Removed on 20200817 to deal with the new Backdrop API for 9.0 (Shadowlands) - <Backdrop bgFile="Interface\Buttons\UI-SliderBar-Background" edgeFile="Interface\Buttons\UI-SliderBar-Border" tile="true"> - <EdgeSize> - <AbsValue val="8"/> - </EdgeSize> - <TileSize> - <AbsValue val="8"/> - </TileSize> - <BackgroundInsets> - <AbsInset left="6" right="6" top="3" bottom="3"/> - </BackgroundInsets> - </Backdrop> ---> <Layers> <Layer level="ARTWORK"> <FontString name="$parentText" inherits="GameFontGreenSmall"> diff --git a/Titan/TitanUtils.lua b/Titan/TitanUtils.lua index c31c6f3..2787425 100644 --- a/Titan/TitanUtils.lua +++ b/Titan/TitanUtils.lua @@ -21,10 +21,9 @@ TITAN_PANEL_VARS.debug.events = false local _G = getfenv(0); local L = LibStub("AceLocale-3.0"):GetLocale(TITAN_ID, true) local media = LibStub("LibSharedMedia-3.0") -local DDM = LibStub:GetLibrary("LibUIDropDownMenu-4.0") -- The LibUIDropDownMenu lib is used over the Blizzard frame -local drop_down_1 = "L_DropDownList1" +local drop_down_1 = "DropDownList1" -- Boo!! Per hard-coded Blizz UIDropDownMenu.lua -- -- The routines labeled API are useable by addon developers -- @@ -322,7 +321,7 @@ NAME: TitanUtils_Min DESC: Return the min of a or b VAR: a - a value VAR: b - a value -OUT: +OUT: - value of min (a, b) --]] function TitanUtils_Min(a, b) @@ -350,14 +349,14 @@ end NAME: TitanUtils_Round DESC: Return the nearest integer VAR: v - a value -OUT: +OUT: - value of nearest integer --]] function TitanUtils_Round(v) local f = math.floor(v) - if v == f then + if v == f then return f - else + else return math.floor(v + 0.5) end end @@ -689,20 +688,35 @@ function TitanUtils_ToString(text) return TitanUtils_Ternary(text, text, ""); end --------------------------------------------------------------- --- --- Right click menu routines for plugins --- The expected global function name in the plugin is: --- "TitanPanelRightClickMenu_Prepare"..<registry.id>.."Menu" --- +------------------------------------------------- +--[[ +Right click menu routines for plugins +The expected global function name in the plugin is: +"TitanPanelRightClickMenu_Prepare"..<registry.id>.."Menu" + +This section abstracts the menu routines built into WoW. +Over time Titan used the menu routines written by Blizzard and a lib under Ace3. Currently back to the Blizzard routines. +Whenever there is a change to the menu routines, the abstractions allows us to update Utils rather than updating Titan using search & replace. +--]] + --[[ API NAME: TitanPanelRightClickMenu_GetDropdownLevel -DESC: Menu - add given info (button) at the given level in the form of a button. +DESC: Menu - Get the current level in the menus. VAR: None OUT: int - dropdown menu level --]] function TitanPanelRightClickMenu_GetDropdownLevel() - return _G["L_UIDROPDOWNMENU_MENU_LEVEL"] + return UIDROPDOWNMENU_MENU_LEVEL +end + +--[[ API +NAME: TitanPanelRightClickMenu_GetDropdMenuValue +DESC: Menu - Get the current value in the selected menu. +VAR: None +OUT: int - dropdown menu value +--]] +function TitanPanelRightClickMenu_GetDropdMenuValue() + return UIDROPDOWNMENU_MENU_VALUE end --[[ API @@ -714,7 +728,7 @@ OUT: None --]] function TitanPanelRightClickMenu_AddButton(info, level) if (info) then - DDM:UIDropDownMenu_AddButton(info, level); + UIDropDownMenu_AddButton(info, level); end end @@ -738,7 +752,7 @@ function TitanPanelRightClickMenu_AddToggleRightSide(id, level) end info.checked = TitanGetVar(id, "DisplayOnRightSide"); info.keepShownOnClick = 1; - DDM:UIDropDownMenu_AddButton(info, level); + UIDropDownMenu_AddButton(info, level); end --[[ API @@ -755,7 +769,7 @@ function TitanPanelRightClickMenu_AddTitle(title, level) info.notCheckable = true; info.notClickable = true; info.isTitle = 1; - DDM:UIDropDownMenu_AddButton(info, level); + UIDropDownMenu_AddButton(info, level); end end @@ -780,7 +794,17 @@ function TitanPanelRightClickMenu_AddCommand(text, value, functionName, level) callback(value) end end - DDM:UIDropDownMenu_AddButton(info, level); + UIDropDownMenu_AddButton(info, level); +end + +--[[ API +NAME: TitanPanelRightClickMenu_AddSeparator +DESC: Menu - add a line at the given level in the form of an inactive button. +VAR: level - level to put the line +OUT: None +--]] +function TitanPanelRightClickMenu_AddSeparator(level) + UIDropDownMenu_AddSeparator(level) end --[[ API @@ -790,11 +814,7 @@ VAR: level - level to put the line OUT: None --]] function TitanPanelRightClickMenu_AddSpacer(level) - local info = {}; - info.notCheckable = true; - info.notClickable = true; - info.disabled = 1; - DDM:UIDropDownMenu_AddButton(info, level); + UIDropDownMenu_AddSpace(level) end --[[ API @@ -826,7 +846,7 @@ function TitanPanelRightClickMenu_AddToggleVar(text, id, var, toggleTable, level end info.checked = TitanGetVar(id, var); info.keepShownOnClick = 1; - DDM:UIDropDownMenu_AddButton(info, level); + UIDropDownMenu_AddButton(info, level); end --[[ API @@ -880,7 +900,7 @@ function TitanPanelRightClickMenu_AddHide(id, level) info.func = function() TitanPanelRightClickMenu_Hide(id) end - DDM:UIDropDownMenu_AddButton(info, level); + UIDropDownMenu_AddButton(info, level); end --[[ API @@ -959,12 +979,12 @@ function TitanPanelRightClickMenu_SetCustomBackdrop(frame) }) frame:SetBackdropBorderColor( - TOOLTIP_DEFAULT_COLOR.r, - TOOLTIP_DEFAULT_COLOR.g, + TOOLTIP_DEFAULT_COLOR.r, + TOOLTIP_DEFAULT_COLOR.g, TOOLTIP_DEFAULT_COLOR.b); frame:SetBackdropColor( - TOOLTIP_DEFAULT_BACKGROUND_COLOR.r, - TOOLTIP_DEFAULT_BACKGROUND_COLOR.g, + TOOLTIP_DEFAULT_BACKGROUND_COLOR.r, + TOOLTIP_DEFAULT_BACKGROUND_COLOR.g, TOOLTIP_DEFAULT_BACKGROUND_COLOR.b , 1); end @@ -1098,7 +1118,7 @@ function TitanUtils_GetFirstButtonOnBar(bar, side) for i, id in pairs(TitanPanelSettings.Buttons) do if TitanUtils_GetWhichBar(id) == bar and i > index - and TitanPanel_GetPluginSide(id) == side + and TitanPanel_GetPluginSide(id) == side and TitanUtils_IsPluginRegistered(id) then return i; end @@ -1108,7 +1128,7 @@ end --[[ Titan NAME: TitanUtils_ShiftButtonOnBarLeft DESC: Find the button that is on the bar and is on the side and left of the given button -VAR: +VAR: - name - id of the plugin OUT: None --]] @@ -1137,7 +1157,7 @@ end --[[ Titan NAME: TitanUtils_ShiftButtonOnBarRight DESC: Find the button that is on the bar and is on the side and right of the given button -VAR: +VAR: - name - id of the plugin OUT: None --]] @@ -1247,7 +1267,7 @@ end --[[ Titan NAME: TitanUtils_PluginToRegister DESC: Place the plugin to be registered later by Titan -VAR: +VAR: - self - frame of the plugin (must be a Titan template) - isChildButton - true if the frame is a child of a Titan frame OUT: None @@ -1284,18 +1304,18 @@ function TitanUtils_PluginToRegister(self, isChildButton) plugin_type = "", notes = notes, } - + --[[ For updated menu lib (Dec 2018) Old way was to use the XML file to declare the frame, now it needs to be in Lua <Frame name="$parentRightClickMenu" inherits="L_UIDropDownMenuTemplate" id="1" hidden="true"></Frame> --]] - local f = DDM:Create_UIDropDownMenu(self:GetName().."RightClickMenu", self) + local f = CreateFrame("Frame", self:GetName().."RightClickMenu", self or nil, "UIDropDownMenuTemplate") end --[[ Titan NAME: TitanUtils_PluginFail DESC: Place the plugin to be registered later by Titan -VAR: +VAR: - plugin - frame of the plugin (must be a Titan template) OUT: None NOTE: @@ -1323,9 +1343,9 @@ end --[[ local NAME: TitanUtils_RegisterPluginProtected DESC: This routine is intended to be called in a protected manner (pcall) by Titan when it attempts to register a plugin. -VAR: +VAR: - plugin - frame of the plugin (must be a Titan template) -OUT: +OUT: - table .issue : Show the user what prevented the plugin from registering .result : Used so we know which plugins were processed @@ -1444,7 +1464,7 @@ end --[[ Titan NAME: TitanUtils_RegisterPlugin DESC: Attempt to register a plugin that has requested to be registered -VAR: +VAR: - plugin - frame of the plugin (must be a Titan template) OUT: None NOTE: @@ -1536,7 +1556,7 @@ end --[[ API NAME: TitanUtils_IsPluginRegistered DESC: See if the given plugin was registered successfully. -VAR: +VAR: - id - id of the plugin OUT: None - true (successful) or false @@ -1568,7 +1588,7 @@ end NAME: TitanRightClick_UIScale DESC: Scale the right click menu to the user requested value. VAR: None -OUT: +OUT: - float - x scaled - float - y scaled - float - scale used @@ -1604,7 +1624,7 @@ end --[[ local NAME: TitanRightClickMenu_OnLoad DESC: Prepare the plugin right click menu using the function given by the plugin. -VAR: +VAR: - plugin - frame of the plugin (must be a Titan template) OUT: None NOTE: @@ -1616,7 +1636,7 @@ local function TitanRightClickMenu_OnLoad(self) if id then local prepareFunction = _G["TitanPanelRightClickMenu_Prepare"..id.."Menu"] if prepareFunction and type(prepareFunction) == "function" then - DDM:UIDropDownMenu_Initialize(self, prepareFunction, "MENU"); + UIDropDownMenu_Initialize(self, prepareFunction, "MENU"); end else -- TitanDebug("Could not display tooltip. " @@ -1629,7 +1649,7 @@ end --[[ local NAME: TitanDisplayRightClickMenu_OnLoad DESC: Prepare the Titan bar right click menu using the given function. -VAR: +VAR: - self - frame of the Titan bar - func - function to create the menu OUT: None @@ -1648,14 +1668,14 @@ local function TitanDisplayRightClickMenu_OnLoad(self, func) -- not good practice but there seems to be no other way to get -- the actual bar (frame parent) to the dropdown implementation TitanPanel_DropMenu = self - DDM:UIDropDownMenu_Initialize(self, prepareFunction, "MENU"); + UIDropDownMenu_Initialize(self, prepareFunction, "MENU"); end end --[[ local NAME: TitanPanelRightClickMenu_Toggle DESC: Call the routine to build the plugin menu then place it properly. -VAR: +VAR: - self - frame of the plugin (must be a Titan template) - isChildButton - function to create the menu OUT: None @@ -1698,13 +1718,13 @@ function TitanPanelRightClickMenu_Toggle(self, isChildButton) x, y, scale = TitanRightClick_UIScale() - DDM:ToggleDropDownMenu(1, nil, menu, frame, TitanUtils_Max(x - 40, 0), 0, nil, self); + ToggleDropDownMenu(1, nil, menu, frame, TitanUtils_Max(x - 40, 0), 0, nil, self); end --[[ Titan NAME: TitanPanelDisplayRightClickMenu_Toggle DESC: Call the routine to build the Titan bar menu then place it properly. -VAR: +VAR: - self - frame of the Titan bar - isChildButton - function to create the menu OUT: None @@ -1730,7 +1750,7 @@ function TitanPanelDisplayRightClickMenu_Toggle(self, isChildButton) local menu -- Per updated menu lib LibUIDropDownMenu Dec 2018 - -- This could have been done in some initialize code but here it can react + -- This could have been done in some initialize code but here it can react -- better to future Titan frame code changes local desired_frame = frame.."RightClickMenu" if _G[desired_frame] then @@ -1738,10 +1758,10 @@ function TitanPanelDisplayRightClickMenu_Toggle(self, isChildButton) else -- need to create the frame -- The _G is needed but it is explicit & shows what needs to done - _G[desired_frame] = DDM:Create_UIDropDownMenu(desired_frame, self) + _G[desired_frame] = CreateFrame("Frame", desired_frame, self or nil, "UIDropDownMenuTemplate") end menu = _G[desired_frame]; - + -- Initialize the DropDown Menu if not already initialized TitanDisplayRightClickMenu_OnLoad(menu, "TitanPanelRightClickMenu_PrepareBarMenu") @@ -1755,14 +1775,14 @@ function TitanPanelDisplayRightClickMenu_Toggle(self, isChildButton) x, y, scale = TitanRightClick_UIScale() - DDM:ToggleDropDownMenu(1, nil, menu, frame, TitanUtils_Max(x - 40, 0), 0, nil, self) + ToggleDropDownMenu(1, nil, menu, frame, TitanUtils_Max(x - 40, 0), 0, nil, self) end --[[ Titan NAME: TitanPanelRightClickMenu_IsVisible DESC: Determine if a right click menu is shown. There can only be one. VAR: None -OUT: +OUT: - true (IsVisible) or false --]] function TitanPanelRightClickMenu_IsVisible() @@ -1793,9 +1813,9 @@ end --[[ Titan NAME: TitanUtils_ParseName DESC: Parse the player name and return the parts. -VAR: +VAR: - name - the name to break up -OUT: +OUT: - string player name only - string realm name only --]] @@ -1816,10 +1836,10 @@ end --[[ Titan NAME: TitanUtils_CreateName DESC: Given the player name and server and return the Titan name. -VAR: +VAR: - player - 1st part - realm - 2nd part. Could be realm or 'custom' -OUT: +OUT: - string - Titan name --]] function TitanUtils_CreateName(player, realm) @@ -1833,7 +1853,7 @@ end NAME: TitanUtils_GetPlayer DESC: Create the player name (toon being played) and return the parts. VAR: None -OUT: +OUT: - string Titan player name or nil - string player name only - string realm name only @@ -1845,8 +1865,6 @@ function TitanUtils_GetPlayer() if (playerName == nil or serverName == nil --- Removed the following because people are using "Unknown" as a character name. --- or playerName == UNKNOWNOBJECT or playerName == UKNOWNBEING) then -- Do nothing if player name is not available else @@ -1860,7 +1878,7 @@ end NAME: TitanUtils_GetGlobalProfile DESC: Return the global profile setting and the global profile name, if any. VAR: None -OUT: +OUT: - bool Global profile value - string Global profile name or default - string player name only or blank @@ -1890,7 +1908,7 @@ end --[[ Titan NAME: TitanUtils_SetGlobalProfile DESC: Return the global profile setting and the global profile name, if any. -VAR: +VAR: - bool Global profile value - string Global profile name or default OUT: None @@ -1920,7 +1938,7 @@ end NAME: TitanPanel_GetVersion DESC: Get the Titan version into a string. VAR: None -OUT: +OUT: - string containing the version --]] function TitanPanel_GetVersion() @@ -1929,10 +1947,10 @@ end --[[ Titan NAME: TitanPrint DESC: Output a message to the user in a consistent format. -VAR: +VAR: - message - string to output - msg_type - "info" | "warning" | "error" | "plain" -OUT: +OUT: - string - message to chat window --]] function TitanPrint(message, msg_type) diff --git a/Titan/embeds.xml b/Titan/embeds.xml index 770d0b1..cb2f89a 100644 --- a/Titan/embeds.xml +++ b/Titan/embeds.xml @@ -12,5 +12,4 @@ <Include file="libs\LibSharedMedia-3.0\lib.xml"/> <Include file="libs\AceGUI-3.0-SharedMediaWidgets\widget.xml"/> <Include file="libs\LibQTip-1.0\lib.xml"/> -<Include file="libs\!LibUIDropDownMenu\LibUIDropDownMenu\LibUIDropDownMenu.xml"/> </Ui> diff --git a/Titan/libs/!LibUIDropDownMenu/!LibUIDropDownMenu.toc b/Titan/libs/!LibUIDropDownMenu/!LibUIDropDownMenu.toc deleted file mode 100755 index 0828d84..0000000 --- a/Titan/libs/!LibUIDropDownMenu/!LibUIDropDownMenu.toc +++ /dev/null @@ -1,12 +0,0 @@ -## Interface: 90002 -## Title: Lib: UIDropDownMenu -## Notes: A Replacement for standard UIDropDownMenu -## Version: v4.00.9000236639 -## X-Category: Libraries -## X-Website: https://www.wowace.com/projects/libuidropdownmenu -## OptionalDeps: LibStub - -#@no-lib-strip@ -LibStub\LibStub.lua -#@end-no-lib-strip@ -LibUIDropDownMenu\LibUIDropDownMenu.lua diff --git a/Titan/libs/!LibUIDropDownMenu/Docs/Readme.txt b/Titan/libs/!LibUIDropDownMenu/Docs/Readme.txt deleted file mode 100755 index 53674f6..0000000 --- a/Titan/libs/!LibUIDropDownMenu/Docs/Readme.txt +++ /dev/null @@ -1,178 +0,0 @@ -$Id: Readme.txt 64 2020-11-18 13:13:15Z arithmandar $ - -== About == -Standard UIDropDownMenu global functions using protected frames and causing taints -when used by third-party addons. But it is possible to avoid taints by using same -functionality with that library. - -== What is it == -Library is standard code from Blizzard's files EasyMenu.lua, UIDropDownMenu.lua, -UIDropDownMenu.xml and UIDropDownMenuTemplates.xml with frames, tables, variables -and functions renamed to: -* constants : "L_" added at the start -* functions: "L_" added at the start - -== How to use it (for addon developer) == -=== Initial Preparation === -Assuming your addon is using all the UIDropDownMenu functions from the WoW's -built in function calls, then it is suggested that you have below preparation -in your lua codes: - local LibDD = LibStub:GetLibrary("LibUIDropDownMenu-4.0") - -=== Function Call Replacement === -Depends on which UIDropDownMenu's function calls you have used in your addon, -you will need below similar replacement: - - UIDropDownMenu_Initialize => LibDD:UIDropDownMenu_Initialize - UIDropDownMenu_CreateInfo => LibDD:UIDropDownMenu_CreateInfo - UIDropDownMenu_AddButton => LibDD:UIDropDownMenu_AddButton - - UIDropDownMenu_AddSeparator => LibDD:UIDropDownMenu_AddSeparator - UIDropDownMenu_AddSpace=> LibDD:UIDropDownMenu_AddSpace - - UIDropDownMenu_SetSelectedValue => LibDD:UIDropDownMenu_SetSelectedValue - UIDropDownMenu_SetSelectedName=> LibDD:UIDropDownMenu_SetSelectedName - - UIDropDownMenu_SetSelectedID => LibDD:UIDropDownMenu_SetSelectedID - UIDropDownMenu_SetWidth => LibDD:UIDropDownMenu_SetWidth - - CloseDropDownMenus => LibDD:CloseDropDownMenus - -=== Creating new UIDropDownMenu === -Traditionally you will either create a new frame in your lua codes or with -XML by setting the frame to inherit from "UIDropDownMenuTemplate". - -By using this library, you will need to create your menu from like below: - local frame = LibDD:Create_UIDropDownMenu("MyDropDownMenu", parent_frame) - -== Button Name == -As you (the developers) might be aware that at some point you might need to -manipulate the dropdowns by accessing the button names. For example, you have -multiple levels of menus and you would like to hide or show some level's menu -button. In that case, you need to make sure you also revise the button name -used in your original codes when you are migrating to use LibUIDropDownMenu. - - "L_DropDownList"..i - -Example: - - for i = 1, L_UIDROPDOWNMENU_MAXLEVELS, 1 do - dropDownList = _G["L_DropDownList"..i]; - if ( i >= L_UIDROPDOWNMENU_MENU_LEVEL or frame ~= L_UIDROPDOWNMENU_OPEN_MENU ) then - dropDownList.numButtons = 0; - dropDownList.maxWidth = 0; - for j=1, L_UIDROPDOWNMENU_MAXBUTTONS, 1 do - button = _G["L_DropDownList"..i.."Button"..j]; - button:Hide(); - end - dropDownList:Hide(); - end - end - -== Constants == -* L_UIDROPDOWNMENU_MINBUTTONS -* L_UIDROPDOWNMENU_MAXBUTTONS -* L_UIDROPDOWNMENU_MAXLEVELS -* L_UIDROPDOWNMENU_BUTTON_HEIGHT -* L_UIDROPDOWNMENU_BORDER_HEIGHT -* L_UIDROPDOWNMENU_OPEN_MENU -* L_UIDROPDOWNMENU_INIT_MENU -* L_UIDROPDOWNMENU_MENU_LEVEL -* L_UIDROPDOWNMENU_MENU_VALUE -* L_UIDROPDOWNMENU_SHOW_TIME -* L_UIDROPDOWNMENU_DEFAULT_TEXT_HEIGHT -* L_OPEN_DROPDOWNMENUS - -== Functions == -* lib:EasyMenu -* lib:EasyMenu_Initialize - -* lib:UIDropDownMenuDelegate_OnAttributeChanged -* lib:UIDropDownMenu_InitializeHelper -* lib:UIDropDownMenu_Initialize -* lib:UIDropDownMenu_SetInitializeFunction -* lib:UIDropDownMenu_RefreshDropDownSize -* lib:UIDropDownMenu_OnUpdate -* lib:UIDropDownMenu_StartCounting -* lib:UIDropDownMenu_StopCounting -* lib:UIDropDownMenu_CheckAddCustomFrame -* lib:UIDropDownMenu_CreateInfo -* lib:UIDropDownMenu_CreateFrames -* lib:UIDropDownMenu_AddSeparator -* lib:UIDropDownMenu_AddButton -* lib:UIDropDownMenu_AddSeparator -* lib:UIDropDownMenu_GetMaxButtonWidth -* lib:UIDropDownMenu_GetButtonWidth -* lib:UIDropDownMenu_Refresh -* lib:UIDropDownMenu_RefreshAll -* lib:UIDropDownMenu_RegisterCustomFrame -* lib:UIDropDownMenu_SetIconImage -* lib:UIDropDownMenu_SetSelectedName -* lib:UIDropDownMenu_SetSelectedValue -* lib:UIDropDownMenu_SetSelectedID -* lib:UIDropDownMenu_GetSelectedName -* lib:UIDropDownMenu_GetSelectedID -* lib:UIDropDownMenu_GetSelectedValue -* lib:UIDropDownMenuButton_OnClick -* lib:HideDropDownMenu -* lib:ToggleDropDownMenu -* lib:CloseDropDownMenus -* lib:UIDropDownMenu_OnHide -* lib:UIDropDownMenu_SetWidth -* lib:UIDropDownMenu_SetButtonWidth -* lib:UIDropDownMenu_SetText -* lib:UIDropDownMenu_GetText -* lib:UIDropDownMenu_ClearAll -* lib:UIDropDownMenu_JustifyText -* lib:UIDropDownMenu_SetAnchor -* lib:UIDropDownMenu_GetCurrentDropDown -* lib:UIDropDownMenuButton_GetChecked -* lib:UIDropDownMenuButton_GetName -* lib:UIDropDownMenuButton_OpenColorPicker -* lib:UIDropDownMenu_DisableButton -* lib:UIDropDownMenu_EnableButton -* lib:UIDropDownMenu_SetButtonText -* lib:UIDropDownMenu_SetButtonNotClickable -* lib:UIDropDownMenu_SetButtonClickable -* lib:UIDropDownMenu_DisableDropDown -* lib:UIDropDownMenu_EnableDropDown -* lib:UIDropDownMenu_IsEnabled -* lib:UIDropDownMenu_GetValue - -== List of button attributes == -* info.text = [STRING] -- The text of the button -* info.value = [ANYTHING] -- The value that L_UIDROPDOWNMENU_MENU_VALUE is set to when the button is clicked -* info.func = [function()] -- The function that is called when you click the button -* info.checked = [nil, true, function] -- Check the button if true or function returns true -* info.isNotRadio = [nil, true] -- Check the button uses radial image if false check box image if true -* info.isTitle = [nil, true] -- If it's a title the button is disabled and the font color is set to yellow -* info.disabled = [nil, true] -- Disable the button and show an invisible button that still traps the mouseover event so menu doesn't time out -* info.tooltipWhileDisabled = [nil, 1] -- Show the tooltip, even when the button is disabled. -* info.hasArrow = [nil, true] -- Show the expand arrow for multilevel menus -* info.hasColorSwatch = [nil, true] -- Show color swatch or not, for color selection -* info.r = [1 - 255] -- Red color value of the color swatch -* info.g = [1 - 255] -- Green color value of the color swatch -* info.b = [1 - 255] -- Blue color value of the color swatch -* info.colorCode = [STRING] -- "|cAARRGGBB" embedded hex value of the button text color. Only used when button is enabled -* info.swatchFunc = [function()] -- Function called by the color picker on color change -* info.hasOpacity = [nil, 1] -- Show the opacity slider on the colorpicker frame -* info.opacity = [0.0 - 1.0] -- Percentatge of the opacity, 1.0 is fully shown, 0 is transparent -* info.opacityFunc = [function()] -- Function called by the opacity slider when you change its value -* info.cancelFunc = [function(previousValues)] -- Function called by the colorpicker when you click the cancel button (it takes the previous values as its argument) -* info.notClickable = [nil, 1] -- Disable the button and color the font white -* info.notCheckable = [nil, 1] -- Shrink the size of the buttons and don't display a check box -* info.owner = [Frame] -- Dropdown frame that "owns" the current dropdownlist -* info.keepShownOnClick = [nil, 1] -- Don't hide the dropdownlist after a button is clicked -* info.tooltipTitle = [nil, STRING] -- Title of the tooltip shown on mouseover -* info.tooltipText = [nil, STRING] -- Text of the tooltip shown on mouseover -* info.tooltipOnButton = [nil, 1] -- Show the tooltip attached to the button instead of as a Newbie tooltip. -* info.justifyH = [nil, "CENTER"] -- Justify button text -* info.arg1 = [ANYTHING] -- This is the first argument used by info.func -* info.arg2 = [ANYTHING] -- This is the second argument used by info.func -* info.fontObject = [FONT] -- font object replacement for Normal and Highlight -* info.menuTable = [TABLE] -- This contains an array of info tables to be displayed as a child menu -* info.noClickSound = [nil, 1] -- Set to 1 to suppress the sound when clicking the button. The sound only plays if .func is set. -* info.padding = [nil, NUMBER] -- Number of pixels to pad the text on the right side -* info.leftPadding = [nil, NUMBER] -- Number of pixels to pad the button on the left side -* info.minWidth = [nil, NUMBER] -- Minimum width for this line -* info.customFrame = frame -- Allows this button to be a completely custom frame, should inherit from L_UIDropDownCustomMenuEntryTemplate and override appropriate methods. \ No newline at end of file diff --git a/Titan/libs/!LibUIDropDownMenu/Docs/Revision.txt b/Titan/libs/!LibUIDropDownMenu/Docs/Revision.txt deleted file mode 100755 index 9e29829..0000000 --- a/Titan/libs/!LibUIDropDownMenu/Docs/Revision.txt +++ /dev/null @@ -1,124 +0,0 @@ -$Id: Revision.txt 66 2020-11-22 15:25:00Z arithmandar $ - -Revision History: -================= - -v4.00.9000236639 (2020/11/22) ------------------------------ -- Toc update to suppport WoW 9.0.2 -- LibUIDropDownMenu - - Set major version to 4.0 - - Migrate all global functions to be under library tables - - Insert "L_DropDownList1" and "L_DropDownList2" to global UIMenus - - UIDropDownMenu_HandleGlobalMouseEvent (thanks to SLOKnightFall) -- LibEasyMenu - - Move function calls to under LibUIDropDownMenu and under library tables -- LibUIDropDownMenuTemplates - - Move codes to under LibUIDropDownMenu so that thet can de under one single library - -v3.02.9000136272.01 (2020/10/20) ------------------------------ -- Fixed version detection while setting ColorSwatch's backdrop template. It should now be correctly detecting the retail (as well as ShadowLands) version - -v3.02.9000136272 (2020/10/18) ------------------------------ -- Update to sync with 9.0.1 build 36272 -- ToC update to support WoW 9.0.1 - -v3.01.9000135522 (2020/09/07) ------------------------------ -- Updated Backdrop's handling - -v3.00.9000135522 (2020/08/19) ------------------------------ -- Shadowlands support and backward compatibility for both WoW classic and BFA - -v2.01.8020031429 (2019/08/12) ------------------------------ -- Update to sync with 8.2.0 build 31429 -- ToC update - -v2.00.8010028833 (2018/12/27) ------------------------------ -- Migrate template to Lua function call - (Refer to below page for more details: - https://www.wowace.com/projects/libuidropdownmenu/pages/faq/changes-regarding-to-dropdown-templates-usage ) -- Update major version to "LibUIDropDownMenu-2.0" - -v1.08.8010028768 (2018/12/17) ------------------------------ -- Update to sync with 8.0.1 build 28768 -- ToC update - -v1.08.8000127326 (2018/08/11) ------------------------------ -- Workaround to get rid of addons which are still using old version of this library - (thanks to ddcorkum) - -v1.08.8000127165 (2018/07/25) ------------------------------ -- Sync with WoW 8.0.1.27165 - - Added L_UIDropDownMenu_SetDisplayMode() - - Added L_UIDropDownMenuButtonInvisibleButton_OnEnter() - - Added L_UIDropDownMenuButtonInvisibleButton_OnLeave() - - Added L_UIDropDownMenuButton_OnEnter() - - Added L_UIDropDownMenuButton_OnLeave() - -v1.08.8000126433 (2018/04/24) ------------------------------ -- Sync with WoW 8.0.1.26433 - - Added LibUIDropDownMenuTemplates.lua - - Added frame template: L_UIDropDownCustomMenuEntryTemplate - - Added local function GetChild() - - New custom frame functions: - - L_UIDropDownMenu_CheckAddCustomFrame() - - L_UIDropDownMenu_RegisterCustomFrame() - - New button attribute: info.customFrame - - Changes of L_UIDropDownMenu_AddSeparator() is to be reflected only on WoW 8.x.x - - L_UIDropDownMenu_AddSeparator(info, level) == > L_UIDropDownMenu_AddSeparator(level) - No need to specify info there to prevent from messing up other menu items if info is to be re-used. -- Fixed the lib's major version. - Previously with the wrong major version which also has the release version, it makes all the different versions of lib to be presented - as different entities, which means newer version won't replace the older version. The latest loaded one will replace all the constants - and functions. - This change will take effect until all the addons which embed this lib to replace with latest version. - -v1.07.7030525961 (2018/04/23) ------------------------------ -- Remove external -- Refine upvalue and local function pre-definition -- Rename local parameters to make them consistent with others - -v1.07.7030024931 (2017/08/31) ------------------------------ -- Remove PlaySound compact code. - -v1.06.7030024931 (2017/08/31) ------------------------------ -- Remove PlaySound compact code. - -v1.05.7030024920 (2017/08/29) ------------------------------ -- ToC update to support WoW 7.3.0 - -v1.04.7030024484 (2017/07/02) ------------------------------ -- Changed soundkit's ID to key indicator likes SOUNDKIT.U_CHAT_SCROLL_BUTTON - -v1.03.7030024484 (2017/06/30) ------------------------------ -- Update version number - -v1.02.7030024484 (2017/06/30) ------------------------------ -- Updated PlaySound API's usage method to support both 7.2.5 and 7.3.0 of WoW clients - -v1.01.7020024015 (2017/05/25) ----------------------------- -- Fixed the wrong name of LibEasyMenu.lua specified in LibUIDropDownMenu.xml - -v1.00.7020024015 (2017/05/24) ----------------------------- -- Clone from NoTaint_UIDropDownMenu v7.2.0.24015-r2 -- Changed LIB_ and Lib_ to L_ to prevent from conflict with outdated - NoTaint_UIDropDownMenu being loaded from other addons diff --git a/Titan/libs/!LibUIDropDownMenu/LibStub/LibStub.lua b/Titan/libs/!LibUIDropDownMenu/LibStub/LibStub.lua deleted file mode 100755 index 7e7b76d..0000000 --- a/Titan/libs/!LibUIDropDownMenu/LibStub/LibStub.lua +++ /dev/null @@ -1,51 +0,0 @@ --- $Id: LibStub.lua 103 2014-10-16 03:02:50Z mikk $ --- LibStub is a simple versioning stub meant for use in Libraries. http://www.wowace.com/addons/libstub/ for more info --- LibStub is hereby placed in the Public Domain --- Credits: Kaelten, Cladhaire, ckknight, Mikk, Ammo, Nevcairiel, joshborke -local LIBSTUB_MAJOR, LIBSTUB_MINOR = "LibStub", 2 -- NEVER MAKE THIS AN SVN REVISION! IT NEEDS TO BE USABLE IN ALL REPOS! -local LibStub = _G[LIBSTUB_MAJOR] - --- Check to see is this version of the stub is obsolete -if not LibStub or LibStub.minor < LIBSTUB_MINOR then - LibStub = LibStub or {libs = {}, minors = {} } - _G[LIBSTUB_MAJOR] = LibStub - LibStub.minor = LIBSTUB_MINOR - - -- LibStub:NewLibrary(major, minor) - -- major (string) - the major version of the library - -- minor (string or number ) - the minor version of the library - -- - -- returns nil if a newer or same version of the lib is already present - -- returns empty library object or old library object if upgrade is needed - function LibStub:NewLibrary(major, minor) - assert(type(major) == "string", "Bad argument #2 to `NewLibrary' (string expected)") - minor = assert(tonumber(strmatch(minor, "%d+")), "Minor version must either be a number or contain a number.") - - local oldminor = self.minors[major] - if oldminor and oldminor >= minor then return nil end - self.minors[major], self.libs[major] = minor, self.libs[major] or {} - return self.libs[major], oldminor - end - - -- LibStub:GetLibrary(major, [silent]) - -- major (string) - the major version of the library - -- silent (boolean) - if true, library is optional, silently return nil if its not found - -- - -- throws an error if the library can not be found (except silent is set) - -- returns the library object if found - function LibStub:GetLibrary(major, silent) - if not self.libs[major] and not silent then - error(("Cannot find a library instance of %q."):format(tostring(major)), 2) - end - return self.libs[major], self.minors[major] - end - - -- LibStub:IterateLibraries() - -- - -- Returns an iterator for the currently registered libraries - function LibStub:IterateLibraries() - return pairs(self.libs) - end - - setmetatable(LibStub, { __call = LibStub.GetLibrary }) -end diff --git a/Titan/libs/!LibUIDropDownMenu/LibStub/LibStub.toc b/Titan/libs/!LibUIDropDownMenu/LibStub/LibStub.toc deleted file mode 100755 index acd0f7e..0000000 --- a/Titan/libs/!LibUIDropDownMenu/LibStub/LibStub.toc +++ /dev/null @@ -1,9 +0,0 @@ -## Interface: 80000 -## Title: Lib: LibStub -## Notes: Universal Library Stub -## Credits: Kaelten, Cladhaire, ckknight, Mikk, Ammo, Nevcairiel -## X-Website: http://www.wowace.com/addons/libstub/ -## X-Category: Library -## X-License: Public Domain - -LibStub.lua diff --git a/Titan/libs/!LibUIDropDownMenu/LibStub/tests/test.lua b/Titan/libs/!LibUIDropDownMenu/LibStub/tests/test.lua deleted file mode 100755 index 645a08b..0000000 --- a/Titan/libs/!LibUIDropDownMenu/LibStub/tests/test.lua +++ /dev/null @@ -1,41 +0,0 @@ -debugstack = debug.traceback -strmatch = string.match - -loadfile("../LibStub.lua")() - -local lib, oldMinor = LibStub:NewLibrary("Pants", 1) -- make a new thingy -assert(lib) -- should return the library table -assert(not oldMinor) -- should not return the old minor, since it didn't exist - --- the following is to create data and then be able to check if the same data exists after the fact -function lib:MyMethod() -end -local MyMethod = lib.MyMethod -lib.MyTable = {} -local MyTable = lib.MyTable - -local newLib, newOldMinor = LibStub:NewLibrary("Pants", 1) -- try to register a library with the same version, should silently fail -assert(not newLib) -- should not return since out of date - -local newLib, newOldMinor = LibStub:NewLibrary("Pants", 0) -- try to register a library with a previous, should silently fail -assert(not newLib) -- should not return since out of date - -local newLib, newOldMinor = LibStub:NewLibrary("Pants", 2) -- register a new version -assert(newLib) -- library table -assert(rawequal(newLib, lib)) -- should be the same reference as the previous -assert(newOldMinor == 1) -- should return the minor version of the previous version - -assert(rawequal(lib.MyMethod, MyMethod)) -- verify that values were saved -assert(rawequal(lib.MyTable, MyTable)) -- verify that values were saved - -local newLib, newOldMinor = LibStub:NewLibrary("Pants", "Blah 3 Blah") -- register a new version with a string minor version (instead of a number) -assert(newLib) -- library table -assert(newOldMinor == 2) -- previous version was 2 - -local newLib, newOldMinor = LibStub:NewLibrary("Pants", "Blah 4 and please ignore 15 Blah") -- register a new version with a string minor version (instead of a number) -assert(newLib) -assert(newOldMinor == 3) -- previous version was 3 (even though it gave a string) - -local newLib, newOldMinor = LibStub:NewLibrary("Pants", 5) -- register a new library, using a normal number instead of a string -assert(newLib) -assert(newOldMinor == 4) -- previous version was 4 (even though it gave a string) \ No newline at end of file diff --git a/Titan/libs/!LibUIDropDownMenu/LibStub/tests/test2.lua b/Titan/libs/!LibUIDropDownMenu/LibStub/tests/test2.lua deleted file mode 100755 index af431dd..0000000 --- a/Titan/libs/!LibUIDropDownMenu/LibStub/tests/test2.lua +++ /dev/null @@ -1,27 +0,0 @@ -debugstack = debug.traceback -strmatch = string.match - -loadfile("../LibStub.lua")() - -for major, library in LibStub:IterateLibraries() do - -- check that MyLib doesn't exist yet, by iterating through all the libraries - assert(major ~= "MyLib") -end - -assert(not LibStub:GetLibrary("MyLib", true)) -- check that MyLib doesn't exist yet by direct checking -assert(not pcall(LibStub.GetLibrary, LibStub, "MyLib")) -- don't silently fail, thus it should raise an error. -local lib = LibStub:NewLibrary("MyLib", 1) -- create the lib -assert(lib) -- check it exists -assert(rawequal(LibStub:GetLibrary("MyLib"), lib)) -- verify that :GetLibrary("MyLib") properly equals the lib reference - -assert(LibStub:NewLibrary("MyLib", 2)) -- create a new version - -local count=0 -for major, library in LibStub:IterateLibraries() do - -- check that MyLib exists somewhere in the libraries, by iterating through all the libraries - if major == "MyLib" then -- we found it! - count = count +1 - assert(rawequal(library, lib)) -- verify that the references are equal - end -end -assert(count == 1) -- verify that we actually found it, and only once diff --git a/Titan/libs/!LibUIDropDownMenu/LibStub/tests/test3.lua b/Titan/libs/!LibUIDropDownMenu/LibStub/tests/test3.lua deleted file mode 100755 index 01aabb8..0000000 --- a/Titan/libs/!LibUIDropDownMenu/LibStub/tests/test3.lua +++ /dev/null @@ -1,14 +0,0 @@ -debugstack = debug.traceback -strmatch = string.match - -loadfile("../LibStub.lua")() - -local proxy = newproxy() -- non-string - -assert(not pcall(LibStub.NewLibrary, LibStub, proxy, 1)) -- should error, proxy is not a string, it's userdata -local success, ret = pcall(LibStub.GetLibrary, proxy, true) -assert(not success or not ret) -- either error because proxy is not a string or because it's not actually registered. - -assert(not pcall(LibStub.NewLibrary, LibStub, "Something", "No number in here")) -- should error, minor has no string in it. - -assert(not LibStub:GetLibrary("Something", true)) -- shouldn't've created it from the above statement \ No newline at end of file diff --git a/Titan/libs/!LibUIDropDownMenu/LibStub/tests/test4.lua b/Titan/libs/!LibUIDropDownMenu/LibStub/tests/test4.lua deleted file mode 100755 index 15a9c9c..0000000 --- a/Titan/libs/!LibUIDropDownMenu/LibStub/tests/test4.lua +++ /dev/null @@ -1,41 +0,0 @@ -debugstack = debug.traceback -strmatch = string.match - -loadfile("../LibStub.lua")() - - --- Pretend like loaded libstub is old and doesn't have :IterateLibraries -assert(LibStub.minor) -LibStub.minor = LibStub.minor - 0.0001 -LibStub.IterateLibraries = nil - -loadfile("../LibStub.lua")() - -assert(type(LibStub.IterateLibraries)=="function") - - --- Now pretend that we're the same version -- :IterateLibraries should NOT be re-created -LibStub.IterateLibraries = 123 - -loadfile("../LibStub.lua")() - -assert(LibStub.IterateLibraries == 123) - - --- Now pretend that a newer version is loaded -- :IterateLibraries should NOT be re-created -LibStub.minor = LibStub.minor + 0.0001 - -loadfile("../LibStub.lua")() - -assert(LibStub.IterateLibraries == 123) - - --- Again with a huge number -LibStub.minor = LibStub.minor + 1234567890 - -loadfile("../LibStub.lua")() - -assert(LibStub.IterateLibraries == 123) - - -print("OK") \ No newline at end of file diff --git a/Titan/libs/!LibUIDropDownMenu/LibUIDropDownMenu/LibEasyMenu.lua b/Titan/libs/!LibUIDropDownMenu/LibUIDropDownMenu/LibEasyMenu.lua deleted file mode 100755 index 731b6bb..0000000 --- a/Titan/libs/!LibUIDropDownMenu/LibUIDropDownMenu/LibEasyMenu.lua +++ /dev/null @@ -1,44 +0,0 @@ ---$Id: LibEasyMenu.lua 64 2020-11-18 13:13:15Z arithmandar $ --- ////////////////////////////////////////////////////////////// --- Notes: --- Functions have been moved to under LibUIDropDownMenu.lua --- New function calls are as below: --- --- - lib:EasyMenu(menuList, menuFrame, anchor, x, y, displayMode, autoHideDelay ) --- - lib:EasyMenu_Initialize( frame, level, menuList ) --- --- ////////////////////////////////////////////////////////////// --- Simplified Menu Display System --- This is a basic system for displaying a menu from a structure table. --- --- See UIDropDownMenu.lua for the menuList details. --- --- Args: --- menuList - menu table --- menuFrame - the UI frame to populate --- anchor - where to anchor the frame (e.g. CURSOR) --- x - x offset --- y - y offset --- displayMode - border type --- autoHideDelay - how long until the menu disappears --- --- ---[[ -function EasyMenu(menuList, menuFrame, anchor, x, y, displayMode, autoHideDelay ) - if ( displayMode == "MENU" ) then - menuFrame.displayMode = displayMode; - end - UIDropDownMenu_Initialize(menuFrame, EasyMenu_Initialize, displayMode, nil, menuList); - ToggleDropDownMenu(1, nil, menuFrame, anchor, x, y, menuList, nil, autoHideDelay); -end - -function EasyMenu_Initialize( frame, level, menuList ) - for index = 1, #menuList do - local value = menuList[index] - if (value.text) then - value.index = index; - UIDropDownMenu_AddButton( value, level ); - end - end -end -]] diff --git a/Titan/libs/!LibUIDropDownMenu/LibUIDropDownMenu/LibUIDropDownMenu.lua b/Titan/libs/!LibUIDropDownMenu/LibUIDropDownMenu/LibUIDropDownMenu.lua deleted file mode 100755 index a09ca9c..0000000 --- a/Titan/libs/!LibUIDropDownMenu/LibUIDropDownMenu/LibUIDropDownMenu.lua +++ /dev/null @@ -1,1952 +0,0 @@ --- $Id: LibUIDropDownMenu.lua 65 2020-11-18 14:13:49Z arithmandar $ --- ---------------------------------------------------------------------------- --- Localized Lua globals. --- ---------------------------------------------------------------------------- -local _G = getfenv(0) -local tonumber, type, string, table = _G.tonumber, _G.type, _G.string, _G.table -local tinsert = table.insert -local strsub, strlen, strmatch, gsub = _G.strsub, _G.strlen, _G.strmatch, _G.gsub -local max, match = _G.max, _G.match -local securecall, issecure = _G.securecall, _G.issecure -local wipe = table.wipe --- WoW -local CreateFrame, GetCursorPosition, GetCVar, GetScreenHeight, GetScreenWidth, PlaySound = _G.CreateFrame, _G.GetCursorPosition, _G.GetCVar, _G.GetScreenHeight, _G.GetScreenWidth, _G.PlaySound -local GetBuildInfo = _G.GetBuildInfo -local GameTooltip, GetAppropriateTooltip, tooltip, GetValueOrCallFunction -local CloseMenus, ShowUIPanel = _G.CloseMenus, _G.ShowUIPanel -local GameTooltip_SetTitle, GameTooltip_AddInstructionLine, GameTooltip_AddNormalLine, GameTooltip_AddColoredLine = _G.GameTooltip_SetTitle, _G.GameTooltip_AddInstructionLine, _G.GameTooltip_AddNormalLine, _G.GameTooltip_AddColoredLine - --- ---------------------------------------------------------------------------- -local MAJOR_VERSION = "LibUIDropDownMenu-4.0" -local MINOR_VERSION = 90000 + tonumber(("$Rev: 65 $"):match("%d+")) - -local LibStub = _G.LibStub -if not LibStub then error(MAJOR_VERSION .. " requires LibStub.") end -local lib = LibStub:NewLibrary(MAJOR_VERSION, MINOR_VERSION) -if not lib then return end - --- Determine WoW TOC Version -local WoWClassic, WoWRetail -local wowtocversion = select(4, GetBuildInfo()) -if wowtocversion < 19999 then - WoWClassic = true -else - WoWRetail = true -end - -if WoWClassic then - GameTooltip = _G.GameTooltip - tooltip = GameTooltip -else -- Shadowlands - GetAppropriateTooltip = _G.GetAppropriateTooltip - tooltip = GetAppropriateTooltip() - GetValueOrCallFunction = _G.GetValueOrCallFunction -end - --- ////////////////////////////////////////////////////////////// -L_UIDROPDOWNMENU_MAXBUTTONS = 1; -L_UIDROPDOWNMENU_MAXLEVELS = 2; -L_UIDROPDOWNMENU_BUTTON_HEIGHT = 16; -L_UIDROPDOWNMENU_BORDER_HEIGHT = 15; --- The current open menu -L_UIDROPDOWNMENU_OPEN_MENU = nil; --- The current menu being initialized -L_UIDROPDOWNMENU_INIT_MENU = nil; --- Current level shown of the open menu -L_UIDROPDOWNMENU_MENU_LEVEL = 1; --- Current value of the open menu -L_UIDROPDOWNMENU_MENU_VALUE = nil; --- Time to wait to hide the menu -L_UIDROPDOWNMENU_SHOW_TIME = 2; --- Default dropdown text height -L_UIDROPDOWNMENU_DEFAULT_TEXT_HEIGHT = nil; --- List of open menus -L_OPEN_DROPDOWNMENUS = {}; - -local L_DropDownList1, L_DropDownList2 - -local delegateFrame = CreateFrame("FRAME"); -delegateFrame:SetScript("OnAttributeChanged", function(self, attribute, value) - if ( attribute == "createframes" and value == true ) then - lib:UIDropDownMenu_CreateFrames(self:GetAttribute("createframes-level"), self:GetAttribute("createframes-index")); - elseif ( attribute == "initmenu" ) then - L_UIDROPDOWNMENU_INIT_MENU = value; - elseif ( attribute == "openmenu" ) then - L_UIDROPDOWNMENU_OPEN_MENU = value; - end -end); - -function lib:UIDropDownMenu_InitializeHelper(frame) - -- This deals with the potentially tainted stuff! - if ( frame ~= L_UIDROPDOWNMENU_OPEN_MENU ) then - L_UIDROPDOWNMENU_MENU_LEVEL = 1; - end - - -- Set the frame that's being intialized - delegateFrame:SetAttribute("initmenu", frame); - - -- Hide all the buttons - local button, dropDownList; - for i = 1, L_UIDROPDOWNMENU_MAXLEVELS, 1 do - dropDownList = _G["L_DropDownList"..i]; - if ( i >= L_UIDROPDOWNMENU_MENU_LEVEL or frame ~= L_UIDROPDOWNMENU_OPEN_MENU ) then - dropDownList.numButtons = 0; - dropDownList.maxWidth = 0; - for j=1, L_UIDROPDOWNMENU_MAXBUTTONS, 1 do - button = _G["L_DropDownList"..i.."Button"..j]; - button:Hide(); - end - dropDownList:Hide(); - end - end - frame:SetHeight(L_UIDROPDOWNMENU_BUTTON_HEIGHT * 2); -end --- ////////////////////////////////////////////////////////////// --- L_UIDropDownMenuButtonTemplate -local function create_MenuButton(name, parent) - local f = CreateFrame("Button", name, parent or nil) - f:SetWidth(100) - f:SetHeight(16) - f:SetFrameLevel(f:GetParent():GetFrameLevel()+2) - - f.Highlight = f:CreateTexture(name.."Highlight", "BACKGROUND") - f.Highlight:SetTexture("Interface\\QuestFrame\\UI-QuestTitleHighlight") - f.Highlight:SetBlendMode("ADD") - f.Highlight:SetAllPoints() - f.Highlight:Hide() - - f.Check = f:CreateTexture(name.."Check", "ARTWORK") - f.Check:SetTexture("Interface\\Common\\UI-DropDownRadioChecks") - f.Check:SetSize(16, 16) - f.Check:SetPoint("LEFT", f, 0, 0) - f.Check:SetTexCoord(0, 0.5, 0.5, 1) - - f.UnCheck = f:CreateTexture(name.."UnCheck", "ARTWORK") - f.UnCheck:SetTexture("Interface\\Common\\UI-DropDownRadioChecks") - f.UnCheck:SetSize(16, 16) - f.UnCheck:SetPoint("LEFT", f, 0, 0) - f.UnCheck:SetTexCoord(0.5, 1, 0.5, 1) - - f.Icon = f:CreateTexture(name.."Icon", "ARTWORK") - f.Icon:SetSize(16, 16) - f.Icon:SetPoint("RIGHT", f, 0, 0) - f.Icon:Hide() - - -- ColorSwatch - local fcw = CreateFrame("Button", name.."ColorSwatch", f, BackdropTemplateMixin and "ColorSwatchTemplate" or nil) - fcw:SetPoint("RIGHT", f, -6, 0) - fcw:Hide() - if WoWClassic then - fcw:SetSize(16, 16) - fcw.SwatchBg = fcw:CreateTexture(name.."ColorSwatchSwatchBg", "BACKGROUND") - fcw.SwatchBg:SetVertexColor(1, 1, 1) - fcw.SwatchBg:SetWidth(14) - fcw.SwatchBg:SetHeight(14) - fcw.SwatchBg:SetPoint("CENTER", fcw, 0, 0) - local button1NormalTexture = fcw:CreateTexture(name.."ColorSwatchNormalTexture") - button1NormalTexture:SetTexture("Interface\\ChatFrame\\ChatFrameColorSwatch") - button1NormalTexture:SetAllPoints() - fcw:SetNormalTexture(button1NormalTexture) - end - fcw:SetScript("OnClick", function(self, button, down) - CloseMenus() - lib:UIDropDownMenuButton_OpenColorPicker(self:GetParent()) - end) - fcw:SetScript("OnEnter", function(self, motion) - lib:CloseDropDownMenus(self:GetParent():GetParent():GetID() + 1) - _G[self:GetName().."SwatchBg"]:SetVertexColor(NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b) - end) - fcw:SetScript("OnLeave", function(self, motion) - _G[self:GetName().."SwatchBg"]:SetVertexColor(HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b); - end) - f.ColorSwatch = fcw - - -- ExpandArrow - local fea = CreateFrame("Button", name.."ExpandArrow", f) - - fea:SetSize(16, 16) - fea:SetPoint("RIGHT", f, 0, 0) - fea:Hide() - local button2NormalTexture = fea:CreateTexture(name.."ExpandArrowNormalTexture") - button2NormalTexture:SetTexture("Interface\\ChatFrame\\ChatFrameExpandArrow") - button2NormalTexture:SetAllPoints() - fea:SetNormalTexture(button2NormalTexture) - fea:SetScript("OnMouseDown", function(self, button) - if self:IsEnabled() then - lib:ToggleDropDownMenu(self:GetParent():GetParent():GetID() + 1, self:GetParent().value, nil, nil, nil, nil, self:GetParent().menuList, self); - PlaySound(SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON); - end - end) - fea:SetScript("OnEnter", function(self, motion) - local level = self:GetParent():GetParent():GetID() + 1 - lib:CloseDropDownMenus(level) - if self:IsEnabled() then - local listFrame = _G["L_DropDownList"..level]; - if ( not listFrame or not listFrame:IsShown() or select(2, listFrame:GetPoint()) ~= self ) then - lib:ToggleDropDownMenu(level, self:GetParent().value, nil, nil, nil, nil, self:GetParent().menuList, self) - end - end - end) - f.ExpandArrow = fea - - -- InvisibleButton - local fib = CreateFrame("Button", name.."InvisibleButton", f) - fib:Hide() - fib:SetPoint("TOPLEFT", f, 0, 0) - fib:SetPoint("BOTTOMLEFT", f, 0, 0) - fib:SetPoint("RIGHT", fcw, "LEFT", 0, 0) - fib:SetScript("OnEnter", function(self, motion) - lib:CloseDropDownMenus(self:GetParent():GetParent():GetID() + 1); - local parent = self:GetParent(); - if ( parent.tooltipTitle and parent.tooltipWhileDisabled) then - if ( parent.tooltipOnButton ) then - tooltip:SetOwner(parent, "ANCHOR_RIGHT"); - GameTooltip_SetTitle(tooltip, parent.tooltipTitle); - if parent.tooltipInstruction then - GameTooltip_AddInstructionLine(tooltip, parent.tooltipInstruction); - end - if parent.tooltipText then - GameTooltip_AddNormalLine(tooltip, parent.tooltipText, true); - end - if parent.tooltipWarning then - GameTooltip_AddColoredLine(tooltip, parent.tooltipWarning, RED_FONT_COLOR, true); - end - tooltip:Show(); - end - end - end) - fib:SetScript("OnLeave", function(self, motion) - tooltip:Hide(); - end) - f.invisibleButton = fib - - -- UIDropDownMenuButton Scripts - local function button_OnEnter(self) - if ( self.hasArrow ) then - local level = self:GetParent():GetID() + 1; - local listFrame = _G["L_DropDownList"..level]; - if ( not listFrame or not listFrame:IsShown() or select(2, listFrame:GetPoint()) ~= self ) then - lib:ToggleDropDownMenu(self:GetParent():GetID() + 1, self.value, nil, nil, nil, nil, self.menuList, self); - end - else - lib:CloseDropDownMenus(self:GetParent():GetID() + 1); - end - self.Highlight:Show(); - if ( self.tooltipTitle and not self.noTooltipWhileEnabled ) then - if ( self.tooltipOnButton ) then - tooltip:SetOwner(self, "ANCHOR_RIGHT"); - GameTooltip_SetTitle(tooltip, self.tooltipTitle); - if self.tooltipText then - GameTooltip_AddNormalLine(tooltip, self.tooltipText, true); - end - tooltip:Show(); - end - end - - if ( self.mouseOverIcon ~= nil ) then - self.Icon:SetTexture(self.mouseOverIcon); - self.Icon:Show(); - end - if WoWRetail then - GetValueOrCallFunction(self, "funcOnEnter", self); - end - end - - local function button_OnLeave(self) - self.Highlight:Hide(); - tooltip:Hide(); - - if ( self.mouseOverIcon ~= nil ) then - if ( self.icon ~= nil ) then - self.Icon:SetTexture(self.icon); - else - self.Icon:Hide(); - end - end - - if WoWRetail then - GetValueOrCallFunction(self, "funcOnLeave", self); - end - end - - local function button_OnClick(self) - local checked = self.checked; - if ( type (checked) == "function" ) then - checked = checked(self); - end - - if ( self.keepShownOnClick ) then - if not self.notCheckable then - if ( checked ) then - _G[self:GetName().."Check"]:Hide(); - _G[self:GetName().."UnCheck"]:Show(); - checked = false; - else - _G[self:GetName().."Check"]:Show(); - _G[self:GetName().."UnCheck"]:Hide(); - checked = true; - end - end - else - self:GetParent():Hide(); - end - - if ( type (self.checked) ~= "function" ) then - self.checked = checked; - end - - -- saving this here because func might use a dropdown, changing this self's attributes - local playSound = true; - if ( self.noClickSound ) then - playSound = false; - end - - local func = self.func; - if ( func ) then - func(self, self.arg1, self.arg2, checked); - else - return; - end - - if ( playSound ) then - PlaySound(SOUNDKIT.U_CHAT_SCROLL_BUTTON); - end - end - - f:SetScript("OnClick", function(self, button, down) - button_OnClick(self, button, down) - end) - f:SetScript("OnEnter", function(self, motion) - button_OnEnter(self) - end) - f:SetScript("OnLeave", function(self, motion) - button_OnLeave(self) - end) - f:SetScript("OnEnable", function(self) - self.invisibleButton:Hide() - end) - f:SetScript("OnDisable", function(self) - self.invisibleButton:Show() - end) - - local text1 = f:CreateFontString(name.."NormalText") - f:SetFontString(text1) - text1:SetPoint("LEFT", f, -5, 0) - f:SetNormalFontObject("GameFontHighlightSmallLeft") - f:SetHighlightFontObject("GameFontHighlightSmallLeft") - f:SetDisabledFontObject("GameFontDisableSmallLeft") - - return f -end - --- ////////////////////////////////////////////////////////////// --- L_UIDropDownListTemplate -local BACKDROP_DIALOG_DARK = { - bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background-Dark", - edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border", - tile = true, - tileSize = 32, - edgeSize = 32, - insets = { left = 11, right = 12, top = 12, bottom = 9, }, -} -local back_drop_info = - { - bgFile="Interface\\Tooltips\\UI-Tooltip-Background", - edgeFile="Interface\\Tooltips\\UI-Tooltip-Border", - tile = true, - tileEdge = true, - insets = { left = 1, right = 1, top = 1, bottom = 1 }, - tileSize = 8, - edgeSize = 8, - } - -local function creatre_DropDownList(name, parent) - local f = _G[name] or CreateFrame("Button", name) - f:SetParent(parent or nil) - f:Hide() - f:SetFrameStrata("DIALOG") - f:EnableMouse(true) - - --local fbd = _G[name.."Border"] or CreateFrame("Frame", name.."Border", f, BackdropTemplateMixin and "DialogBorderDarkTemplate" or nil) - local fbd = _G[name.."Border"] or CreateFrame("Frame", name.."Border", f, BackdropTemplateMixin and "BackdropTemplate" or nil) - fbd:SetAllPoints() - fbd:SetBackdrop(BACKDROP_DIALOG_DARK) - f.Border = fbd - - --local fmb = _G[name.."MenuBackdrop"] or CreateFrame("Frame", name.."MenuBackdrop", f, BackdropTemplateMixin and "TooltipBackdropTemplate" or nil) - local fmb = _G[name.."MenuBackdrop"] or CreateFrame("Frame", name.."MenuBackdrop", f, BackdropTemplateMixin and "BackdropTemplate" or nil) - fmb:SetAllPoints() - fmb:SetBackdrop(back_drop_info) - fmb:SetBackdropBorderColor(TOOLTIP_DEFAULT_COLOR.r, TOOLTIP_DEFAULT_COLOR.g, TOOLTIP_DEFAULT_COLOR.b) - fmb:SetBackdropColor(TOOLTIP_DEFAULT_BACKGROUND_COLOR.r, TOOLTIP_DEFAULT_BACKGROUND_COLOR.g, TOOLTIP_DEFAULT_BACKGROUND_COLOR.b) - f.MenuBackdrop = fmb - - f.Button1 = _G[name.."Button1"] or create_MenuButton(name.."Button1", f) - f.Button1:SetID(1) - - f:SetScript("OnClick", function(self) - self:Hide() - end) - -- If dropdown is visible then see if its timer has expired, if so hide the frame - f:SetScript("OnUpdate", function(self, elapsed) - if ( self.shouldRefresh ) then - lib:UIDropDownMenu_RefreshDropDownSize(self); - self.shouldRefresh = false; - end - end) - f:SetScript("OnShow", function(self) - if ( self.onShow ) then - self.onShow(); - self.onShow = nil; - end - - for i=1, L_UIDROPDOWNMENU_MAXBUTTONS do - if (not self.noResize) then - _G[self:GetName().."Button"..i]:SetWidth(self.maxWidth); - end - end - - if (not self.noResize) then - self:SetWidth(self.maxWidth+25); - end - - if ( self:GetID() > 1 ) then - self.parent = _G["L_DropDownList"..(self:GetID() - 1)]; - end - end) - f:SetScript("OnHide", function(self) - local id = self:GetID() - if ( self.onHide ) then - self.onHide(id+1); - self.onHide = nil; - end - lib:CloseDropDownMenus(id+1); - L_OPEN_DROPDOWNMENUS[id] = nil; - if (id == 1) then - L_UIDROPDOWNMENU_OPEN_MENU = nil; - end - - if self.customFrames then - for index, frame in ipairs(self.customFrames) do - frame:Hide(); - end - - self.customFrames = nil; - end - end) - - return f -end - --- ////////////////////////////////////////////////////////////// --- L_UIDropDownMenuTemplate -local function create_DropDownMenu(name, parent) - local f - if type(name) == "table" then - f = name - name = f:GetName() - else - f = CreateFrame("Frame", name, parent or nil) - end - f:SetSize(40, 32) - - f.Left = f:CreateTexture(name.."Left", "ARTWORK") - f.Left:SetTexture("Interface\\Glues\\CharacterCreate\\CharacterCreate-LabelFrame") - f.Left:SetSize(25, 64) - f.Left:SetPoint("TOPLEFT", f, 0, 17) - f.Left:SetTexCoord(0, 0.1953125, 0, 1) - - f.Middle = f:CreateTexture(name.."Middle", "ARTWORK") - f.Middle:SetTexture("Interface\\Glues\\CharacterCreate\\CharacterCreate-LabelFrame") - f.Middle:SetSize(115, 64) - f.Middle:SetPoint("LEFT", f.Left, "RIGHT") - f.Middle:SetTexCoord(0.1953125, 0.8046875, 0, 1) - - f.Right = f:CreateTexture(name.."Right", "ARTWORK") - f.Right:SetTexture("Interface\\Glues\\CharacterCreate\\CharacterCreate-LabelFrame") - f.Right:SetSize(25, 64) - f.Right:SetPoint("LEFT", f.Middle, "RIGHT") - f.Right:SetTexCoord(0.8046875, 1, 0, 1) - - f.Text = f:CreateFontString(name.."Text", "ARTWORK", "GameFontHighlightSmall") - f.Text:SetWordWrap(false) - f.Text:SetJustifyH("RIGHT") - f.Text:SetSize(0, 10) - f.Text:SetPoint("RIGHT", f.Right, -43, 2) - - f.Icon = f:CreateTexture(name.."Icon", "OVERLAY") - f.Icon:Hide() - f.Icon:SetSize(16, 16) - f.Icon:SetPoint("LEFT", 30, 2) - - f.Button = CreateFrame("Button", name.."Button", f) - f.Button:SetMotionScriptsWhileDisabled(true) - f.Button:SetSize(24, 24) - f.Button:SetPoint("TOPRIGHT", f.Right, -16, -18) - - f.Button.NormalTexture = f.Button:CreateTexture(name.."NormalTexture") - f.Button.NormalTexture:SetTexture("Interface\\ChatFrame\\UI-ChatIcon-ScrollDown-Up") - f.Button.NormalTexture:SetSize(24, 24) - f.Button.NormalTexture:SetPoint("RIGHT", f.Button, 0, 0) - f.Button:SetNormalTexture(f.Button.NormalTexture) - - f.Button.PushedTexture = f.Button:CreateTexture(name.."PushedTexture") - f.Button.PushedTexture:SetTexture("Interface\\ChatFrame\\UI-ChatIcon-ScrollDown-Down") - f.Button.PushedTexture:SetSize(24, 24) - f.Button.PushedTexture:SetPoint("RIGHT", f.Button, 0, 0) - f.Button:SetPushedTexture(f.Button.PushedTexture) - - f.Button.DisabledTexture = f.Button:CreateTexture(name.."DisabledTexture") - f.Button.DisabledTexture:SetTexture("Interface\\ChatFrame\\UI-ChatIcon-ScrollDown-Disabled") - f.Button.DisabledTexture:SetSize(24, 24) - f.Button.DisabledTexture:SetPoint("RIGHT", f.Button, 0, 0) - f.Button:SetDisabledTexture(f.Button.DisabledTexture) - - f.Button.HighlightTexture = f.Button:CreateTexture(name.."HighlightTexture") - f.Button.HighlightTexture:SetTexture("Interface\\Buttons\\UI-Common-MouseHilight") - f.Button.HighlightTexture:SetSize(24, 24) - f.Button.HighlightTexture:SetPoint("RIGHT", f.Button, 0, 0) - f.Button.HighlightTexture:SetBlendMode("ADD") - f.Button:SetHighlightTexture(f.Button.HighlightTexture) - - -- Button Script - f.Button:SetScript("OnEnter", function(self, motion) - local parent = self:GetParent() - local myscript = parent:GetScript("OnEnter") - if(myscript ~= nil) then - myscript(parent) - end - end) - f.Button:SetScript("OnLeave", function(self, motion) - local parent = self:GetParent() - local myscript = parent:GetScript("OnLeave") - if(myscript ~= nil) then - myscript(parent) - end - end) - f.Button:SetScript("OnMouseDown", function(self, button) - if self:IsEnabled() then - local parent = self:GetParent() - lib:ToggleDropDownMenu(nil, nil, parent) - PlaySound(SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON) - end - end) - - -- UIDropDownMenu Script - f:SetScript("OnHide", function(self) - lib:CloseDropDownMenus() - end) - - return f -end --- End of frame templates --- ////////////////////////////////////////////////////////////// - --- ////////////////////////////////////////////////////////////// --- Handling two frames from LibUIDropDownMenu.xml -local function create_DropDownButtons() - L_DropDownList1 = creatre_DropDownList("L_DropDownList1") - L_DropDownList1:SetToplevel(true) - L_DropDownList1:SetFrameStrata("FULLSCREEN_DIALOG") - L_DropDownList1:Hide() - L_DropDownList1:SetID(1) - L_DropDownList1:SetSize(180, 10) - local _, fontHeight, _ = _G["L_DropDownList1Button1NormalText"]:GetFont() - L_UIDROPDOWNMENU_DEFAULT_TEXT_HEIGHT = fontHeight - - L_DropDownList2 = creatre_DropDownList("L_DropDownList2") - L_DropDownList2:SetToplevel(true) - L_DropDownList2:SetFrameStrata("FULLSCREEN_DIALOG") - L_DropDownList2:Hide() - L_DropDownList2:SetID(2) - L_DropDownList2:SetSize(180, 10) - - -- UIParent integration; since we customize the name of DropDownList, we need to add it to golbal UIMenus table. - tinsert(UIMenus, "L_DropDownList1"); - tinsert(UIMenus, "L_DropDownList2"); -end - -do - if lib then - create_DropDownButtons() - end -end - --- ////////////////////////////////////////////////////////////// --- Global function to replace L_UIDropDownMenuTemplate -function lib:Create_UIDropDownMenu(name, parent) - return create_DropDownMenu(name, parent) -end - -local function GetChild(frame, name, key) - if (frame[key]) then - return frame[key]; - elseif name then - return _G[name..key]; - end - - return nil; -end - -function lib:UIDropDownMenu_Initialize(frame, initFunction, displayMode, level, menuList) - frame.menuList = menuList; - - --securecall("initializeHelper", frame); - lib:UIDropDownMenu_InitializeHelper(frame) - - -- Set the initialize function and call it. The initFunction populates the dropdown list. - if ( initFunction ) then - lib:UIDropDownMenu_SetInitializeFunction(frame, initFunction); - initFunction(frame, level, frame.menuList); - end - - --master frame - if(level == nil) then - level = 1; - end - - local dropDownList = _G["L_DropDownList"..level]; - dropDownList.dropdown = frame; - dropDownList.shouldRefresh = true; - - lib:UIDropDownMenu_SetDisplayMode(frame, displayMode); -end - -function lib:UIDropDownMenu_SetInitializeFunction(frame, initFunction) - frame.initialize = initFunction; -end - -function lib:UIDropDownMenu_SetDisplayMode(frame, displayMode) - -- Change appearance based on the displayMode - -- Note: this is a one time change based on previous behavior. - if ( displayMode == "MENU" ) then - local name = frame:GetName(); - GetChild(frame, name, "Left"):Hide(); - GetChild(frame, name, "Middle"):Hide(); - GetChild(frame, name, "Right"):Hide(); - local button = GetChild(frame, name, "Button"); - local buttonName = button:GetName(); - GetChild(button, buttonName, "NormalTexture"):SetTexture(nil); - GetChild(button, buttonName, "DisabledTexture"):SetTexture(nil); - GetChild(button, buttonName, "PushedTexture"):SetTexture(nil); - GetChild(button, buttonName, "HighlightTexture"):SetTexture(nil); - local text = GetChild(frame, name, "Text"); - - button:ClearAllPoints(); - button:SetPoint("LEFT", text, "LEFT", -9, 0); - button:SetPoint("RIGHT", text, "RIGHT", 6, 0); - frame.displayMode = "MENU"; - end -end - -function lib:UIDropDownMenu_RefreshDropDownSize(self) - self.maxWidth = lib:UIDropDownMenu_GetMaxButtonWidth(self); - self:SetWidth(self.maxWidth + 25); - - for i=1, L_UIDROPDOWNMENU_MAXBUTTONS, 1 do - local icon = _G[self:GetName().."Button"..i.."Icon"]; - - if ( icon.tFitDropDownSizeX ) then - icon:SetWidth(self.maxWidth - 5); - end - end -end - ---[[ -List of button attributes -====================================================== -info.text = [STRING] -- The text of the button -info.value = [ANYTHING] -- The value that L_UIDROPDOWNMENU_MENU_VALUE is set to when the button is clicked -info.func = [function()] -- The function that is called when you click the button -info.checked = [nil, true, function] -- Check the button if true or function returns true -info.isNotRadio = [nil, true] -- Check the button uses radial image if false check box image if true -info.isTitle = [nil, true] -- If it's a title the button is disabled and the font color is set to yellow -info.disabled = [nil, true] -- Disable the button and show an invisible button that still traps the mouseover event so menu doesn't time out -info.tooltipWhileDisabled = [nil, 1] -- Show the tooltip, even when the button is disabled. -info.hasArrow = [nil, true] -- Show the expand arrow for multilevel menus -info.hasColorSwatch = [nil, true] -- Show color swatch or not, for color selection -info.r = [1 - 255] -- Red color value of the color swatch -info.g = [1 - 255] -- Green color value of the color swatch -info.b = [1 - 255] -- Blue color value of the color swatch -info.colorCode = [STRING] -- "|cAARRGGBB" embedded hex value of the button text color. Only used when button is enabled -info.swatchFunc = [function()] -- Function called by the color picker on color change -info.hasOpacity = [nil, 1] -- Show the opacity slider on the colorpicker frame -info.opacity = [0.0 - 1.0] -- Percentatge of the opacity, 1.0 is fully shown, 0 is transparent -info.opacityFunc = [function()] -- Function called by the opacity slider when you change its value -info.cancelFunc = [function(previousValues)] -- Function called by the colorpicker when you click the cancel button (it takes the previous values as its argument) -info.notClickable = [nil, 1] -- Disable the button and color the font white -info.notCheckable = [nil, 1] -- Shrink the size of the buttons and don't display a check box -info.owner = [Frame] -- Dropdown frame that "owns" the current dropdownlist -info.keepShownOnClick = [nil, 1] -- Don't hide the dropdownlist after a button is clicked -info.tooltipTitle = [nil, STRING] -- Title of the tooltip shown on mouseover -info.tooltipText = [nil, STRING] -- Text of the tooltip shown on mouseover -info.tooltipOnButton = [nil, 1] -- Show the tooltip attached to the button instead of as a Newbie tooltip. -info.justifyH = [nil, "CENTER"] -- Justify button text -info.arg1 = [ANYTHING] -- This is the first argument used by info.func -info.arg2 = [ANYTHING] -- This is the second argument used by info.func -info.fontObject = [FONT] -- font object replacement for Normal and Highlight -info.menuTable = [TABLE] -- This contains an array of info tables to be displayed as a child menu -info.noClickSound = [nil, 1] -- Set to 1 to suppress the sound when clicking the button. The sound only plays if .func is set. -info.padding = [nil, NUMBER] -- Number of pixels to pad the text on the right side -info.leftPadding = [nil, NUMBER] -- Number of pixels to pad the button on the left side -info.minWidth = [nil, NUMBER] -- Minimum width for this line -info.customFrame = frame -- Allows this button to be a completely custom frame, should inherit from UIDropDownCustomMenuEntryTemplate and override appropriate methods. -info.icon = [TEXTURE] -- An icon for the button. -info.mouseOverIcon = [TEXTURE] -- An override icon when a button is moused over. -info.ignoreAsMenuSelection [nil, true] -- Never set the menu text/icon to this, even when this button is checked -]] - --- Create (return) empty table -function lib:UIDropDownMenu_CreateInfo() - return {}; -end - -function lib:UIDropDownMenu_CreateFrames(level, index) - while ( level > L_UIDROPDOWNMENU_MAXLEVELS ) do - L_UIDROPDOWNMENU_MAXLEVELS = L_UIDROPDOWNMENU_MAXLEVELS + 1; - --local newList = CreateFrame("Button", "L_DropDownList"..L_UIDROPDOWNMENU_MAXLEVELS, nil, "L_UIDropDownListTemplate"); - local newList = creatre_DropDownList("L_DropDownList"..L_UIDROPDOWNMENU_MAXLEVELS) - newList:SetFrameStrata("FULLSCREEN_DIALOG"); - newList:SetToplevel(true); - newList:Hide(); - newList:SetID(L_UIDROPDOWNMENU_MAXLEVELS); - newList:SetWidth(180) - newList:SetHeight(10) - for i=1, L_UIDROPDOWNMENU_MAXBUTTONS do - --local newButton = CreateFrame("Button", "L_DropDownList"..L_UIDROPDOWNMENU_MAXLEVELS.."Button"..i, newList, "L_UIDropDownMenuButtonTemplate"); - local newButton = create_MenuButton("L_DropDownList"..L_UIDROPDOWNMENU_MAXLEVELS.."Button"..i, newList) - newButton:SetID(i); - end - end - - while ( index > L_UIDROPDOWNMENU_MAXBUTTONS ) do - L_UIDROPDOWNMENU_MAXBUTTONS = L_UIDROPDOWNMENU_MAXBUTTONS + 1; - for i=1, L_UIDROPDOWNMENU_MAXLEVELS do - --local newButton = CreateFrame("Button", "L_DropDownList"..i.."Button"..L_UIDROPDOWNMENU_MAXBUTTONS, _G["L_DropDownList"..i], "L_UIDropDownMenuButtonTemplate"); - local newButton = create_MenuButton("L_DropDownList"..i.."Button"..L_UIDROPDOWNMENU_MAXBUTTONS, _G["L_DropDownList"..i]) - newButton:SetID(L_UIDROPDOWNMENU_MAXBUTTONS); - end - end -end - -function lib:UIDropDownMenu_AddSeparator(level) - local separatorInfo = { - hasArrow = false; - dist = 0; - isTitle = true; - isUninteractable = true; - notCheckable = true; - iconOnly = true; - icon = "Interface\\Common\\UI-TooltipDivider-Transparent"; - tCoordLeft = 0; - tCoordRight = 1; - tCoordTop = 0; - tCoordBottom = 1; - tSizeX = 0; - tSizeY = 8; - tFitDropDownSizeX = true; - iconInfo = { - tCoordLeft = 0, - tCoordRight = 1, - tCoordTop = 0, - tCoordBottom = 1, - tSizeX = 0, - tSizeY = 8, - tFitDropDownSizeX = true - }, - }; - - lib:UIDropDownMenu_AddButton(separatorInfo, level); -end - -function lib:UIDropDownMenu_AddSpace(level) - local spaceInfo = { - hasArrow = false, - dist = 0, - isTitle = true, - isUninteractable = true, - notCheckable = true, - }; - - lib:UIDropDownMenu_AddButton(spaceInfo, level); -end - -function lib:UIDropDownMenu_AddButton(info, level) - --[[ - Might to uncomment this if there are performance issues - if ( not L_UIDROPDOWNMENU_OPEN_MENU ) then - return; - end - ]] - if ( not level ) then - level = 1; - end - - local listFrame = _G["L_DropDownList"..level]; - local index; - if (listFrame) then - index = listFrame.numButtons and (listFrame.numButtons + 1) or 1 - else - index = 0 - end - --local index = listFrame and (listFrame.numButtons + 1) or 1; - local width; - - delegateFrame:SetAttribute("createframes-level", level); - delegateFrame:SetAttribute("createframes-index", index); - delegateFrame:SetAttribute("createframes", true); - - listFrame = listFrame or _G["L_DropDownList"..level]; - local listFrameName = listFrame:GetName(); - - -- Set the number of buttons in the listframe - listFrame.numButtons = index; - - local button = _G[listFrameName.."Button"..index]; - local normalText = _G[button:GetName().."NormalText"]; - local icon = _G[button:GetName().."Icon"]; - -- This button is used to capture the mouse OnEnter/OnLeave events if the dropdown button is disabled, since a disabled button doesn't receive any events - -- This is used specifically for drop down menu time outs - local invisibleButton = _G[button:GetName().."InvisibleButton"]; - - -- Default settings - button:SetDisabledFontObject(GameFontDisableSmallLeft); - invisibleButton:Hide(); - button:Enable(); - - -- If not clickable then disable the button and set it white - if ( info.notClickable ) then - info.disabled = true; - button:SetDisabledFontObject(GameFontHighlightSmallLeft); - end - - -- Set the text color and disable it if its a title - if ( info.isTitle ) then - info.disabled = true; - button:SetDisabledFontObject(GameFontNormalSmallLeft); - end - - -- Disable the button if disabled and turn off the color code - if ( info.disabled ) then - button:Disable(); - invisibleButton:Show(); - info.colorCode = nil; - end - - -- If there is a color for a disabled line, set it - if( info.disablecolor ) then - info.colorCode = info.disablecolor; - end - - -- Configure button - if ( info.text ) then - -- look for inline color code this is only if the button is enabled - if ( info.colorCode ) then - button:SetText(info.colorCode..info.text.."|r"); - else - button:SetText(info.text); - end - - -- Set icon - if ( info.icon or info.mouseOverIcon ) then - icon:SetSize(16,16); - icon:SetTexture(info.icon); - icon:ClearAllPoints(); - icon:SetPoint("RIGHT"); - - if ( info.tCoordLeft ) then - icon:SetTexCoord(info.tCoordLeft, info.tCoordRight, info.tCoordTop, info.tCoordBottom); - else - icon:SetTexCoord(0, 1, 0, 1); - end - icon:Show(); - else - icon:Hide(); - end - - -- Check to see if there is a replacement font - if ( info.fontObject ) then - button:SetNormalFontObject(info.fontObject); - button:SetHighlightFontObject(info.fontObject); - else - button:SetNormalFontObject(GameFontHighlightSmallLeft); - button:SetHighlightFontObject(GameFontHighlightSmallLeft); - end - else - button:SetText(""); - icon:Hide(); - end - - button.iconOnly = nil; - button.icon = nil; - button.iconInfo = nil; - - if (info.iconInfo) then - icon.tFitDropDownSizeX = info.iconInfo.tFitDropDownSizeX; - else - icon.tFitDropDownSizeX = nil; - end - if (info.iconOnly and info.icon) then - button.iconOnly = true; - button.icon = info.icon; - button.iconInfo = info.iconInfo; - - lib:UIDropDownMenu_SetIconImage(icon, info.icon, info.iconInfo); - icon:ClearAllPoints(); - icon:SetPoint("LEFT"); - end - - -- Pass through attributes - button.func = info.func; - button.funcOnEnter = info.funcOnEnter; - button.funcOnLeave = info.funcOnLeave; - button.owner = info.owner; - button.hasOpacity = info.hasOpacity; - button.opacity = info.opacity; - button.opacityFunc = info.opacityFunc; - button.cancelFunc = info.cancelFunc; - button.swatchFunc = info.swatchFunc; - button.keepShownOnClick = info.keepShownOnClick; - button.tooltipTitle = info.tooltipTitle; - button.tooltipText = info.tooltipText; - button.tooltipInstruction = info.tooltipInstruction; - button.tooltipWarning = info.tooltipWarning; - button.arg1 = info.arg1; - button.arg2 = info.arg2; - button.hasArrow = info.hasArrow; - button.hasColorSwatch = info.hasColorSwatch; - button.notCheckable = info.notCheckable; - button.menuList = info.menuList; - button.tooltipWhileDisabled = info.tooltipWhileDisabled; - button.noTooltipWhileEnabled = info.noTooltipWhileEnabled; - button.tooltipOnButton = info.tooltipOnButton; - button.noClickSound = info.noClickSound; - button.padding = info.padding; - button.icon = info.icon; - button.mouseOverIcon = info.mouseOverIcon; - button.ignoreAsMenuSelection = info.ignoreAsMenuSelection; - - if ( info.value ) then - button.value = info.value; - elseif ( info.text ) then - button.value = info.text; - else - button.value = nil; - end - - local expandArrow = _G[listFrameName.."Button"..index.."ExpandArrow"]; - expandArrow:SetShown(info.hasArrow); - expandArrow:SetEnabled(not info.disabled); - - -- If not checkable move everything over to the left to fill in the gap where the check would be - local xPos = 5; - local yPos = -((button:GetID() - 1) * L_UIDROPDOWNMENU_BUTTON_HEIGHT) - L_UIDROPDOWNMENU_BORDER_HEIGHT; - local displayInfo = normalText; - if (info.iconOnly) then - displayInfo = icon; - end - - displayInfo:ClearAllPoints(); - if ( info.notCheckable ) then - if ( info.justifyH and info.justifyH == "CENTER" ) then - displayInfo:SetPoint("CENTER", button, "CENTER", -7, 0); - else - displayInfo:SetPoint("LEFT", button, "LEFT", 0, 0); - end - xPos = xPos + 10; - - else - xPos = xPos + 12; - displayInfo:SetPoint("LEFT", button, "LEFT", 20, 0); - end - - -- Adjust offset if displayMode is menu - local frame = L_UIDROPDOWNMENU_OPEN_MENU; - if ( frame and frame.displayMode == "MENU" ) then - if ( not info.notCheckable ) then - xPos = xPos - 6; - end - end - - -- If no open frame then set the frame to the currently initialized frame - frame = frame or L_UIDROPDOWNMENU_INIT_MENU; - - if ( info.leftPadding ) then - xPos = xPos + info.leftPadding; - end - button:SetPoint("TOPLEFT", button:GetParent(), "TOPLEFT", xPos, yPos); - - -- See if button is selected by id or name - if ( frame ) then - if ( lib:UIDropDownMenu_GetSelectedName(frame) ) then - if ( button:GetText() == lib:UIDropDownMenu_GetSelectedName(frame) ) then - info.checked = 1; - end - elseif ( lib:UIDropDownMenu_GetSelectedID(frame) ) then - if ( button:GetID() == lib:UIDropDownMenu_GetSelectedID(frame) ) then - info.checked = 1; - end - elseif ( lib:UIDropDownMenu_GetSelectedValue(frame) ) then - if ( button.value == lib:UIDropDownMenu_GetSelectedValue(frame) ) then - info.checked = 1; - end - end - end - - if not info.notCheckable then - local check = _G[listFrameName.."Button"..index.."Check"]; - local uncheck = _G[listFrameName.."Button"..index.."UnCheck"]; - if ( info.disabled ) then - check:SetDesaturated(true); - check:SetAlpha(0.5); - uncheck:SetDesaturated(true); - uncheck:SetAlpha(0.5); - else - check:SetDesaturated(false); - check:SetAlpha(1); - uncheck:SetDesaturated(false); - uncheck:SetAlpha(1); - end - - if info.customCheckIconAtlas or info.customCheckIconTexture then - check:SetTexCoord(0, 1, 0, 1); - uncheck:SetTexCoord(0, 1, 0, 1); - - if info.customCheckIconAtlas then - check:SetAtlas(info.customCheckIconAtlas); - uncheck:SetAtlas(info.customUncheckIconAtlas or info.customCheckIconAtlas); - else - check:SetTexture(info.customCheckIconTexture); - uncheck:SetTexture(info.customUncheckIconTexture or info.customCheckIconTexture); - end - elseif info.isNotRadio then - check:SetTexCoord(0.0, 0.5, 0.0, 0.5); - check:SetTexture("Interface\\Common\\UI-DropDownRadioChecks"); - uncheck:SetTexCoord(0.5, 1.0, 0.0, 0.5); - uncheck:SetTexture("Interface\\Common\\UI-DropDownRadioChecks"); - else - check:SetTexCoord(0.0, 0.5, 0.5, 1.0); - check:SetTexture("Interface\\Common\\UI-DropDownRadioChecks"); - uncheck:SetTexCoord(0.5, 1.0, 0.5, 1.0); - uncheck:SetTexture("Interface\\Common\\UI-DropDownRadioChecks"); - end - - -- Checked can be a function now - local checked = info.checked; - if ( type(checked) == "function" ) then - checked = checked(button); - end - - -- Show the check if checked - if ( checked ) then - button:LockHighlight(); - check:Show(); - uncheck:Hide(); - else - button:UnlockHighlight(); - check:Hide(); - uncheck:Show(); - end - else - _G[listFrameName.."Button"..index.."Check"]:Hide(); - _G[listFrameName.."Button"..index.."UnCheck"]:Hide(); - end - button.checked = info.checked; - - -- If has a colorswatch, show it and vertex color it - local colorSwatch = _G[listFrameName.."Button"..index.."ColorSwatch"]; - if ( info.hasColorSwatch ) then - if WoWClassic then - _G["L_DropDownList"..level.."Button"..index.."ColorSwatch".."NormalTexture"]:SetVertexColor(info.r, info.g, info.b); - else - _G["L_DropDownList"..level.."Button"..index.."ColorSwatch"].Color:SetVertexColor(info.r, info.g, info.b); - end - button.r = info.r; - button.g = info.g; - button.b = info.b; - colorSwatch:Show(); - else - colorSwatch:Hide(); - end - - lib:UIDropDownMenu_CheckAddCustomFrame(listFrame, button, info); - - button:SetShown(button.customFrame == nil); - - button.minWidth = info.minWidth; - - width = max(lib:UIDropDownMenu_GetButtonWidth(button), info.minWidth or 0); - --Set maximum button width - if ( width > (listFrame and listFrame.maxWidth or 0) ) then - listFrame.maxWidth = width; - end - - -- Set the height of the listframe - listFrame:SetHeight((index * L_UIDROPDOWNMENU_BUTTON_HEIGHT) + (L_UIDROPDOWNMENU_BORDER_HEIGHT * 2)); -end - -function lib:UIDropDownMenu_CheckAddCustomFrame(self, button, info) - local customFrame = info.customFrame; - button.customFrame = customFrame; - if customFrame then - customFrame:SetOwningButton(button); - customFrame:ClearAllPoints(); - customFrame:SetPoint("TOPLEFT", button, "TOPLEFT", 0, 0); - customFrame:Show(); - - lib:UIDropDownMenu_RegisterCustomFrame(self, customFrame); - end -end - -function lib:UIDropDownMenu_RegisterCustomFrame(self, customFrame) - self.customFrames = self.customFrames or {} - table.insert(self.customFrames, customFrame); -end - -function lib:UIDropDownMenu_GetMaxButtonWidth(self) - local maxWidth = 0; - for i=1, self.numButtons do - local button = _G[self:GetName().."Button"..i]; - local width = lib:UIDropDownMenu_GetButtonWidth(button); - if ( width > maxWidth ) then - maxWidth = width; - end - end - return maxWidth; -end - -function lib:UIDropDownMenu_GetButtonWidth(button) - local minWidth = button.minWidth or 0; - if button.customFrame and button.customFrame:IsShown() then - return math.max(minWidth, button.customFrame:GetPreferredEntryWidth()); - end - - if not button:IsShown() then - return 0; - end - - local width; - local buttonName = button:GetName(); - local icon = _G[buttonName.."Icon"]; - local normalText = _G[buttonName.."NormalText"]; - - if ( button.iconOnly and icon ) then - width = icon:GetWidth(); - elseif ( normalText and normalText:GetText() ) then - width = normalText:GetWidth() + 40; - - if ( button.icon ) then - -- Add padding for the icon - width = width + 10; - end - else - return minWidth; - end - - -- Add padding if has and expand arrow or color swatch - if ( button.hasArrow or button.hasColorSwatch ) then - width = width + 10; - end - if ( button.notCheckable ) then - width = width - 30; - end - if ( button.padding ) then - width = width + button.padding; - end - - return math.max(minWidth, width); -end - -function lib:UIDropDownMenu_Refresh(frame, useValue, dropdownLevel) - local maxWidth = 0; - local somethingChecked = nil; - if ( not dropdownLevel ) then - dropdownLevel = L_UIDROPDOWNMENU_MENU_LEVEL; - end - - local listFrame = _G["L_DropDownList"..dropdownLevel]; - listFrame.numButtons = listFrame.numButtons or 0; - -- Just redraws the existing menu - for i=1, L_UIDROPDOWNMENU_MAXBUTTONS do - local button = _G["L_DropDownList"..dropdownLevel.."Button"..i]; - local checked = nil; - - if(i <= listFrame.numButtons) then - -- See if checked or not - if ( lib:UIDropDownMenu_GetSelectedName(frame) ) then - if ( button:GetText() == lib:UIDropDownMenu_GetSelectedName(frame) ) then - checked = 1; - end - elseif ( lib:UIDropDownMenu_GetSelectedID(frame) ) then - if ( button:GetID() == lib:UIDropDownMenu_GetSelectedID(frame) ) then - checked = 1; - end - elseif ( lib:UIDropDownMenu_GetSelectedValue(frame) ) then - if ( button.value == lib:UIDropDownMenu_GetSelectedValue(frame) ) then - checked = 1; - end - end - end - if (button.checked and type(button.checked) == "function") then - checked = button.checked(button); - end - - if not button.notCheckable and button:IsShown() then - -- If checked show check image - local checkImage = _G["L_DropDownList"..dropdownLevel.."Button"..i.."Check"]; - local uncheckImage = _G["L_DropDownList"..dropdownLevel.."Button"..i.."UnCheck"]; - if ( checked ) then - if not button.ignoreAsMenuSelection then - somethingChecked = true; - local icon = GetChild(frame, frame:GetName(), "Icon"); - if (button.iconOnly and icon and button.icon) then - lib:UIDropDownMenu_SetIconImage(icon, button.icon, button.iconInfo); - elseif ( useValue ) then - lib:UIDropDownMenu_SetText(frame, button.value); - icon:Hide(); - else - lib:UIDropDownMenu_SetText(frame, button:GetText()); - icon:Hide(); - end - end - button:LockHighlight(); - checkImage:Show(); - uncheckImage:Hide(); - else - button:UnlockHighlight(); - checkImage:Hide(); - uncheckImage:Show(); - end - end - - if ( button:IsShown() ) then - local width = lib:UIDropDownMenu_GetButtonWidth(button); - if ( width > maxWidth ) then - maxWidth = width; - end - end - end - if(somethingChecked == nil) then - lib:UIDropDownMenu_SetText(frame, VIDEO_QUALITY_LABEL6); - local icon = GetChild(frame, frame:GetName(), "Icon"); - icon:Hide(); - end - if (not frame.noResize) then - for i=1, L_UIDROPDOWNMENU_MAXBUTTONS do - local button = _G["L_DropDownList"..dropdownLevel.."Button"..i]; - button:SetWidth(maxWidth); - end - lib:UIDropDownMenu_RefreshDropDownSize(_G["L_DropDownList"..dropdownLevel]); - end -end - -function lib:UIDropDownMenu_RefreshAll(frame, useValue) - for dropdownLevel = L_UIDROPDOWNMENU_MENU_LEVEL, 2, -1 do - local listFrame = _G["L_DropDownList"..dropdownLevel]; - if ( listFrame:IsShown() ) then - lib:UIDropDownMenu_Refresh(frame, nil, dropdownLevel); - end - end - -- useValue is the text on the dropdown, only needs to be set once - lib:UIDropDownMenu_Refresh(frame, useValue, 1); -end - -function lib:UIDropDownMenu_SetIconImage(icon, texture, info) - icon:SetTexture(texture); - if ( info.tCoordLeft ) then - icon:SetTexCoord(info.tCoordLeft, info.tCoordRight, info.tCoordTop, info.tCoordBottom); - else - icon:SetTexCoord(0, 1, 0, 1); - end - if ( info.tSizeX ) then - icon:SetWidth(info.tSizeX); - else - icon:SetWidth(16); - end - if ( info.tSizeY ) then - icon:SetHeight(info.tSizeY); - else - icon:SetHeight(16); - end - icon:Show(); -end - -function lib:UIDropDownMenu_SetSelectedName(frame, name, useValue) - frame.selectedName = name; - frame.selectedID = nil; - frame.selectedValue = nil; - lib:UIDropDownMenu_Refresh(frame, useValue); -end - -function lib:UIDropDownMenu_SetSelectedValue(frame, value, useValue) - -- useValue will set the value as the text, not the name - frame.selectedName = nil; - frame.selectedID = nil; - frame.selectedValue = value; - lib:UIDropDownMenu_Refresh(frame, useValue); -end - -function lib:UIDropDownMenu_SetSelectedID(frame, id, useValue) - frame.selectedID = id; - frame.selectedName = nil; - frame.selectedValue = nil; - lib:UIDropDownMenu_Refresh(frame, useValue); -end - -function lib:UIDropDownMenu_GetSelectedName(frame) - return frame.selectedName; -end - -function lib:UIDropDownMenu_GetSelectedID(frame) - if ( frame.selectedID ) then - return frame.selectedID; - else - -- If no explicit selectedID then try to send the id of a selected value or name - local listFrame = _G["L_DropDownList"..L_UIDROPDOWNMENU_MENU_LEVEL]; - for i=1, listFrame.numButtons do - local button = _G["L_DropDownList"..L_UIDROPDOWNMENU_MENU_LEVEL.."Button"..i]; - -- See if checked or not - if ( lib:UIDropDownMenu_GetSelectedName(frame) ) then - if ( button:GetText() == lib:UIDropDownMenu_GetSelectedName(frame) ) then - return i; - end - elseif ( lib:UIDropDownMenu_GetSelectedValue(frame) ) then - if ( button.value == lib:UIDropDownMenu_GetSelectedValue(frame) ) then - return i; - end - end - end - end -end - -function lib:UIDropDownMenu_GetSelectedValue(frame) - return frame.selectedValue; -end - -function lib:HideDropDownMenu(level) - local listFrame = _G["L_DropDownList"..level]; - listFrame:Hide(); -end - -function lib:ToggleDropDownMenu(level, value, dropDownFrame, anchorName, xOffset, yOffset, menuList, button, autoHideDelay) - if ( not level ) then - level = 1; - end - delegateFrame:SetAttribute("createframes-level", level); - delegateFrame:SetAttribute("createframes-index", 0); - delegateFrame:SetAttribute("createframes", true); - L_UIDROPDOWNMENU_MENU_LEVEL = level; - L_UIDROPDOWNMENU_MENU_VALUE = value; - local listFrameName = "L_DropDownList"..level; - local listFrame = _G[listFrameName]; - local tempFrame; - local point, relativePoint, relativeTo; - if ( not dropDownFrame ) then - tempFrame = button:GetParent(); - else - tempFrame = dropDownFrame; - end - if ( listFrame:IsShown() and (L_UIDROPDOWNMENU_OPEN_MENU == tempFrame) ) then - listFrame:Hide(); - else - -- Set the dropdownframe scale - local uiScale; - local uiParentScale = UIParent:GetScale(); - if ( GetCVar("useUIScale") == "1" ) then - uiScale = tonumber(GetCVar("uiscale")); - if ( uiParentScale < uiScale ) then - uiScale = uiParentScale; - end - else - uiScale = uiParentScale; - end - listFrame:SetScale(uiScale); - - -- Hide the listframe anyways since it is redrawn OnShow() - listFrame:Hide(); - - -- Frame to anchor the dropdown menu to - local anchorFrame; - - -- Display stuff - -- Level specific stuff - if ( level == 1 ) then - delegateFrame:SetAttribute("openmenu", dropDownFrame); - listFrame:ClearAllPoints(); - -- If there's no specified anchorName then use left side of the dropdown menu - if ( not anchorName ) then - -- See if the anchor was set manually using setanchor - if ( dropDownFrame.xOffset ) then - xOffset = dropDownFrame.xOffset; - end - if ( dropDownFrame.yOffset ) then - yOffset = dropDownFrame.yOffset; - end - if ( dropDownFrame.point ) then - point = dropDownFrame.point; - end - if ( dropDownFrame.relativeTo ) then - relativeTo = dropDownFrame.relativeTo; - else - relativeTo = GetChild(L_UIDROPDOWNMENU_OPEN_MENU, L_UIDROPDOWNMENU_OPEN_MENU:GetName(), "Left"); - end - if ( dropDownFrame.relativePoint ) then - relativePoint = dropDownFrame.relativePoint; - end - elseif ( anchorName == "cursor" ) then - relativeTo = nil; - local cursorX, cursorY = GetCursorPosition(); - cursorX = cursorX/uiScale; - cursorY = cursorY/uiScale; - - if ( not xOffset ) then - xOffset = 0; - end - if ( not yOffset ) then - yOffset = 0; - end - xOffset = cursorX + xOffset; - yOffset = cursorY + yOffset; - else - -- See if the anchor was set manually using setanchor - if ( dropDownFrame.xOffset ) then - xOffset = dropDownFrame.xOffset; - end - if ( dropDownFrame.yOffset ) then - yOffset = dropDownFrame.yOffset; - end - if ( dropDownFrame.point ) then - point = dropDownFrame.point; - end - if ( dropDownFrame.relativeTo ) then - relativeTo = dropDownFrame.relativeTo; - else - relativeTo = anchorName; - end - if ( dropDownFrame.relativePoint ) then - relativePoint = dropDownFrame.relativePoint; - end - end - if ( not xOffset or not yOffset ) then - xOffset = 8; - yOffset = 22; - end - if ( not point ) then - point = "TOPLEFT"; - end - if ( not relativePoint ) then - relativePoint = "BOTTOMLEFT"; - end - listFrame:SetPoint(point, relativeTo, relativePoint, xOffset, yOffset); - else - if ( not dropDownFrame ) then - dropDownFrame = L_UIDROPDOWNMENU_OPEN_MENU; - end - listFrame:ClearAllPoints(); - -- If this is a dropdown button, not the arrow anchor it to itself - if ( strsub(button:GetParent():GetName(), 0,14) == "L_DropDownList" and strlen(button:GetParent():GetName()) == 15 ) then - anchorFrame = button; - else - anchorFrame = button:GetParent(); - end - point = "TOPLEFT"; - relativePoint = "TOPRIGHT"; - listFrame:SetPoint(point, anchorFrame, relativePoint, 0, 0); - end - - -- Change list box appearance depending on display mode - if ( dropDownFrame and dropDownFrame.displayMode == "MENU" ) then - _G[listFrameName.."Border"]:Hide(); - _G[listFrameName.."MenuBackdrop"]:Show(); - else - _G[listFrameName.."Border"]:Show(); - _G[listFrameName.."MenuBackdrop"]:Hide(); - end - dropDownFrame.menuList = menuList; - lib:UIDropDownMenu_Initialize(dropDownFrame, dropDownFrame.initialize, nil, level, menuList); - -- If no items in the drop down don't show it - if ( listFrame.numButtons == 0 ) then - return; - end - - listFrame.onShow = dropDownFrame.listFrameOnShow; - - -- Check to see if the dropdownlist is off the screen, if it is anchor it to the top of the dropdown button - listFrame:Show(); - -- Hack since GetCenter() is returning coords relative to 1024x768 - local x, y = listFrame:GetCenter(); - -- Hack will fix this in next revision of dropdowns - if ( not x or not y ) then - listFrame:Hide(); - return; - end - - listFrame.onHide = dropDownFrame.onHide; - - - -- We just move level 1 enough to keep it on the screen. We don't necessarily change the anchors. - if ( level == 1 ) then - local offLeft = listFrame:GetLeft()/uiScale; - local offRight = (GetScreenWidth() - listFrame:GetRight())/uiScale; - local offTop = (GetScreenHeight() - listFrame:GetTop())/uiScale; - local offBottom = listFrame:GetBottom()/uiScale; - - local xAddOffset, yAddOffset = 0, 0; - if ( offLeft < 0 ) then - xAddOffset = -offLeft; - elseif ( offRight < 0 ) then - xAddOffset = offRight; - end - - if ( offTop < 0 ) then - yAddOffset = offTop; - elseif ( offBottom < 0 ) then - yAddOffset = -offBottom; - end - - listFrame:ClearAllPoints(); - if ( anchorName == "cursor" ) then - listFrame:SetPoint(point, relativeTo, relativePoint, xOffset + xAddOffset, yOffset + yAddOffset); - else - listFrame:SetPoint(point, relativeTo, relativePoint, xOffset + xAddOffset, yOffset + yAddOffset); - end - else - -- Determine whether the menu is off the screen or not - local offscreenY, offscreenX; - if ( (y - listFrame:GetHeight()/2) < 0 ) then - offscreenY = 1; - end - if ( listFrame:GetRight() > GetScreenWidth() ) then - offscreenX = 1; - end - if ( offscreenY and offscreenX ) then - point = gsub(point, "TOP(.*)", "BOTTOM%1"); - point = gsub(point, "(.*)LEFT", "%1RIGHT"); - relativePoint = gsub(relativePoint, "TOP(.*)", "BOTTOM%1"); - relativePoint = gsub(relativePoint, "(.*)RIGHT", "%1LEFT"); - xOffset = -11; - yOffset = -14; - elseif ( offscreenY ) then - point = gsub(point, "TOP(.*)", "BOTTOM%1"); - relativePoint = gsub(relativePoint, "TOP(.*)", "BOTTOM%1"); - xOffset = 0; - yOffset = -14; - elseif ( offscreenX ) then - point = gsub(point, "(.*)LEFT", "%1RIGHT"); - relativePoint = gsub(relativePoint, "(.*)RIGHT", "%1LEFT"); - xOffset = -11; - yOffset = 14; - else - xOffset = 0; - yOffset = 14; - end - - listFrame:ClearAllPoints(); - listFrame.parentLevel = tonumber(strmatch(anchorFrame:GetName(), "L_DropDownList(%d+)")); - listFrame.parentID = anchorFrame:GetID(); - listFrame:SetPoint(point, anchorFrame, relativePoint, xOffset, yOffset); - end - - end -end - -function lib:CloseDropDownMenus(level) - if ( not level ) then - level = 1; - end - for i=level, L_UIDROPDOWNMENU_MAXLEVELS do - _G["L_DropDownList"..i]:Hide(); - end - -- yes, we also want to close the menus which created by built-in UIDropDownMenus - for i=level, UIDROPDOWNMENU_MAXLEVELS do - _G["DropDownList"..i]:Hide(); - end -end - -local function containsMouse() - local result = false - - for i = 1, L_UIDROPDOWNMENU_MAXLEVELS do - local dropdown = _G["L_DropDownList"..i]; - if dropdown:IsShown() and dropdown:IsMouseOver() then - result = true; - end - end - for i = 1, UIDROPDOWNMENU_MAXLEVELS do - local dropdown = _G["DropDownList"..i]; - if dropdown:IsShown() and dropdown:IsMouseOver() then - result = true; - end - end - - - return result; -end - -function lib:UIDropDownMenu_HandleGlobalMouseEvent(button, event) - if event == "GLOBAL_MOUSE_DOWN" and (button == "LeftButton" or button == "RightButton") then - if not containsMouse() then - lib:CloseDropDownMenus(); - end - end -end - --- hooking UIDropDownMenu_HandleGlobalMouseEvent -do - if lib then - hooksecurefunc("UIDropDownMenu_HandleGlobalMouseEvent", function(button, event) - lib:UIDropDownMenu_HandleGlobalMouseEvent(button, event) - end) - - end -end - -function lib:UIDropDownMenu_SetWidth(frame, width, padding) - local frameName = frame:GetName(); - GetChild(frame, frameName, "Middle"):SetWidth(width); - local defaultPadding = 25; - if ( padding ) then - frame:SetWidth(width + padding); - else - frame:SetWidth(width + defaultPadding + defaultPadding); - end - if ( padding ) then - GetChild(frame, frameName, "Text"):SetWidth(width); - else - GetChild(frame, frameName, "Text"):SetWidth(width - defaultPadding); - end - frame.noResize = 1; -end - -function lib:UIDropDownMenu_SetButtonWidth(frame, width) - local frameName = frame:GetName(); - if ( width == "TEXT" ) then - width = GetChild(frame, frameName, "Text"):GetWidth(); - end - - GetChild(frame, frameName, "Button"):SetWidth(width); - frame.noResize = 1; -end - -function lib:UIDropDownMenu_SetText(frame, text) - local frameName = frame:GetName(); - GetChild(frame, frameName, "Text"):SetText(text); -end - -function lib:UIDropDownMenu_GetText(frame) - local frameName = frame:GetName(); - return GetChild(frame, frameName, "Text"):GetText(); -end - -function lib:UIDropDownMenu_ClearAll(frame) - -- Previous code refreshed the menu quite often and was a performance bottleneck - frame.selectedID = nil; - frame.selectedName = nil; - frame.selectedValue = nil; - lib:UIDropDownMenu_SetText(frame, ""); - - local button, checkImage, uncheckImage; - for i=1, L_UIDROPDOWNMENU_MAXBUTTONS do - button = _G["L_DropDownList"..L_UIDROPDOWNMENU_MENU_LEVEL.."Button"..i]; - button:UnlockHighlight(); - - checkImage = _G["L_DropDownList"..L_UIDROPDOWNMENU_MENU_LEVEL.."Button"..i.."Check"]; - checkImage:Hide(); - uncheckImage = _G["L_DropDownList"..L_UIDROPDOWNMENU_MENU_LEVEL.."Button"..i.."UnCheck"]; - uncheckImage:Hide(); - end -end - -function lib:UIDropDownMenu_JustifyText(frame, justification, customXOffset) - local frameName = frame:GetName(); - local text = GetChild(frame, frameName, "Text"); - text:ClearAllPoints(); - if ( justification == "LEFT" ) then - text:SetPoint("LEFT", GetChild(frame, frameName, "Left"), "LEFT", customXOffset or 27, 2); - text:SetJustifyH("LEFT"); - elseif ( justification == "RIGHT" ) then - text:SetPoint("RIGHT", GetChild(frame, frameName, "Right"), "RIGHT", customXOffset or -43, 2); - text:SetJustifyH("RIGHT"); - elseif ( justification == "CENTER" ) then - text:SetPoint("CENTER", GetChild(frame, frameName, "Middle"), "CENTER", customXOffset or -5, 2); - text:SetJustifyH("CENTER"); - end -end - -function lib:UIDropDownMenu_SetAnchor(dropdown, xOffset, yOffset, point, relativeTo, relativePoint) - dropdown.xOffset = xOffset; - dropdown.yOffset = yOffset; - dropdown.point = point; - dropdown.relativeTo = relativeTo; - dropdown.relativePoint = relativePoint; -end - -function lib:UIDropDownMenu_GetCurrentDropDown() - if ( L_UIDROPDOWNMENU_OPEN_MENU ) then - return L_UIDROPDOWNMENU_OPEN_MENU; - elseif ( L_UIDROPDOWNMENU_INIT_MENU ) then - return L_UIDROPDOWNMENU_INIT_MENU; - end -end - -function lib:UIDropDownMenuButton_GetChecked(self) - return _G[self:GetName().."Check"]:IsShown(); -end - -function lib:UIDropDownMenuButton_GetName(self) - return _G[self:GetName().."NormalText"]:GetText(); -end - -function lib:UIDropDownMenuButton_OpenColorPicker(self, button) - securecall("CloseMenus"); - if ( not button ) then - button = self; - end - L_UIDROPDOWNMENU_MENU_VALUE = button.value; - lib:OpenColorPicker(button); -end - -function lib:UIDropDownMenu_DisableButton(level, id) - _G["L_DropDownList"..level.."Button"..id]:Disable(); -end - -function lib:UIDropDownMenu_EnableButton(level, id) - _G["L_DropDownList"..level.."Button"..id]:Enable(); -end - -function lib:UIDropDownMenu_SetButtonText(level, id, text, colorCode) - local button = _G["L_DropDownList"..level.."Button"..id]; - if ( colorCode) then - button:SetText(colorCode..text.."|r"); - else - button:SetText(text); - end -end - -function lib:UIDropDownMenu_SetButtonNotClickable(level, id) - _G["L_DropDownList"..level.."Button"..id]:SetDisabledFontObject(GameFontHighlightSmallLeft); -end - -function lib:UIDropDownMenu_SetButtonClickable(level, id) - _G["L_DropDownList"..level.."Button"..id]:SetDisabledFontObject(GameFontDisableSmallLeft); -end - -function lib:UIDropDownMenu_DisableDropDown(dropDown) - local dropDownName = dropDown:GetName(); - local label = GetChild(dropDown, dropDownName, "Label"); - if label then - label:SetVertexColor(GRAY_FONT_COLOR:GetRGB()); - end - GetChild(dropDown, dropDownName, "Icon"):SetVertexColor(GRAY_FONT_COLOR:GetRGB()); - GetChild(dropDown, dropDownName, "Text"):SetVertexColor(GRAY_FONT_COLOR:GetRGB()); - GetChild(dropDown, dropDownName, "Button"):Disable(); - dropDown.isDisabled = 1; -end - -function lib:UIDropDownMenu_EnableDropDown(dropDown) - local dropDownName = dropDown:GetName(); - local label = GetChild(dropDown, dropDownName, "Label"); - if label then - label:SetVertexColor(NORMAL_FONT_COLOR:GetRGB()); - end - GetChild(dropDown, dropDownName, "Icon"):SetVertexColor(HIGHLIGHT_FONT_COLOR:GetRGB()); - GetChild(dropDown, dropDownName, "Text"):SetVertexColor(HIGHLIGHT_FONT_COLOR:GetRGB()); - GetChild(dropDown, dropDownName, "Button"):Enable(); - dropDown.isDisabled = nil; -end - -function lib:UIDropDownMenu_IsEnabled(dropDown) - return not dropDown.isDisabled; -end - -function lib:UIDropDownMenu_GetValue(id) - --Only works if the dropdown has just been initialized, lame, I know =( - local button = _G["L_DropDownList1Button"..id]; - if ( button ) then - return _G["L_DropDownList1Button"..id].value; - else - return nil; - end -end - -function lib:OpenColorPicker(info) - ColorPickerFrame.func = info.swatchFunc; - ColorPickerFrame.hasOpacity = info.hasOpacity; - ColorPickerFrame.opacityFunc = info.opacityFunc; - ColorPickerFrame.opacity = info.opacity; - ColorPickerFrame.previousValues = {r = info.r, g = info.g, b = info.b, opacity = info.opacity}; - ColorPickerFrame.cancelFunc = info.cancelFunc; - ColorPickerFrame.extraInfo = info.extraInfo; - -- This must come last, since it triggers a call to ColorPickerFrame.func() - ColorPickerFrame:SetColorRGB(info.r, info.g, info.b); - ShowUIPanel(ColorPickerFrame); -end - -function lib:ColorPicker_GetPreviousValues() - return ColorPickerFrame.previousValues.r, ColorPickerFrame.previousValues.g, ColorPickerFrame.previousValues.b; -end - --- ////////////////////////////////////////////////////////////// --- LibUIDropDownMenuTemplates --- ////////////////////////////////////////////////////////////// - --- Custom dropdown buttons are instantiated by some external system. --- When calling L_UIDropDownMenu_AddButton that system sets info.customFrame to the instance of the frame it wants to place on the menu. --- The dropdown menu creates its button for the entry as it normally would, but hides all elements. The custom frame is then anchored --- to that button and assumes responsibility for all relevant dropdown menu operations. --- The hidden button will request a size that it should become from the custom frame. - -lib.DropDownMenuButtonMixin = {} - -function lib.DropDownMenuButtonMixin:OnEnter(...) - ExecuteFrameScript(self:GetParent(), "OnEnter", ...); -end - -function lib.DropDownMenuButtonMixin:OnLeave(...) - ExecuteFrameScript(self:GetParent(), "OnLeave", ...); -end - -function lib.DropDownMenuButtonMixin:OnMouseDown(button) - if self:IsEnabled() then - lib:ToggleDropDownMenu(nil, nil, self:GetParent()); - PlaySound(SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON); - end -end - -lib.LargeDropDownMenuButtonMixin = CreateFromMixins(lib.DropDownMenuButtonMixin); - -function lib.LargeDropDownMenuButtonMixin:OnMouseDown(button) - if self:IsEnabled() then - local parent = self:GetParent(); - lib:ToggleDropDownMenu(nil, nil, parent, parent, -8, 8); - PlaySound(SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON); - end -end - -lib.DropDownExpandArrowMixin = {}; - -function lib.DropDownExpandArrowMixin:OnEnter() - local level = self:GetParent():GetParent():GetID() + 1; - - lib:CloseDropDownMenus(level); - - if self:IsEnabled() then - local listFrame = _G["L_DropDownList"..level]; - if ( not listFrame or not listFrame:IsShown() or select(2, listFrame:GetPoint()) ~= self ) then - lib:ToggleDropDownMenu(level, self:GetParent().value, nil, nil, nil, nil, self:GetParent().menuList, self); - end - end -end - -function lib.DropDownExpandArrowMixin:OnMouseDown(button) - if self:IsEnabled() then - lib:ToggleDropDownMenu(self:GetParent():GetParent():GetID() + 1, self:GetParent().value, nil, nil, nil, nil, self:GetParent().menuList, self); - PlaySound(SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON); - end -end - -lib.UIDropDownCustomMenuEntryMixin = {}; - -function lib.UIDropDownCustomMenuEntryMixin:GetPreferredEntryWidth() - -- NOTE: Only width is currently supported, dropdown menus size vertically based on how many buttons are present. - return self:GetWidth(); -end - -function lib.UIDropDownCustomMenuEntryMixin:OnSetOwningButton() - -- for derived objects to implement -end - -function lib.UIDropDownCustomMenuEntryMixin:SetOwningButton(button) - self:SetParent(button:GetParent()); - self.owningButton = button; - self:OnSetOwningButton(); -end - -function lib.UIDropDownCustomMenuEntryMixin:GetOwningDropdown() - return self.owningButton:GetParent(); -end - -function lib.UIDropDownCustomMenuEntryMixin:SetContextData(contextData) - self.contextData = contextData; -end - -function lib.UIDropDownCustomMenuEntryMixin:GetContextData() - return self.contextData; -end - --- ////////////////////////////////////////////////////////////// --- L_UIDropDownCustomMenuEntryTemplate -function lib:Create_UIDropDownCustomMenuEntry(name, parent) - local f = _G[name] or CreateFrame("Frame", name, parent or nil) - f:EnableMouse(true) - f:Hide() - - -- I am not 100% sure if below works for replacing the mixins - f:SetScript("GetPreferredEntryWidth", function(self) - return self:GetWidth() - end) - f:SetScript("SetOwningButton", function(self, button) - self:SetParent(button:GetParent()) - self.owningButton = button - self:OnSetOwningButton() - end) - f:SetScript("GetOwningDropdown", function(self) - return self.owningButton:GetParent() - end) - f:SetScript("SetContextData", function(self, contextData) - self.contextData = contextData - end) - f:SetScript("GetContextData", function(self) - return self.contextData - end) - - return f -end - --- ////////////////////////////////////////////////////////////// --- UIDropDownMenuButtonScriptTemplate --- --- TBD --- - --- ////////////////////////////////////////////////////////////// --- LargeUIDropDownMenuTemplate --- --- TBD --- - --- ////////////////////////////////////////////////////////////// --- EasyMenu --- Simplified Menu Display System --- This is a basic system for displaying a menu from a structure table. --- --- Args: --- menuList - menu table --- menuFrame - the UI frame to populate --- anchor - where to anchor the frame (e.g. CURSOR) --- x - x offset --- y - y offset --- displayMode - border type --- autoHideDelay - how long until the menu disappears -local function easyMenu_Initialize( frame, level, menuList ) - for index = 1, #menuList do - local value = menuList[index] - if (value.text) then - value.index = index; - lib:UIDropDownMenu_AddButton( value, level ); - end - end -end - -function lib:EasyMenu(menuList, menuFrame, anchor, x, y, displayMode, autoHideDelay ) - if ( displayMode == "MENU" ) then - menuFrame.displayMode = displayMode; - end - lib:UIDropDownMenu_Initialize(menuFrame, easyMenu_Initialize, displayMode, nil, menuList); - lib:ToggleDropDownMenu(1, nil, menuFrame, anchor, x, y, menuList, nil, autoHideDelay); -end - -function lib:EasyMenu_Initialize( frame, level, menuList ) - easyMenu_Initialize( frame, level, menuList ) -end - diff --git a/Titan/libs/!LibUIDropDownMenu/LibUIDropDownMenu/LibUIDropDownMenu.xml b/Titan/libs/!LibUIDropDownMenu/LibUIDropDownMenu/LibUIDropDownMenu.xml deleted file mode 100755 index bc7d69e..0000000 --- a/Titan/libs/!LibUIDropDownMenu/LibUIDropDownMenu/LibUIDropDownMenu.xml +++ /dev/null @@ -1,24 +0,0 @@ -<!-- $Id: LibUIDropDownMenu.xml 64 2020-11-18 13:13:15Z arithmandar $ --> -<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ -..\FrameXML\UI.xsd"> - <Script file="LibUIDropDownMenu.lua"/> -<!-- <Include file="LibUIDropDownMenuTemplates.xml"/> - - <Button name="L_DropDownList1" toplevel="true" frameStrata="FULLSCREEN_DIALOG" inherits="L_UIDropDownListTemplate" hidden="true" id="1"> - <Size> - <AbsDimension x="180" y="10"/> - </Size> - <Scripts> - <OnLoad> - local fontName, fontHeight, fontFlags = _G["L_DropDownList1Button1NormalText"]:GetFont(); - L_UIDROPDOWNMENU_DEFAULT_TEXT_HEIGHT = fontHeight; - </OnLoad> - </Scripts> - </Button> - <Button name="L_DropDownList2" toplevel="true" frameStrata="FULLSCREEN_DIALOG" inherits="L_UIDropDownListTemplate" hidden="true" id="2"> - <Size> - <AbsDimension x="180" y="10"/> - </Size> - </Button> ---> -</Ui> diff --git a/Titan/libs/!LibUIDropDownMenu/LibUIDropDownMenu/LibUIDropDownMenuTemplates.lua b/Titan/libs/!LibUIDropDownMenu/LibUIDropDownMenu/LibUIDropDownMenuTemplates.lua deleted file mode 100755 index 28c8b8f..0000000 --- a/Titan/libs/!LibUIDropDownMenu/LibUIDropDownMenu/LibUIDropDownMenuTemplates.lua +++ /dev/null @@ -1,126 +0,0 @@ --- $Id: LibUIDropDownMenuTemplates.lua 64 2020-11-18 13:13:15Z arithmandar $ --- ---------------------------------------------------------------------------- --- Localized Lua globals. --- ---------------------------------------------------------------------------- ---[[local _G = getfenv(0) --- ---------------------------------------------------------------------------- -local MAJOR_VERSION = "LibUIDropDownMenuTemplates-3.0" -local MINOR_VERSION = 90000 + tonumber(("$Rev: 64 $"):match("%d+")) - -local LibStub = _G.LibStub -if not LibStub then error(MAJOR_VERSION .. " requires LibStub.") end -local Lib = LibStub:NewLibrary(MAJOR_VERSION, MINOR_VERSION) -if not Lib then return end - --- Custom dropdown buttons are instantiated by some external system. --- When calling L_UIDropDownMenu_AddButton that system sets info.customFrame to the instance of the frame it wants to place on the menu. --- The dropdown menu creates its button for the entry as it normally would, but hides all elements. The custom frame is then anchored --- to that button and assumes responsibility for all relevant dropdown menu operations. --- The hidden button will request a size that it should become from the custom frame. - -L_DropDownMenuButtonMixin = {} - -function L_DropDownMenuButtonMixin:OnEnter(...) - ExecuteFrameScript(self:GetParent(), "OnEnter", ...); -end - -function L_DropDownMenuButtonMixin:OnLeave(...) - ExecuteFrameScript(self:GetParent(), "OnLeave", ...); -end - -function L_DropDownMenuButtonMixin:OnMouseDown(button) - if self:IsEnabled() then - L_ToggleDropDownMenu(nil, nil, self:GetParent()); - PlaySound(SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON); - end -end - -L_LargeDropDownMenuButtonMixin = CreateFromMixins(L_DropDownMenuButtonMixin); - -function L_LargeDropDownMenuButtonMixin:OnMouseDown(button) - if self:IsEnabled() then - local parent = self:GetParent(); - L_ToggleDropDownMenu(nil, nil, parent, parent, -8, 8); - PlaySound(SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON); - end -end - -L_DropDownExpandArrowMixin = {}; - -function L_DropDownExpandArrowMixin:OnEnter() - local level = self:GetParent():GetParent():GetID() + 1; - - L_CloseDropDownMenus(level); - - if self:IsEnabled() then - local listFrame = _G["L_DropDownList"..level]; - if ( not listFrame or not listFrame:IsShown() or select(2, listFrame:GetPoint()) ~= self ) then - L_ToggleDropDownMenu(level, self:GetParent().value, nil, nil, nil, nil, self:GetParent().menuList, self); - end - end -end - -function L_DropDownExpandArrowMixin:OnMouseDown(button) - if self:IsEnabled() then - L_ToggleDropDownMenu(self:GetParent():GetParent():GetID() + 1, self:GetParent().value, nil, nil, nil, nil, self:GetParent().menuList, self); - end -end - -L_UIDropDownCustomMenuEntryMixin = {}; - -function L_UIDropDownCustomMenuEntryMixin:GetPreferredEntryWidth() - -- NOTE: Only width is currently supported, dropdown menus size vertically based on how many buttons are present. - return self:GetWidth(); -end - -function L_UIDropDownCustomMenuEntryMixin:OnSetOwningButton() - -- for derived objects to implement -end - -function L_UIDropDownCustomMenuEntryMixin:SetOwningButton(button) - self:SetParent(button:GetParent()); - self.owningButton = button; - self:OnSetOwningButton(); -end - -function L_UIDropDownCustomMenuEntryMixin:GetOwningDropdown() - return self.owningButton:GetParent(); -end - -function L_UIDropDownCustomMenuEntryMixin:SetContextData(contextData) - self.contextData = contextData; -end - -function L_UIDropDownCustomMenuEntryMixin:GetContextData() - return self.contextData; -end - --- ////////////////////////////////////////////////////////////// --- L_UIDropDownCustomMenuEntryTemplate -function L_Create_UIDropDownCustomMenuEntry(name, parent) - local f = _G[name] or CreateFrame("Frame", name, parent or nil) - f:EnableMouse(true) - f:Hide() - - -- I am not 100% sure if below works for replacing the mixins - f:SetScript("GetPreferredEntryWidth", function(self) - return self:GetWidth() - end) - f:SetScript("SetOwningButton", function(self, button) - self:SetParent(button:GetParent()) - self.owningButton = button - self:OnSetOwningButton() - end) - f:SetScript("GetOwningDropdown", function(self) - return self.owningButton:GetParent() - end) - f:SetScript("SetContextData", function(self, contextData) - self.contextData = contextData - end) - f:SetScript("GetContextData", function(self) - return self.contextData - end) - - return f -end -]] diff --git a/Titan/libs/!LibUIDropDownMenu/LibUIDropDownMenu/LibUIDropDownMenuTemplates.xml b/Titan/libs/!LibUIDropDownMenu/LibUIDropDownMenu/LibUIDropDownMenuTemplates.xml deleted file mode 100755 index bf89718..0000000 --- a/Titan/libs/!LibUIDropDownMenu/LibUIDropDownMenu/LibUIDropDownMenuTemplates.xml +++ /dev/null @@ -1,412 +0,0 @@ -<!-- $Id: LibUIDropDownMenuTemplates.xml 64 2020-11-18 13:13:15Z arithmandar $ --> -<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ -..\FrameXML\UI.xsd"> - <Include file="LibUIDropDownMenuTemplates.lua"/> -<!-- - <Frame name="L_UIDropDownCustomMenuEntryTemplate" enableMouse="true" hidden="true" mixin="L_UIDropDownCustomMenuEntryMixin" virtual="true/"> - - <Button name="ColorSwatchTemplate" virtual="true"> - <Size x="16" y="16"/> - <Layers> - <Layer level="BACKGROUND" textureSubLevel="-3"> - <Texture name="$parentSwatchBg" parentKey="SwatchBg" texelSnappingBias="0.0" snapToPixelGrid="false"> - <Size x="14" y="14"/> - <Anchors> - <Anchor point="CENTER"/> - </Anchors> - <Color color="HIGHLIGHT_FONT_COLOR"/> - </Texture> - </Layer> - <Layer level="BACKGROUND" textureSubLevel="-2"> - <Texture parentKey="InnerBorder" texelSnappingBias="0.0" snapToPixelGrid="false"> - <Size x="12" y="12"/> - <Anchors> - <Anchor point="CENTER"/> - </Anchors> - <Color color="BLACK_FONT_COLOR"/> - </Texture> - </Layer> - <Layer level="BACKGROUND" textureSubLevel="-1"> - <Texture parentKey="Color" texelSnappingBias="0.0" snapToPixelGrid="false"> - <Size x="10" y="10"/> - <Anchors> - <Anchor point="CENTER"/> - </Anchors> - <Color color="HIGHLIGHT_FONT_COLOR"/> - </Texture> - </Layer> - </Layers> - <Scripts> - <OnShow inherit="prepend"> - PixelUtil.SetSize(self.SwatchBg, 14, 14); - PixelUtil.SetSize(self.InnerBorder, 12, 12); - PixelUtil.SetSize(self.Color, 10, 10); - </OnShow> - </Scripts> - </Button> - <Button name="L_UIDropDownMenuButtonTemplate" virtual="true"> - <Size x="100" y="16"/> - <Layers> - <Layer level="BACKGROUND"> - <Texture name="$parentHighlight" parentKey="Highlight" file="Interface\QuestFrame\UI-QuestTitleHighlight" alphaMode="ADD" setAllPoints="true" hidden="true"/> - </Layer> - <Layer level="ARTWORK"> - <Texture name="$parentCheck" file="Interface\Common\UI-DropDownRadioChecks"> - <Size x="16" y="16"/> - <Anchors> - <Anchor point="LEFT"> - <Offset x="0" y="0"/> - </Anchor> - </Anchors> - <TexCoords left="0" right="0.5" top="0.5" bottom="1.0"/> - </Texture> - <Texture name="$parentUnCheck" file="Interface\Common\UI-DropDownRadioChecks"> - <Size x="16" y="16"/> - <Anchors> - <Anchor point="LEFT"> - <Offset x="0" y="0"/> - </Anchor> - </Anchors> - <TexCoords left="0.5" right="1.0" top="0.5" bottom="1.0"/> - </Texture> - <Texture parentKey="Icon" name="$parentIcon" hidden="true"> - <Size> - <AbsDimension x="16" y="16"/> - </Size> - <Anchors> - <Anchor point="RIGHT"> - <Offset x="0" y="0"/> - </Anchor> - </Anchors> - </Texture> - </Layer> - </Layers> - <Frames> - <Button name="$parentColorSwatch" hidden="true"> - <Size> - <AbsDimension x="16" y="16"/> - </Size> - <Anchors> - <Anchor point="RIGHT"> - <Offset> - <AbsDimension x="-6" y="0"/> - </Offset> - </Anchor> - </Anchors> - <Layers> - <Layer level="BACKGROUND"> - <Texture name="$parentSwatchBg"> - <Size> - <AbsDimension x="14" y="14"/> - </Size> - <Anchors> - <Anchor point="CENTER"> - <Offset> - <AbsDimension x="0" y="0"/> - </Offset> - </Anchor> - </Anchors> - <Color r="1.0" g="1.0" b="1.0"/> - </Texture> - </Layer> - </Layers> - <Scripts> - <OnClick> - CloseMenus(); - L_UIDropDownMenuButton_OpenColorPicker(self:GetParent()); - </OnClick> - <OnEnter> - L_CloseDropDownMenus(self:GetParent():GetParent():GetID() + 1); - _G[self:GetName().."SwatchBg"]:SetVertexColor(NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b); - L_UIDropDownMenu_StopCounting(self:GetParent():GetParent()); - </OnEnter> - <OnLeave> - _G[self:GetName().."SwatchBg"]:SetVertexColor(HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b); - L_UIDropDownMenu_StartCounting(self:GetParent():GetParent()); - </OnLeave> - </Scripts> - <NormalTexture name="$parentNormalTexture" file="Interface\ChatFrame\ChatFrameColorSwatch"/> - </Button> - <Button name="$parentExpandArrow" hidden="true" motionScriptsWhileDisabled="true"> - <Size> - <AbsDimension x="16" y="16"/> - </Size> - <Anchors> - <Anchor point="RIGHT"> - <Offset> - <AbsDimension x="0" y="0"/> - </Offset> - </Anchor> - </Anchors> - <Scripts> - <OnClick> - L_ToggleDropDownMenu(self:GetParent():GetParent():GetID() + 1, self:GetParent().value, nil, nil, nil, nil, self:GetParent().menuList, self); - </OnClick> - <OnEnter> - local level = self:GetParent():GetParent():GetID() + 1; - - L_CloseDropDownMenus(level); - - if self:IsEnabled() then - local listFrame = _G["L_DropDownList"..level]; - if ( not listFrame or not listFrame:IsShown() or select(2, listFrame:GetPoint()) ~= self ) then - L_ToggleDropDownMenu(level, self:GetParent().value, nil, nil, nil, nil, self:GetParent().menuList, self); - end - end - - L_UIDropDownMenu_StopCounting(self:GetParent():GetParent()); - </OnEnter> - <OnLeave> - L_UIDropDownMenu_StartCounting(self:GetParent():GetParent()); - </OnLeave> - </Scripts> - <NormalTexture file="Interface\ChatFrame\ChatFrameExpandArrow"/> - </Button> - <Button name="$parentInvisibleButton" hidden="true" parentKey="invisibleButton"> - <Anchors> - <Anchor point="TOPLEFT"/> - <Anchor point="BOTTOMLEFT"/> - <Anchor point="RIGHT" relativeTo="$parentColorSwatch" relativePoint="LEFT"> - <Offset> - <AbsDimension x="0" y="0"/> - </Offset> - </Anchor> - </Anchors> - <Scripts> - <OnEnter function="L_UIDropDownMenuButtonInvisibleButton_OnEnter"/> - <OnLeave function="L_UIDropDownMenuButtonInvisibleButton_OnLeave"/> - </Scripts> - </Button> - </Frames> - <Scripts> - <OnLoad> - self:SetFrameLevel(self:GetParent():GetFrameLevel()+2); - </OnLoad> - <OnClick> - L_UIDropDownMenuButton_OnClick(self, button, down); - </OnClick> - <OnEnter function="L_UIDropDownMenuButton_OnEnter"/> - <OnLeave function="L_UIDropDownMenuButton_OnLeave"/> - <OnEnable> - self.invisibleButton:Hide(); - </OnEnable> - <OnDisable> - self.invisibleButton:Show(); - </OnDisable> - </Scripts> - <ButtonText name="$parentNormalText"> - <Anchors> - <Anchor point="LEFT"> - <Offset x="-5" y="0"/> - </Anchor> - </Anchors> - </ButtonText> - <NormalFont style="GameFontHighlightSmallLeft"/> - <HighlightFont style="GameFontHighlightSmallLeft"/> - <DisabledFont style="GameFontDisableSmallLeft"/> - </Button> - <Button name="L_UIDropDownListTemplate" hidden="true" frameStrata="DIALOG" enableMouse="true" virtual="true"> - <Frames> - <Frame name="$parentBackdrop" setAllPoints="true"> - <Backdrop bgFile="Interface\DialogFrame\UI-DialogBox-Background-Dark" edgeFile="Interface\DialogFrame\UI-DialogBox-Border" tile="true"> - <BackgroundInsets> - <AbsInset left="11" right="11" top="11" bottom="9"/> - </BackgroundInsets> - <TileSize> - <AbsValue val="32"/> - </TileSize> - <EdgeSize> - <AbsValue val="32"/> - </EdgeSize> - </Backdrop> - </Frame> - <Frame name="$parentMenuBackdrop" setAllPoints="true"> - <Backdrop bgFile="Interface\Tooltips\UI-Tooltip-Background" edgeFile="Interface\Tooltips\UI-Tooltip-Border" tile="true"> - <EdgeSize> - <AbsValue val="16"/> - </EdgeSize> - <TileSize> - <AbsValue val="16"/> - </TileSize> - <BackgroundInsets> - <AbsInset left="5" right="4" top="4" bottom="4"/> - </BackgroundInsets> - </Backdrop> - <Scripts> - <OnLoad> - self:SetBackdropBorderColor(TOOLTIP_DEFAULT_COLOR.r, TOOLTIP_DEFAULT_COLOR.g, TOOLTIP_DEFAULT_COLOR.b); - self:SetBackdropColor(TOOLTIP_DEFAULT_BACKGROUND_COLOR.r, TOOLTIP_DEFAULT_BACKGROUND_COLOR.g, TOOLTIP_DEFAULT_BACKGROUND_COLOR.b); - </OnLoad> - </Scripts> - </Frame> - <Button name="$parentButton1" inherits="L_UIDropDownMenuButtonTemplate" id="1"/> - </Frames> - <Scripts> - <OnClick> - self:Hide(); - </OnClick> - <OnEnter> - L_UIDropDownMenu_StopCounting(self, motion); - </OnEnter> - <OnLeave> - L_UIDropDownMenu_StartCounting(self, motion); - </OnLeave> - <OnUpdate> - L_UIDropDownMenu_OnUpdate(self, elapsed); - </OnUpdate> - <OnShow> - for i=1, L_UIDROPDOWNMENU_MAXBUTTONS do - if (not self.noResize) then - _G[self:GetName().."Button"..i]:SetWidth(self.maxWidth); - end - end - if (not self.noResize) then - self:SetWidth(self.maxWidth+25); - end - self.showTimer = nil; - if ( self:GetID() > 1 ) then - self.parent = _G["L_DropDownList"..(self:GetID() - 1)]; - end - </OnShow> - <OnHide> - L_UIDropDownMenu_OnHide(self); - </OnHide> - </Scripts> - </Button> - <Frame name="L_UIDropDownMenuTemplate" virtual="true"> - <Size> - <AbsDimension x="40" y="32"/> - </Size> - <Layers> - <Layer level="ARTWORK"> - <Texture name="$parentLeft" parentKey="Left" file="Interface\Glues\CharacterCreate\CharacterCreate-LabelFrame"> - <Size> - <AbsDimension x="25" y="64"/> - </Size> - <Anchors> - <Anchor point="TOPLEFT"> - <Offset> - <AbsDimension x="0" y="17"/> - </Offset> - </Anchor> - </Anchors> - <TexCoords left="0" right="0.1953125" top="0" bottom="1"/> - </Texture> - <Texture name="$parentMiddle" parentKey="Middle" file="Interface\Glues\CharacterCreate\CharacterCreate-LabelFrame"> - <Size> - <AbsDimension x="115" y="64"/> - </Size> - <Anchors> - <Anchor point="LEFT" relativeKey="$parent.Left" relativePoint="RIGHT"/> - </Anchors> - <TexCoords left="0.1953125" right="0.8046875" top="0" bottom="1"/> - </Texture> - <Texture name="$parentRight" parentKey="Right" file="Interface\Glues\CharacterCreate\CharacterCreate-LabelFrame"> - <Size> - <AbsDimension x="25" y="64"/> - </Size> - <Anchors> - <Anchor point="LEFT" relativeKey="$parent.Middle" relativePoint="RIGHT"/> - </Anchors> - <TexCoords left="0.8046875" right="1" top="0" bottom="1"/> - </Texture> - <FontString parentKey="Text" name="$parentText" inherits="GameFontHighlightSmall" wordwrap="false" justifyH="RIGHT"> - <Size> - <AbsDimension x="0" y="10"/> - </Size> - <Anchors> - <Anchor point="RIGHT" relativeKey="$parent.Right"> - <Offset> - <AbsDimension x="-43" y="2"/> - </Offset> - </Anchor> - </Anchors> - </FontString> - </Layer> - <Layer level="OVERLAY"> - <Texture parentKey="Icon" name="$parentIcon" hidden="true"> - <Size> - <AbsDimension x="16" y="16"/> - </Size> - <Anchors> - <Anchor point="LEFT"> - <Offset x="30" y="2"/> - </Anchor> - </Anchors> - </Texture> - </Layer> - </Layers> - <Frames> - <Button parentKey="Button" name="$parentButton" motionScriptsWhileDisabled="true" > - <Size> - <AbsDimension x="24" y="24"/> - </Size> - <Anchors> - <Anchor point="TOPRIGHT" relativeKey="$parent.Right"> - <Offset> - <AbsDimension x="-16" y="-18"/> - </Offset> - </Anchor> - </Anchors> - <Scripts> - <OnEnter> - local parent = self:GetParent(); - local myscript = parent:GetScript("OnEnter"); - if(myscript ~= nil) then - myscript(parent); - end - </OnEnter> - <OnLeave> - local parent = self:GetParent(); - local myscript = parent:GetScript("OnLeave"); - if(myscript ~= nil) then - myscript(parent); - end - </OnLeave> - <OnClick> - L_ToggleDropDownMenu(nil, nil, self:GetParent()); - PlaySound(SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON); - </OnClick> - </Scripts> - <NormalTexture name="$parentNormalTexture" parentKey="NormalTexture" file="Interface\ChatFrame\UI-ChatIcon-ScrollDown-Up"> - <Size> - <AbsDimension x="24" y="24"/> - </Size> - <Anchors> - <Anchor point="RIGHT"/> - </Anchors> - </NormalTexture> - <PushedTexture name="$parentPushedTexture" parentKey="PushedTexture" file="Interface\ChatFrame\UI-ChatIcon-ScrollDown-Down"> - <Size> - <AbsDimension x="24" y="24"/> - </Size> - <Anchors> - <Anchor point="RIGHT"/> - </Anchors> - </PushedTexture> - <DisabledTexture name="$parentDisabledTexture" parentKey="DisabledTexture" file="Interface\ChatFrame\UI-ChatIcon-ScrollDown-Disabled"> - <Size> - <AbsDimension x="24" y="24"/> - </Size> - <Anchors> - <Anchor point="RIGHT"/> - </Anchors> - </DisabledTexture> - <HighlightTexture name="$parentHighlightTexture" parentKey="HighlightTexture" file="Interface\Buttons\UI-Common-MouseHilight" alphaMode="ADD"> - <Size> - <AbsDimension x="24" y="24"/> - </Size> - <Anchors> - <Anchor point="RIGHT"/> - </Anchors> - </HighlightTexture> - </Button> - </Frames> - <Scripts> - <OnHide> - L_CloseDropDownMenus(); - </OnHide> - </Scripts> - </Frame> ---> -</Ui> diff --git a/Titan/libs/_Titan_Lib_Notes.txt b/Titan/libs/_Titan_Lib_Notes.txt index 61fb7a1..67e7da5 100644 --- a/Titan/libs/_Titan_Lib_Notes.txt +++ b/Titan/libs/_Titan_Lib_Notes.txt @@ -1,7 +1,8 @@ +*** 2021-02-10 *** +* Ace3 removed : !LibUIDropDownMenu : https://www.wowace.com/projects/libuidropdownmenu *** 2020-12-02 *** -* Ace3 release is used -* Added are: +* Ace3 release is used +* Added : - !LibUIDropDownMenu : https://www.wowace.com/projects/libuidropdownmenu - AceGUI-3.0-SharedMediaWidgets : https://www.wowace.com/projects/ace-gui-3-0-shared-media-widgets - LibSharedMedia-3.0 : https://www.wowace.com/projects/libsharedmedia-3-0 - diff --git a/TitanBag/TitanBag.lua b/TitanBag/TitanBag.lua index 7259cf3..0c19787 100644 --- a/TitanBag/TitanBag.lua +++ b/TitanBag/TitanBag.lua @@ -383,7 +383,7 @@ function TitanPanelRightClickMenu_PrepareBagMenu() local info -- level 2 if TitanPanelRightClickMenu_GetDropdownLevel() == 2 then - if _G["L_UIDROPDOWNMENU_MENU_VALUE"] == "Options" then + if TitanPanelRightClickMenu_GetDropdMenuValue() == "Options" then TitanPanelRightClickMenu_AddTitle(L["TITAN_PANEL_OPTIONS"], TitanPanelRightClickMenu_GetDropdownLevel()) info = {}; info.text = L["TITAN_BAG_MENU_SHOW_USED_SLOTS"]; diff --git a/TitanGold/TitanGold.lua b/TitanGold/TitanGold.lua index b70d61f..2c75e4f 100644 --- a/TitanGold/TitanGold.lua +++ b/TitanGold/TitanGold.lua @@ -592,7 +592,7 @@ end -- DESC: Builds the right click config menu -- ******************************************************************************************* function TitanPanelRightClickMenu_PrepareGoldMenu() - if L_UIDROPDOWNMENU_MENU_LEVEL == 1 then + if TitanPanelRightClickMenu_GetDropdownLevel() == 1 then -- Menu title TitanPanelRightClickMenu_AddTitle(L["TITAN_GOLD_ITEMNAME"]); @@ -733,7 +733,7 @@ function TitanPanelRightClickMenu_PrepareGoldMenu() TitanPanelRightClickMenu_AddCommand(L["TITAN_PANEL_MENU_HIDE"], TITAN_GOLD_ID, TITAN_PANEL_MENU_FUNC_HIDE); end - if L_UIDROPDOWNMENU_MENU_LEVEL == 2 and L_UIDROPDOWNMENU_MENU_VALUE == "ToonDelete" then + if TitanPanelRightClickMenu_GetDropdownLevel() == 2 and TitanPanelRightClickMenu_GetDropdMenuValue() == "ToonDelete" then local info = {}; info.notCheckable = true info.text = L["TITAN_GOLD_FACTION_PLAYER_ALLY"]; @@ -745,7 +745,7 @@ function TitanPanelRightClickMenu_PrepareGoldMenu() info.value = "DeleteHorde"; info.hasArrow = 1; TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); - elseif L_UIDROPDOWNMENU_MENU_LEVEL == 2 and L_UIDROPDOWNMENU_MENU_VALUE == "ToonShow" then + elseif TitanPanelRightClickMenu_GetDropdownLevel() == 2 and TitanPanelRightClickMenu_GetDropdMenuValue() == "ToonShow" then local info = {}; info.notCheckable = true info.text = L["TITAN_GOLD_FACTION_PLAYER_ALLY"]; @@ -759,13 +759,13 @@ function TitanPanelRightClickMenu_PrepareGoldMenu() TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); end - if L_UIDROPDOWNMENU_MENU_LEVEL == 3 and L_UIDROPDOWNMENU_MENU_VALUE == "DeleteAlliance" then + if TitanPanelRightClickMenu_GetDropdownLevel() == 3 and TitanPanelRightClickMenu_GetDropdMenuValue() == "DeleteAlliance" then DeleteMenuButtons("Alliance") - elseif L_UIDROPDOWNMENU_MENU_LEVEL == 3 and L_UIDROPDOWNMENU_MENU_VALUE == "DeleteHorde" then + elseif TitanPanelRightClickMenu_GetDropdownLevel() == 3 and TitanPanelRightClickMenu_GetDropdMenuValue() == "DeleteHorde" then DeleteMenuButtons("Horde") - elseif L_UIDROPDOWNMENU_MENU_LEVEL == 3 and L_UIDROPDOWNMENU_MENU_VALUE == "ShowAlliance" then + elseif TitanPanelRightClickMenu_GetDropdownLevel() == 3 and TitanPanelRightClickMenu_GetDropdMenuValue() == "ShowAlliance" then ShowMenuButtons("Alliance") - elseif L_UIDROPDOWNMENU_MENU_LEVEL == 3 and L_UIDROPDOWNMENU_MENU_VALUE == "ShowHorde" then + elseif TitanPanelRightClickMenu_GetDropdownLevel() == 3 and TitanPanelRightClickMenu_GetDropdMenuValue() == "ShowHorde" then ShowMenuButtons("Horde") end end diff --git a/TitanLocation/TitanLocation.lua b/TitanLocation/TitanLocation.lua index 2e2f504..e8c76b3 100755 --- a/TitanLocation/TitanLocation.lua +++ b/TitanLocation/TitanLocation.lua @@ -291,9 +291,9 @@ function TitanPanelRightClickMenu_PrepareLocationMenu() local info -- level 2 - if _G["L_UIDROPDOWNMENU_MENU_LEVEL"] == 2 then - if _G["L_UIDROPDOWNMENU_MENU_VALUE"] == "Options" then - TitanPanelRightClickMenu_AddTitle(L["TITAN_PANEL_OPTIONS"], _G["L_UIDROPDOWNMENU_MENU_LEVEL"]); + if TitanPanelRightClickMenu_GetDropdownLevel() == 2 then + if TitanPanelRightClickMenu_GetDropdMenuValue() == "Options" then + TitanPanelRightClickMenu_AddTitle(L["TITAN_PANEL_OPTIONS"], TitanPanelRightClickMenu_GetDropdownLevel()); info = {}; info.text = L["TITAN_LOCATION_MENU_SHOW_ZONE_ON_PANEL_TEXT"]; info.func = TitanPanelLocationButton_ToggleDisplay; @@ -322,8 +322,8 @@ function TitanPanelRightClickMenu_PrepareLocationMenu() info.disabled = InCombatLockdown() TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); end - if _G["L_UIDROPDOWNMENU_MENU_VALUE"] == "CoordFormat" then - TitanPanelRightClickMenu_AddTitle(L["TITAN_LOCATION_FORMAT_COORD_LABEL"], _G["L_UIDROPDOWNMENU_MENU_LEVEL"]); + if TitanPanelRightClickMenu_GetDropdMenuValue() == "CoordFormat" then + TitanPanelRightClickMenu_AddTitle(L["TITAN_LOCATION_FORMAT_COORD_LABEL"], TitanPanelRightClickMenu_GetDropdownLevel()); info = {}; info.text = L["TITAN_LOCATION_FORMAT_LABEL"]; info.func = function() diff --git a/TitanLootType/TitanLootType.lua b/TitanLootType/TitanLootType.lua index dc2dda4..851f472 100644 --- a/TitanLootType/TitanLootType.lua +++ b/TitanLootType/TitanLootType.lua @@ -230,7 +230,7 @@ end -- ************************************************************************** function TitanPanelRightClickMenu_PrepareLootTypeMenu() local info = {}; - if _G["L_UIDROPDOWNMENU_MENU_LEVEL"] == 2 and _G["L_UIDROPDOWNMENU_MENU_VALUE"] == "RandomRoll" then + if TitanPanelRightClickMenu_GetDropdownLevel() == 2 and TitanPanelRightClickMenu_GetDropdMenuValue() == "RandomRoll" then info = {}; info.text = "100"; info.value = 100; @@ -244,7 +244,7 @@ function TitanPanelRightClickMenu_PrepareLootTypeMenu() info.func = TitanPanelLootType_Random1000; info.checked = TitanPanelLootType_GetRoll(info.value); TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); - elseif _G["L_UIDROPDOWNMENU_MENU_LEVEL"] == 2 and _G["L_UIDROPDOWNMENU_MENU_VALUE"] == "ShowDungeonDiffMenu" then + elseif TitanPanelRightClickMenu_GetDropdownLevel() == 2 and TitanPanelRightClickMenu_GetDropdMenuValue() == "ShowDungeonDiffMenu" then info = {}; info.text = _G["LFG_TYPE_DUNGEON"]; info.func = function() TitanSetVar(TITAN_LOOTTYPE_ID, "DungeonDiffType", "DUNGEON"); TitanPanelButton_UpdateButton(TITAN_LOOTTYPE_ID) end @@ -262,7 +262,7 @@ function TitanPanelRightClickMenu_PrepareLootTypeMenu() info.func = function() TitanSetVar(TITAN_LOOTTYPE_ID, "DungeonDiffType", "AUTO"); TitanPanelButton_UpdateButton(TITAN_LOOTTYPE_ID) end info.checked = function() if TitanGetVar(TITAN_LOOTTYPE_ID, "DungeonDiffType") == "AUTO" then return true end return false end TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); - elseif _G["L_UIDROPDOWNMENU_MENU_LEVEL"] == 2 and _G["L_UIDROPDOWNMENU_MENU_VALUE"] == "SetDungeonDiff" then + elseif TitanPanelRightClickMenu_GetDropdownLevel() == 2 and TitanPanelRightClickMenu_GetDropdMenuValue() == "SetDungeonDiff" then info = {}; info.text = _G["GREEN_FONT_COLOR_CODE"].._G["PLAYER_DIFFICULTY1"].."|r"; info.func = function() SetDungeonDifficultyID(1) end @@ -348,7 +348,7 @@ function TitanPanelRightClickMenu_PrepareLootTypeMenu() TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); - elseif _G["L_UIDROPDOWNMENU_MENU_LEVEL"] == 2 and _G["L_UIDROPDOWNMENU_MENU_VALUE"] == "SetRaidDiff" then + elseif TitanPanelRightClickMenu_GetDropdownLevel() == 2 and TitanPanelRightClickMenu_GetDropdMenuValue() == "SetRaidDiff" then info = {}; info.text = _G["GREEN_FONT_COLOR_CODE"].._G["PLAYER_DIFFICULTY1"].."|r"; info.func = function() SetRaidDifficultyID(1) end diff --git a/TitanPerformance/TitanPerformance.lua b/TitanPerformance/TitanPerformance.lua index 91e8daa..3863081 100644 --- a/TitanPerformance/TitanPerformance.lua +++ b/TitanPerformance/TitanPerformance.lua @@ -9,8 +9,7 @@ local TITAN_PERFORMANCE_ID = "Performance"; local TITAN_PERF_FRAME_SHOW_TIME = 0.5; local updateTable = {TITAN_PERFORMANCE_ID, TITAN_PANEL_UPDATE_ALL}; --- The LibUIDropDownMenu lib is used over the Blizzard frame -local drop_down = "L_DropDownList" +local drop_down = "DropDownList" -- Boo!! Per hard-coded Blizz UIDropDownMenu.lua local APP_MIN = 1 local APP_MAX = 40 @@ -445,15 +444,15 @@ function TitanPanelRightClickMenu_PreparePerformanceMenu() local info -- level 3 - if _G["L_UIDROPDOWNMENU_MENU_LEVEL"] == 3 and _G["L_UIDROPDOWNMENU_MENU_VALUE"]== "AddonControlFrame" then + if TitanPanelRightClickMenu_GetDropdownLevel() == 3 and TitanPanelRightClickMenu_GetDropdMenuValue() == "AddonControlFrame" then TitanPanelPerfControlFrame:Show() return end -- level 2 - if _G["L_UIDROPDOWNMENU_MENU_LEVEL"] == 2 then - if _G["L_UIDROPDOWNMENU_MENU_VALUE"] == "Options" then - TitanPanelRightClickMenu_AddTitle(L["TITAN_PANEL_OPTIONS"], _G["L_UIDROPDOWNMENU_MENU_LEVEL"]); + if TitanPanelRightClickMenu_GetDropdownLevel() == 2 then + if TitanPanelRightClickMenu_GetDropdMenuValue() == "Options" then + TitanPanelRightClickMenu_AddTitle(L["TITAN_PANEL_OPTIONS"], TitanPanelRightClickMenu_GetDropdownLevel()); local temptable = {TITAN_PERFORMANCE_ID, "ShowFPS"}; info = {}; @@ -500,8 +499,8 @@ function TitanPanelRightClickMenu_PreparePerformanceMenu() TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); end - if _G["L_UIDROPDOWNMENU_MENU_VALUE"] == "AddonUsage" then - TitanPanelRightClickMenu_AddTitle(L["TITAN_PERFORMANCE_ADDONS"], _G["L_UIDROPDOWNMENU_MENU_LEVEL"]); + if TitanPanelRightClickMenu_GetDropdMenuValue() == "AddonUsage" then + TitanPanelRightClickMenu_AddTitle(L["TITAN_PERFORMANCE_ADDONS"], TitanPanelRightClickMenu_GetDropdownLevel()); local temptable = {TITAN_PERFORMANCE_ID, "ShowAddonMemory"}; info = {}; @@ -533,8 +532,8 @@ function TitanPanelRightClickMenu_PreparePerformanceMenu() TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); end - if _G["L_UIDROPDOWNMENU_MENU_VALUE"] == "AddonMemoryFormat" then - TitanPanelRightClickMenu_AddTitle(L["TITAN_PERFORMANCE_ADDON_MEM_FORMAT_LABEL"], _G["L_UIDROPDOWNMENU_MENU_LEVEL"]); + if TitanPanelRightClickMenu_GetDropdMenuValue() == "AddonMemoryFormat" then + TitanPanelRightClickMenu_AddTitle(L["TITAN_PERFORMANCE_ADDON_MEM_FORMAT_LABEL"], TitanPanelRightClickMenu_GetDropdownLevel()); info = {}; info.text = L["TITAN_MEGABYTE"]; info.checked = function() if TitanGetVar(TITAN_PERFORMANCE_ID, "AddonMemoryType") == 1 then return true else return nil end @@ -549,15 +548,15 @@ function TitanPanelRightClickMenu_PreparePerformanceMenu() TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); end - if _G["L_UIDROPDOWNMENU_MENU_VALUE"] == "CPUProfiling" then + if TitanPanelRightClickMenu_GetDropdMenuValue() == "CPUProfiling" then if ( GetCVar("scriptProfile") == "1" ) then - TitanPanelRightClickMenu_AddTitle(L["TITAN_PERFORMANCE_MENU_CPUPROF_LABEL"]..": "..GREEN_FONT_COLOR_CODE..L["TITAN_PANEL_MENU_ENABLED"], _G["L_UIDROPDOWNMENU_MENU_LEVEL"]); + TitanPanelRightClickMenu_AddTitle(L["TITAN_PERFORMANCE_MENU_CPUPROF_LABEL"]..": "..GREEN_FONT_COLOR_CODE..L["TITAN_PANEL_MENU_ENABLED"], TitanPanelRightClickMenu_GetDropdownLevel()); info = {}; info.text = L["TITAN_PERFORMANCE_MENU_CPUPROF_LABEL_OFF"]..GREEN_FONT_COLOR_CODE..L["TITAN_PANEL_MENU_RELOADUI"]; info.func = function() SetCVar("scriptProfile", "0", 1) ReloadUI() end TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); else - TitanPanelRightClickMenu_AddTitle(L["TITAN_PERFORMANCE_MENU_CPUPROF_LABEL"]..": "..RED_FONT_COLOR_CODE..L["TITAN_PANEL_MENU_DISABLED"], _G["L_UIDROPDOWNMENU_MENU_LEVEL"]); + TitanPanelRightClickMenu_AddTitle(L["TITAN_PERFORMANCE_MENU_CPUPROF_LABEL"]..": "..RED_FONT_COLOR_CODE..L["TITAN_PANEL_MENU_DISABLED"], TitanPanelRightClickMenu_GetDropdownLevel()); info = {}; info.text = L["TITAN_PERFORMANCE_MENU_CPUPROF_LABEL_ON"]..GREEN_FONT_COLOR_CODE..L["TITAN_PANEL_MENU_RELOADUI"]; info.func = function() SetCVar("scriptProfile", "1", 1) ReloadUI() end diff --git a/TitanRepair/TitanRepair.lua b/TitanRepair/TitanRepair.lua index fb612f0..7d75928 100644 --- a/TitanRepair/TitanRepair.lua +++ b/TitanRepair/TitanRepair.lua @@ -1116,9 +1116,9 @@ function TitanPanelRightClickMenu_PrepareRepairMenu() local info; -- level 2 - if _G["L_UIDROPDOWNMENU_MENU_LEVEL"] == 2 then - if _G["L_UIDROPDOWNMENU_MENU_VALUE"] == "Discount" then - TitanPanelRightClickMenu_AddTitle(L["REPAIR_LOCALE"]["discount"], _G["L_UIDROPDOWNMENU_MENU_LEVEL"]); + if TitanPanelRightClickMenu_GetDropdownLevel() == 2 then + if TitanPanelRightClickMenu_GetDropdMenuValue() == "Discount" then + TitanPanelRightClickMenu_AddTitle(L["REPAIR_LOCALE"]["discount"], TitanPanelRightClickMenu_GetDropdownLevel()); info = {}; info.text = L["REPAIR_LOCALE"]["buttonNormal"]; @@ -1186,8 +1186,8 @@ local info; TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); end - if _G["L_UIDROPDOWNMENU_MENU_VALUE"] == "Options" then - TitanPanelRightClickMenu_AddTitle(L["TITAN_PANEL_OPTIONS"], _G["L_UIDROPDOWNMENU_MENU_LEVEL"]); + if TitanPanelRightClickMenu_GetDropdMenuValue() == "Options" then + TitanPanelRightClickMenu_AddTitle(L["TITAN_PANEL_OPTIONS"], TitanPanelRightClickMenu_GetDropdownLevel()); info = {}; info.text = L["REPAIR_LOCALE"]["percentage"]; @@ -1239,8 +1239,8 @@ local info; TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); end - if _G["L_UIDROPDOWNMENU_MENU_VALUE"] == "AutoRepair" then - TitanPanelRightClickMenu_AddTitle(L["REPAIR_LOCALE"]["AutoReplabel"], _G["L_UIDROPDOWNMENU_MENU_LEVEL"]); + if TitanPanelRightClickMenu_GetDropdMenuValue() == "AutoRepair" then + TitanPanelRightClickMenu_AddTitle(L["REPAIR_LOCALE"]["AutoReplabel"], TitanPanelRightClickMenu_GetDropdownLevel()); info = {}; info.text = L["REPAIR_LOCALE"]["popup"]; @@ -1261,7 +1261,7 @@ local info; TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); end - if _G["L_UIDROPDOWNMENU_MENU_VALUE"] == "GuildBank" then + if TitanPanelRightClickMenu_GetDropdMenuValue() == "GuildBank" then totalGBCP = GetGuildBankMoney(); withdrawGBCP = GetGuildBankWithdrawMoney(); if IsGuildLeader() ~= true then @@ -1271,8 +1271,8 @@ local info; if (totalGBCP < withdrawGBCP) or IsGuildLeader() == true then withdrawGB = totalGB; end - TitanPanelRightClickMenu_AddTitle(L["TITAN_REPAIR_GBANK_TOTAL"].." "..totalGB, _G["L_UIDROPDOWNMENU_MENU_LEVEL"]); - TitanPanelRightClickMenu_AddTitle(L["TITAN_REPAIR_GBANK_WITHDRAW"].." "..withdrawGB, _G["L_UIDROPDOWNMENU_MENU_LEVEL"]); + TitanPanelRightClickMenu_AddTitle(L["TITAN_REPAIR_GBANK_TOTAL"].." "..totalGB, TitanPanelRightClickMenu_GetDropdownLevel()); + TitanPanelRightClickMenu_AddTitle(L["TITAN_REPAIR_GBANK_WITHDRAW"].." "..withdrawGB, TitanPanelRightClickMenu_GetDropdownLevel()); info = {} info.text = L["TITAN_REPAIR_GBANK_USEFUNDS"] info.func = function() TitanToggleVar(TITAN_REPAIR_ID, "UseGuildBank"); end @@ -1280,8 +1280,8 @@ local info; TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); end - if _G["L_UIDROPDOWNMENU_MENU_VALUE"] == "TooltipOptions" then - TitanPanelRightClickMenu_AddTitle(L["REPAIR_LOCALE"]["TooltipOptions"], _G["L_UIDROPDOWNMENU_MENU_LEVEL"]); + if TitanPanelRightClickMenu_GetDropdMenuValue() == "TooltipOptions" then + TitanPanelRightClickMenu_AddTitle(L["REPAIR_LOCALE"]["TooltipOptions"], TitanPanelRightClickMenu_GetDropdownLevel()); info = {}; info.text = L["REPAIR_LOCALE"]["ShowItems"]; diff --git a/TitanXP/TitanXP.lua b/TitanXP/TitanXP.lua index 3a83541..2173bd3 100644 --- a/TitanXP/TitanXP.lua +++ b/TitanXP/TitanXP.lua @@ -345,7 +345,7 @@ end function TitanPanelRightClickMenu_PrepareXPMenu() local info = {}; - if L_UIDROPDOWNMENU_MENU_LEVEL == 2 then + if TitanPanelRightClickMenu_GetDropdownLevel() == 2 then TitanPanelRightClickMenu_AddTitle(L["TITAN_XP_MENU_SIMPLE_BUTTON_TITLE"], 2); info = {}; @@ -374,7 +374,7 @@ function TitanPanelRightClickMenu_PrepareXPMenu() info.checked = TitanUtils_Ternary(TitanGetVar(TITAN_XP_ID, "ShowSimpleNumOfGains"), 1, nil); TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); return - elseif L_UIDROPDOWNMENU_MENU_LEVEL == 1 then + elseif TitanPanelRightClickMenu_GetDropdownLevel() == 1 then TitanPanelRightClickMenu_AddTitle(TitanPlugins[TITAN_XP_ID].menuText); info = {}; info.text = L["TITAN_XP_MENU_SHOW_XPHR_THIS_SESSION"];