diff --git a/Titan/LDBToTitan.lua b/Titan/LDBToTitan.lua index 4d55188..4644cfe 100644 --- a/Titan/LDBToTitan.lua +++ b/Titan/LDBToTitan.lua @@ -7,7 +7,7 @@ NAME: Titan LDB overview DESC: Titan will automatically convert a LDB type addon to a Titan plugin. Only LDB types listed in the LDB 1.1 spec are supported. Custom types are not supported. -Supported +Supported type - "launcher" become "icon" plugins icon* - always shown OnClick* - @@ -24,6 +24,15 @@ Supported tooltip OnTooltipShow - +- "macro" become "combo" plugins with icon; a tooltip/Click; and optional label + icon^ - + commandtext^ - + label^ - + OnEnter - + OnLeave - + tooltip + OnTooltipShow - + * required by LDB spec ^ user controlled show / hide :DESC @@ -423,12 +432,8 @@ end NAME: TitanLDBShowText DESC: Text callback for the Titan (LDB) plugin when the LDB addon changes display text VAR: name - id of the plugin -OUT: None -NOTE: -- One interpretation of 1.1 spec to show text is either -1) use .text or use .value & .suffix (Titan implements) -2) always use .text but .value & .suffix are parts if needed -:NOTE +OUT: label of text to show +OUT: text to show --]] function TitanLDBShowText(name) -- Set 'label1' and 'value1' for the Titan button display @@ -454,13 +459,10 @@ function TitanLDBShowText(name) end -- Check for display text - if TitanGetVar(name, "ShowRegularText") then - if ldb.suffix and ldb.suffix ~="" then - val1 = (ldb.value or "").." "..ldb.suffix - else - val1 = (ldb.text or "") - end - end + val1 = (ldb.text or "") + -- .text is required to show + -- .value is the text of the value - 100.0 in 100.0 FPS + -- .suffix is the text after the value - FPS in 100.0 FPS else -- return values will be empty strings end @@ -690,14 +692,12 @@ function LDBToTitan:TitanLDBCreateObject(_, name, obj) controlVariables = { ShowIcon = true, ShowLabelText = true, - ShowRegularText = false, ShowColoredText = false, DisplayOnRightSide = true }, savedVariables = { ShowIcon = true, ShowLabelText = true, - ShowRegularText = true, ShowColoredText = false, DisplayOnRightSide = false }, @@ -744,25 +744,18 @@ function LDBToTitan:TitanLDBCreateObject(_, name, obj) -- controls -- one interpretation of the LDB spec is launchers -- should always have an icon. - registry["controlVariables"].ShowIcon = false; - registry["controlVariables"].ShowRegularText = false; -- no text + registry["controlVariables"].ShowIcon = true; -- defaults - registry["savedVariables"].ShowRegularText = false; registry["savedVariables"].DisplayOnRightSide = true; -- start on right side end if obj.type == DATA_SOURCE then -- controls - registry["controlVariables"].ShowRegularText = true; -- defaults - registry["savedVariables"].ShowRegularText = true; end -- - -- Create the frame for this LDB addon - -- - - -- Create the Titan Frame ... + -- Create the Titan frame for this LDB addon -- Titan _OnLoad will be used to request the plugin be registered by Titan local newTitanFrame -- a frame if obj.type == "macro" then -- custom @@ -842,7 +835,6 @@ VAR: function OUT: None NOTE: - PLAYER_LOGIN - Read through all the LDB object created so far and create cooresponding Titan plugins. -- PLAYER_ENTERING_WORLD - Create a one time timer. This helps ensure the latest values are displayed on the plugin. Some LDB addons create their objects then update the addon values. Titan could have missed the updates as it created & registered the Titan plugin. :NOTE --]] LDBToTitan:SetScript("OnEvent", function(self, event, ...) @@ -861,10 +853,6 @@ LDBToTitan:SetScript("OnEvent", function(self, event, ...) if (event == "PLAYER_ENTERING_WORLD") then self:UnregisterEvent("PLAYER_ENTERING_WORLD") - -- Ensure all plugins (for LDB) are refreshed. - -- Some LDB plugins may have updated text, icon, etc - -- before the plugin was registered so be nice and schedule a refresh --- TitanMovable_AdjustTimer("LDBRefresh") end end ) \ No newline at end of file diff --git a/Titan/Titan.toc b/Titan/Titan.toc index 9616f31..f4961c4 100644 --- a/Titan/Titan.toc +++ b/Titan/Titan.toc @@ -1,7 +1,7 @@ ## Interface: 100000 -## Title: Titan Panel [|cffeda55f_Core_|r] |cff00aa006.00.04.100000|r +## Title: Titan Panel [|cffeda55f_Core_|r] |cff00aa006.00.05.100000|r ## Author: Titan Panel Development Team -## Version: 6.00.04.100000 +## Version: 6.00.05.100000 ## SavedVariables: TitanAll, TitanSettings, TitanSkins, ServerTimeOffsets, ServerHourFormat ## OptionalDeps: Ace3, AceGUI-3.0-SharedMediaWidgets, LibSharedMedia-3.0, LibQTip-1.0, !LibUIDropDownMenu ## Notes: Adds a display bar on the top and/or bottom of the screen. Allows users to show and control information/launcher plugins. @@ -32,10 +32,10 @@ locale\Localization.TW.lua TitanUtils.lua TitanVariables.lua -TitanAutoHide.lua TitanPanelTemplate.xml TitanMovable.lua TitanConfig.lua +TitanAutoHide.lua TitanPanel.xml TitanPanel.lua LDBToTitan.lua diff --git a/Titan/TitanAutoHide.lua b/Titan/TitanAutoHide.lua index 918b81b..76af2d2 100644 --- a/Titan/TitanAutoHide.lua +++ b/Titan/TitanAutoHide.lua @@ -178,3 +178,73 @@ function Handle_OnUpdateAutoHide(frame) TitanPanelBarButton_Hide(frame) end end + +-- ====== Create needed frames +local function Create_Hide_Button(name, f) + local window = CreateFrame("Button", name, f, "TitanPanelIconTemplate") + window:SetFrameStrata("FULLSCREEN") + -- Using SetScript("OnLoad", does not work + Titan_AutoHide_OnLoad(window); +-- TitanPanelButton_OnLoad(window); -- Titan XML template calls this... + + window:SetScript("OnShow", function(self) + Titan_AutoHide_OnShow(self) + end) + window:SetScript("OnClick", function(self, button) + Titan_AutoHide_OnClick(self, button); + TitanPanelButton_OnClick(self, button); + end) +end + +local function Create_Frames() + if _G[TITAN_BUTTON] then + return -- if already created + end + + -- Display & Hide bars + local top1_d = CreateFrame("Button", "Titan_Bar__Display_Bar", UIParent, "Titan_Bar__Display_Template") + top1_d:SetFrameStrata("DIALOG") + top1_d:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 0, 0) + top1_d:SetPoint("BOTTOMRIGHT", UIParent, "TOPRIGHT", 0, -24) + local top1_h = CreateFrame("Button", "Titan_Bar__Hider_Bar", UIParent, "TitanPanelBarButtonHiderTemplate") + top1_h:SetFrameStrata("DIALOG") + top1_h:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 0, -24) + + local top2_d = CreateFrame("Button", "Titan_Bar__Display_Bar2", UIParent, "Titan_Bar__Display_Template") + top2_d:SetFrameStrata("DIALOG") + top2_d:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 0, 24) + top2_d:SetPoint("BOTTOMRIGHT", UIParent, "TOPRIGHT", 0, 48) + local top2_h = CreateFrame("Button", "Titan_Bar__Hider_Bar2", UIParent, "TitanPanelBarButtonHiderTemplate") + top2_h:SetFrameStrata("DIALOG") + top2_h:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 0, -24) + + local bot1_d = CreateFrame("Button", "Titan_Bar__Display_AuxBar", UIParent, "Titan_Bar__Display_Template") + bot1_d:SetFrameStrata("DIALOG") + bot1_d:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", 0, 0) + bot1_d:SetPoint("TOPRIGHT", UIParent, "BOTTOMRIGHT", 0, 24) + local bot1_h = CreateFrame("Button", "Titan_Bar__Hider_AuxBar", UIParent, "TitanPanelBarButtonHiderTemplate") + bot1_h:SetFrameStrata("DIALOG") + bot1_h:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 0, -24) + + local bot2_d = CreateFrame("Button", "Titan_Bar__Display_AuxBar2", UIParent, "Titan_Bar__Display_Template") + bot2_d:SetFrameStrata("DIALOG") + bot2_d:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", 0, 24) + bot2_d:SetPoint("TOPRIGHT", UIParent, "BOTTOMRIGHT", 0, 48) + local bot2_h = CreateFrame("Button", "Titan_Bar__Hider_AuxBar2", UIParent, "TitanPanelBarButtonHiderTemplate") + bot2_h:SetFrameStrata("DIALOG") + bot2_h:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 0, -24) + + -- general container frame + local f = CreateFrame("Frame", nil, UIParent) +-- f:Hide() + + -- Titan Auto hide Buttons + Create_Hide_Button("TitanPanelAutoHide_BarButton", f) + Create_Hide_Button("TitanPanelAutoHide_Bar2Button", f) + Create_Hide_Button("TitanPanelAutoHide_AuxBar2Button", f) + Create_Hide_Button("TitanPanelAutoHide_AuxBarButton", f) + +end + + +Create_Frames() -- do the work diff --git a/Titan/TitanAutoHide.xml b/Titan/TitanAutoHide.xml deleted file mode 100644 index 9627f42..0000000 --- a/Titan/TitanAutoHide.xml +++ /dev/null @@ -1,38 +0,0 @@ -<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="TitanAutoHide.lua"/> - <Frame parent="UIParent"> - <Frames> - <Button name="TitanPanelAutoHideButton" inherits="TitanPanelIconTemplate" frameStrata="FULLSCREEN" toplevel="true"> - <Scripts> - <OnLoad> - TitanPanelAutoHideButton_OnLoad(self); - TitanPanelButton_OnLoad(self); - </OnLoad> - <OnShow> - TitanPanelAutoHideButton_OnShow(); - </OnShow> - <OnClick> - TitanPanelAutoHideButton_OnClick(self, button); - TitanPanelButton_OnClick(self, button); - </OnClick> - </Scripts> - </Button> - <Button name="TitanPanelAuxAutoHideButton" inherits="TitanPanelIconTemplate" frameStrata="FULLSCREEN" toplevel="true"> - <Scripts> - <OnLoad> - TitanPanelAuxAutoHideButton_OnLoad(self); - TitanPanelButton_OnLoad(self); - </OnLoad> - <OnShow> - TitanPanelAuxAutoHideButton_OnShow(); - </OnShow> - <OnClick> - TitanPanelAuxAutoHideButton_OnClick(self, button); - TitanPanelButton_OnClick(self, button); - </OnClick> - </Scripts> - </Button> - </Frames> - </Frame> -</Ui> \ No newline at end of file diff --git a/Titan/TitanConfig.lua b/Titan/TitanConfig.lua index 6195c93..d1a729a 100644 --- a/Titan/TitanConfig.lua +++ b/Titan/TitanConfig.lua @@ -251,18 +251,7 @@ local optionsTrans = { }, }, } - --[[ - tooltiptrans = { - name = L["TITAN_TRANS_CONTROL_TITLE_TOOLTIP"], - desc = L["TITAN_TRANS_TOOLTIP_DESC"], - order = 50, type = "range", width = "full", - min = 0, max = 1, step = 0.01, - get = function() return TitanPanelGetVar("TooltipTrans") end, - set = function(_, a) - TitanPanelSetVar("TooltipTrans", a); - end, - }, ---]] + --[[ local NAME: TitanPanel_TransOptions DESC: This will add each Titan bar to the transparency option table so it can be adjusted by the user. Each bar is shown whether ot not the user has them displayed. @@ -792,37 +781,6 @@ local optionsBars = { }, } } --- DF do not need adjust ---[=[ - confdesc3 = { - order = 300, - type = "header", - name = L["TITAN_PANEL_OPTIONS"], - }, - optiontopscreen = { - name = L["TITAN_PANEL_MENU_DISABLE_PUSH"], - desc = L["TITAN_PANEL_MENU_DISABLE_PUSH"], - order = 301, type = "toggle", width = "full", - get = function() return TitanPanelGetVar("ScreenAdjust") end, - set = function() TitanPanel_ScreenAdjustReload() end, - }, - optionminimap = { - name = L["TITAN_PANEL_MENU_DISABLE_MINIMAP_PUSH"], - desc = L["TITAN_PANEL_MENU_DISABLE_MINIMAP_PUSH"], - order = 302, type = "toggle", width = "full", - get = function() return TitanPanelGetVar("MinimapAdjust") end, - set = function() TitanPanelToggleVar("MinimapAdjust"); end, - }, - optiontickets = { - name = L["TITAN_PANEL_MENU_DISABLE_TICKET"].." " - .._G["GREEN_FONT_COLOR_CODE"]..L["TITAN_PANEL_MENU_RELOADUI"], - desc = L["TITAN_PANEL_MENU_DISABLE_TICKET"].." " - .._G["GREEN_FONT_COLOR_CODE"]..L["TITAN_PANEL_MENU_RELOADUI"], - order = 305, type = "toggle", width = "full", - get = function() return TitanPanelGetVar("TicketAdjust"); end, - set = function() TitanPanel_TicketReload() end, - }, ---]=] --[[ local NAME: optionsAuxBars @@ -992,54 +950,6 @@ local optionsAuxBars = { }, } } --- DF do not need adjust - ---[=[ - confdesc3 = { - order = 300, - type = "header", - name = L["TITAN_PANEL_OPTIONS"], - }, - optionbottomscreen = { - name = L["TITAN_PANEL_MENU_DISABLE_PUSH"], - desc = L["TITAN_PANEL_MENU_DISABLE_PUSH"], - order = 301, type = "toggle", width = "full", - get = function() return TitanPanelGetVar("AuxScreenAdjust") end, - set = function() TitanPanel_AuxScreenAdjustReload(); end, - }, - optionlog = { - name = L["TITAN_PANEL_MENU_DISABLE_LOGS"], - desc = L["TITAN_PANEL_MENU_DISABLE_LOGS"], - order = 303, type = "toggle", width = "full", - get = function() return TitanPanelGetVar("LogAdjust") end, - set = function() TitanPanelToggleVar("LogAdjust"); end, - }, - optionbags = { - name = L["TITAN_PANEL_MENU_DISABLE_BAGS"], - desc = L["TITAN_PANEL_MENU_DISABLE_BAGS"], - order = 304, type = "toggle", width = "full", - get = function() return TitanPanelGetVar("BagAdjust") end, - set = function() TitanPanelToggleVar("BagAdjust"); end, - }, - confdesc4 = { - order = 400, - type = "header", - name = L["TITAN_PANEL_MAIN_MENU_BAR"], - }, - mainMenuBarAdj = { - name = L["TITAN_PANEL_MAIN_MENU_BAR_ADJ"], - desc = L["TITAN_PANEL_MAIN_MENU_BAR_ADJ_DESC"], - order = 410, type = "range", width = "full", - min = -200, max = 200, step = 1, - get = function() return TitanPanelGetVar("MainMenuBarXAdj") end, - set = function(_, a) - TitanPanelSetVar("MainMenuBarXAdj", a); - -- Adjust frame positions - TitanPanel_AdjustFrames(true, "Config: Adjust X (right / left)") - end, - }, ---]=] -------------- ------------- -- General Titan config section @@ -1754,7 +1664,7 @@ local function TitanUpdateConfigAddons() end, } end - +--[[ --ShowRegularText (LDB data sources only atm) if plug_in.controlVariables and plug_in.controlVariables.ShowRegularText then args[plug_in.id].args.regular_text = @@ -1769,7 +1679,7 @@ local function TitanUpdateConfigAddons() end, } end - +--]] --ShowColoredText if plug_in.controlVariables and plug_in.controlVariables.ShowColoredText then args[plug_in.id].args.color_text = { @@ -1914,43 +1824,6 @@ Controls: - Vehicle timer - some users need Titan to wait longer whenever entering or leaving a vehicle before adjusting frames. :DESC --]] ---[[ - conftimerdesc = { - name = "Timers", - type = "group", inline = true, - order = 1, - args = { - confdesc = { - order = 10, - type = "description", - name = L["TITAN_PANEL_MENU_ADV_DESC"], - cmdHidden = true - }, - advtimerpew = { - name = L["TITAN_PANEL_MENU_ADV_PEW"], - desc = L["TITAN_PANEL_MENU_ADV_PEW_DESC"], - order = 20, type = "range", width = "full", - min = 1, max = 10, step = 0.5, - get = function() return TitanAllGetVar("TimerPEW") end, - set = function(_, a) - TitanAllSetVar("TimerPEW", a); - TitanTimers["EnterWorld"].delay = a - end, - }, - }, - }, - advtimervehicle = { - name = L["TITAN_PANEL_MENU_ADV_VEHICLE"], - desc = L["TITAN_PANEL_MENU_ADV_VEHICLE_DESC"], - order = 50, type = "range", width = "full", - min = 1, max = 10, step = 0.5, - get = function() return TitanAllGetVar("TimerVehicle") end, - set = function(_, a) - TitanAllSetVar("TimerVehicle", a); - TitanTimers["Vehicle"].delay = a - end, - }, ---]] local optionsAdvanced = { name = TITAN_PANEL_CONFIG.topic.advanced, --L["TITAN_PANEL_MENU_ADV"], type = "group", diff --git a/Titan/TitanMovable.lua b/Titan/TitanMovable.lua index f62e40b..d34ec6e 100755 --- a/Titan/TitanMovable.lua +++ b/Titan/TitanMovable.lua @@ -1,50 +1,20 @@ --[[ File NAME: TitanMovable.lua DESC: Contains the routines to adjust the Blizzard frames to make room for the Titan bars the user has selected. -There are a select set of Blizzard frames at the top of screen and at the bottom of the screen that Titan will move. -Each frame adjusted has an entry in MData which is local and not directly accessible via addons. -However addons can tell Titan to not adjust some or all frames using TitanUtils_AddonAdjust(frame, bool). -Addons that replace all or parts of the Blizzard UI use this. -The user can turn turn on / off the adjusting of all top frames or all bottom frames. -:DESC - -NOTE: The Override Bar has changed over time. Titan has had to evolve with it, making several attempts to -create a reasonable fix to minimize the impact to the player. -Titan Panel hooks 3 areas: -- OverrideActionBar show -- OverrideActionBar hide -- ActionBarController_UpdateAll -This covers various quests and other situations that replace the main menu bar temporarily. - -When the player uses bottom bar(s), the bars are hidden while the override is active then -put back when the bar is removed. - -While on some quests where the player is in a vehicle, they could be knocked out of said vehicle. -If Titan shows the bottom bar, the main menu could be unusable. Titan will wait for the player to be out of -combat while in a vehicle. -On some quests (for example, some turtle quests in BfA) it takes seconds for the player to fall out of combat -at the end of the quest. This will cause Titan bars to be delayed before appearing. -:NOTE +DragonFlight introduced an Edit Mode for the user to move various frames where they want them. +However two UI elements were not included: +- XP / Status bar (with the reputation bar above) +- menu & bag buttons -NOTE: Some quests replace the menu bar with an Override Bar which causes Titan Panel -to hide the bottom bar(s). -When the menu bar is active again Titan needs to show the bottom bar(s). -A check is made when : -- Override is hidden (hook) -- Vehicle exit (event) -- Combat over (event) -All three are needed to show bottom bar(s) because the order is not guaranteed. Some quests do not use Override bar. -:NOTE +This greatly chanegd the work Titan needed to do. +Now Titan only needs to allow the user to manually adjust the two UI elements themselves. -NOTE: When the player is in their class hall, Titan will hide the top bars to not conflict with the Class Command Bar. -:NOTE +:DESC -NOTE: Vehicle enter and leave have become complicated because a vehicle could be a flight path or a quest. -On vehicle enter Titan closes any Titan menus and states the menu bar as 'user controlled' but does not close bottom bars(s). -Stating 'user controlled' is for quests using a vehicle but does not impact flights. -Closing bottom bars will be done on Override show / ActionBarController_UpdateAll invocation -Closing the bottom bars on flights would be inconsistent and remove player functionality. +NOTE: +- All secure hooks were removed from Movable. +- All timers were removed from Movable. :NOTE --]] @@ -57,713 +27,6 @@ local hooks_done = false; local move_count = 0 ---[[ Titan -Declare the Ace routines - local AceTimer = LibStub("AceTimer-3.0") - i.e. TitanPanelAce.ScheduleTimer("LDBToTitanSetText", TitanLDBRefreshButton, 2); - or - i.e. TitanPanelAce:ScheduleTimer(TitanLDBRefreshButton, 2); - - Be careful that the 'self' is proper to cancel timers!!! ---]] -local TitanPanelAce = LibStub("AceAddon-3.0"):NewAddon("TitanPanel", "AceHook-3.0", "AceTimer-3.0") - ---Determines the optimal magic number based on resolution ---local menuBarTop = 55; ---local width, height = string.match((({GetScreenResolutions()})[GetCurrentResolution()] or ""), "(%d+).-(%d+)"); ---if ( tonumber(width) / tonumber(height ) > 4/3 ) then - --Widescreen resolution --- menuBarTop = 75; ---end - ---[[From Resike to prevent tainting stuff to override the SetPoint calls securely. -hooksecurefunc(FrameRef, "SetPoint", function(self) - if self.moving then - return - end - self.moving = true - self:SetMovable(true) - self:SetUserPlaced(true) - self:ClearAllPoints() - self:SetPoint("CENTER", UIParent, "CENTER", 0, 0) - self:SetMovable(false) - self.moving = nil -end) ---]] - --- DF with DragonFlight these are no longer needed ---[====[ ---[[ Titan -NAME: TitanMovable_AdjustTimer -DESC: Cancel then add the given timer. The timer must be in TitanTimers. -VAR: ttype - The timer type (string) as defined in TitanTimers -OUT: None ---]] -function TitanMovable_AdjustTimer(ttype) - local timer = TitanTimers[ttype] - if timer then - TitanPanelAce.CancelAllTimers(timer.obj) - TitanPanelAce.ScheduleTimer(timer.obj, timer.callback, timer.delay) - end -end - ---[[ local -NAME: Titan_AdjustUIScale -DESC: Adjust the scale of Titan bars and plugins to the user selected scaling. This is called by the secure post hooks to the 'Video Options Frame'. -VAR: None -OUT: None ---]] -local function Titan_AdjustUIScale() - Titan_AdjustScale() -end - ---[[ local -NAME: f_list table -DESC: Holds the list of frames Titan may adjust with additional data. -Each record contains: -name - frame name (string) to adjust -user_movable - true if Blizzard allows the user to move the frame via its UI -debug - set true if debugging the adjust of that frame -:DESC -NOTE: -- The index MUST be the frame name as used by MData. -:NOTE ---]] -local f_list = { - PlayerFrame = {name = "PlayerFrame", place = TITAN_PANEL_PLACE_TOP, user_movable = true, debug = false}, - TargetFrame = {name = "TargetFrame", place = TITAN_PANEL_PLACE_TOP, user_movable = true, debug = false}, - PartyMemberFrame1 = {name = "PartyMemberFrame1", place = TITAN_PANEL_PLACE_TOP, user_movable = false, debug = false}, - TicketStatusFrame = {name = "TicketStatusFrame", place = TITAN_PANEL_PLACE_TOP, user_movable = false, debug = false}, - BuffFrame = {name = "BuffFrame", place = TITAN_PANEL_PLACE_TOP, user_movable = false, debug = false}, - MinimapCluster = {name = "MinimapCluster", place = TITAN_PANEL_PLACE_TOP, user_movable = false, debug = false}, - MultiBarRight = {name = "MultiBarRight", place = TITAN_PANEL_PLACE_BOTTOM, user_movable = false, debug = false}, - MicroButtonAndBagsBar = {name = "MicroButtonAndBagsBar", place = TITAN_PANEL_PLACE_BOTTOM, user_movable = false, debug = false}, - MainMenuBar = {name = "MainMenuBar", place = TITAN_PANEL_PLACE_BOTTOM, user_movable = false, debug = false}, - ExtraActionBarFrame = {name = "ExtraActionBarFrame", place = TITAN_PANEL_PLACE_BOTTOM, user_movable = false, debug = false}, -} - ---[[ local -NAME: DoAdjust -DESC: See if Titan should adjust based only on its own flags. -VAR: place - top or bottom -OUT: boolean - true to adjust, false if not ---]] -local function DoAdjust(place, force) - local res = false -- assume we will not adjust - -- force is passed to cover cases where the user has just deselected both top or bottom bars - -- When that happens we need to adjust - - -- We did it to ourselves - if (Aux)ScreenAdjust is true / 1 it means the user wants Titan to NOT adjust... - if place == TITAN_PANEL_PLACE_TOP or place == TITAN_PANEL_PLACE_BOTH then - if TitanPanelGetVar("ScreenAdjust") == 1 then - -- do not adjust - else - if force then - res = true - elseif TitanPanelGetVar("Bar_Show") or TitanPanelGetVar("Bar2_Show") then - res = true - end - end - elseif place == TITAN_PANEL_PLACE_BOTTOM or place == TITAN_PANEL_PLACE_BOTH then - if TitanPanelGetVar("AuxScreenAdjust") == 1 then - -- do not adjust - else - if force then - res = true - elseif TitanPanelGetVar("AuxBar_Show") or TitanPanelGetVar("AuxBar2_Show") then - res = true - end - end - end - return res -end - ---[[ local -NAME: VisibleBars -DESC: Get the x axis offset if XP or another bar are shown -VAR: None -OUT: int - X axis offset, in pixels ---]] -local function VisibleBars() - -- A valid frame and point is required - -- Determine a proper X offset using the given point (position) - local ret = 0 -- In case player at max level (no XP gain) and nothing else shown - if ( StatusTrackingBarManager:GetNumberVisibleBars() == 2 ) then - ret = 17; - elseif ( StatusTrackingBarManager:GetNumberVisibleBars() == 1 ) then - ret = 14; - end - - return ret -end - ---[[ Titan -NAME: TitanMovable_MenuBar_Disable -DESC: Handle the main menu bar so Blizzard does not get upset. -VAR: None -OUT: None -NOTE: -- Needed because 8.0 made changes to the menu bar processing -- Tell Blizzard that the bar is NOT user placed so when Blizzard makes it reappear, it is working -:NOTE ---]] -function TitanMovable_MenuBar_Disable() - if DoAdjust(TITAN_PANEL_PLACE_BOTTOM, false) then - MainMenuBar:SetMovable(true); - MainMenuBar:SetUserPlaced(false); - end - - if TITAN_PANEL_VARS.debug.movable then - TitanDebug ("_MenuBar_Disable :" - .." likely UNIT_ENTERED_VEHICLE" - ) - end -end - ---[[ Titan -NAME: TitanMovable_MenuBar_Enable -DESC: Handle the main menu bar so Blizzard does not get upset. -VAR: None -OUT: None -NOTE: -- Needed because 8.0 made changes to the menu bar processing -- Tell Blizzard that the bar is user placed IF NOT in combat to prevent 'bouncing' of the bar if users use a bottom Titan bar -- This is called for the various events Titan handles that do / may hide the main menu bar -- IF TitanMovable_MenuBar_Disable was called, this must be called before having Titan adjust frames. The 'is user placed' is required to work around a Blizzard 'feature' that adjusts the main menu bar while in combat. -:NOTE ---]] -function TitanMovable_MenuBar_Enable() - if InCombatLockdown() or UnitInVehicle("player") then - -- wait until out of combat... - -- if player is in vehicle then do not set user is placed, - -- needed whether in taxi or other vehicle that may replace the main menu bar - else - if DoAdjust(TITAN_PANEL_PLACE_BOTTOM, false) then - MainMenuBar:SetMovable(true); - MainMenuBar:SetUserPlaced(true); - MainMenuBar:SetMovable(false); - end - end -end - ---[[ local -NAME: TitanMovableFrame_GetXOffset -DESC: Get the x axis offset Titan needs to adjust the given frame. -VAR: frame - frame object -VAR: point - "LEFT" / "RIGHT" / "TOP" / "BOTTOM" / "CENTER" -OUT: int - X axis offset, in pixels ---]] -local function TitanMovableFrame_GetXOffset(frame, point) - -- A valid frame and point is required - -- Determine a proper X offset using the given point (position) - local ret = 0 -- In case the inputs were invalid or the point was not relevant to the frame then return 0 - if frame and point then - if point == "LEFT" and frame:GetLeft() and UIParent:GetLeft() then - ret = frame:GetLeft() - UIParent:GetLeft(); - elseif point == "RIGHT" and frame:GetRight() and UIParent:GetRight() then - ret = frame:GetRight() - UIParent:GetRight(); - elseif point == "TOP" and frame:GetTop() and UIParent:GetTop() then - ret = frame:GetTop() - UIParent:GetTop(); - elseif point == "BOTTOM" and frame:GetBottom() and UIParent:GetBottom() then - ret = frame:GetBottom() - UIParent:GetBottom(); - elseif point == "CENTER" and frame:GetLeft() and frame:GetRight() - and UIParent:GetLeft() and UIParent:GetRight() then - local framescale = frame.GetScale and frame:GetScale() or 1; - ret = (frame:GetLeft()* framescale + frame:GetRight() - * framescale - UIParent:GetLeft() - UIParent:GetRight()) / 2; - end - end - - return ret -end - ---[[ local -NAME: SetPosition -DESC: Adjust a given frame with the passed in values. -VAR: frame - Text string of the frame name -VAR: ... - list of frame position info -NOTE: -Swiped & modified from Vrul on wowinterface forum (https://www.wowinterface.com/forums/showthread.php?t=56519) - -The table UIPARENT_MANAGED_FRAME_POSITIONS does not hold all Blizzard frames. -It is cleared for each frame in case the frame is in or might be in the table in the future. - -Titan does not control the frames as other addons so we honor a user placed frame -:NOTE ---]] -local function SetPosition(frame, ...) - ---[===[ - local fname = frame:GetName() - local um = false - if f_list[fname] and f_list[fname].user_movable then - um = true - else - um = false - end - - if type(frame) == 'string' then - UIPARENT_MANAGED_FRAME_POSITIONS[frame] = nil - frame = _G[frame] - end - if type(frame) == 'table' and type(frame.IsObjectType) == 'function' and frame:IsObjectType('Frame') then - if um then - -- Back off if the user has moved them via the UI - else - -- Titan does not set in case the user needs to - UIPARENT_MANAGED_FRAME_POSITIONS[fname] = nil - end - - frame:SetMovable(true) -- allow frame to move --- Titan honors a user placed frame so we don't need this --- frame:SetUserPlaced(true) -- tell Blizzard to back off --- Since Titan adjusts rather than controls some frames, --- Titan does not need to set these --- frame:SetDontSavePosition(true) --- frame:SetAttribute('ignoreFramePositionManager', true) --- frame.ignoreFramePositionManager = true - if ... then - frame:ClearAllPoints() - frame:SetPoint(...) - end - -- Need to add in case user (not an addon) wants to move this frames - if um then - -- do nothing - else - frame:SetMovable(false) -- lock frame from moving - end - end ---]===] - if type(frame) == 'string' then --- UIPARENT_MANAGED_FRAME_POSITIONS[frame] = nil - frame = _G[frame] - end - if ... then - frame:ClearAllPoints() - frame:SetPoint(...) - end - -end - ---[[ local -NAME: CheckConflicts -DESC: Check for other addons that control UI elements. Tell Titan to back off the frames the addon controls or can control. -VAR: <none> -NOTE: -This is messy routine because the internals of each addon must be known to check for the frames that are controlled. -Some addons use different names where Titan uses the Blizzard frame names -:NOTE ---]] -local function CheckConflicts() - local addon = "Bartender4" - if (IsAddOnLoaded(addon)) then -- user has enabled --- TitanDebug (addon.." active : Titan will not adjust frames that "..addon.." could control") - -- Check would be : BT4Bar<BT bar name>.config.enabled to check if the frame exists and if it is enabled in BT4 - TitanMovable_AddonAdjust("MainMenuBar", true) - TitanMovable_AddonAdjust("MicroButtonAndBagsBar", true) - TitanMovable_AddonAdjust("MultiBarRight", true) - TitanMovable_AddonAdjust("ExtraActionBarFrame", true) - TitanMovable_AddonAdjust("OverrideActionBar", true) -- not sure about this one... - end - addon = "ElvUI" - if (IsAddOnLoaded(addon)) then -- user has enabled --- TitanDebug (addon.." active : Titan will not adjust frames that "..addon.." could control") - -- ElvUI controls the whole UI - TitanMovable_AddonAdjust("PlayerFrame", true) - TitanMovable_AddonAdjust("TargetFrame", true) - TitanMovable_AddonAdjust("PartyMemberFrame1", true) - TitanMovable_AddonAdjust("TicketStatusFrame", true) - TitanMovable_AddonAdjust("BuffFrame", true) - TitanMovable_AddonAdjust("MinimapCluster", true) - TitanMovable_AddonAdjust("MultiBarRight", true) - TitanMovable_AddonAdjust("OverrideActionBar", true) - TitanMovable_AddonAdjust("MicroButtonAndBagsBar", true) - TitanMovable_AddonAdjust("MainMenuBar", true) - TitanMovable_AddonAdjust("ExtraActionBarFrame", true) - end -end - ---[[ local -NAME: MoveFrame -DESC: Adjust the given frame. Expected are frames where :GetPoint works -VAR: frame_ptr - Text string of the frame name -VAR: start_y - Any offset due to the specific frame -VAR: top_bottom - Frame is at top or bottom, expecting Titan constant for top or bottom -VAR: force - Force the adjust; passed through -OUT: None ---]] -local function MoveFrame(frame_ptr, start_y, top_bottom, force) - local frame = _G[frame_ptr] - local y = 0 - local op = "?" - - if frame and (frame:IsUserPlaced() or - frame.MALockPointHook -- Allow MoveAnything to be used w/o error - ) - then - -- skip this frame - op = "skip - MoveAnything" - else - if DoAdjust(top_bottom, force) and frame:IsShown() then - local scale = TitanPanelGetVar("Scale") - y = TitanMovable_GetPanelYOffset(top_bottom) - + (start_y or 0) - local point, relativeTo, relativePoint, xOfs, yOfs = frame:GetPoint() - -- check for nil which will cause an error - if point and relativeTo and relativePoint and xOfs then -- do not care about yOfs - -- should be safe... - SetPosition(frame, point, relativeTo:GetName(), relativePoint, xOfs, y) - op = "move - y "..tostring(y) - else - op = "skip - :GetPoint invalid" - -- do not proceed - end - else - --[[ - Some frames such as the ticket frame may not be visible or even created - --]] - op = "skip - adj "..tostring(DoAdjust(top_bottom, force)).." shown "..tostring(frame:IsShown()) - end - end - - if f_list[frame_ptr] and f_list[frame_ptr].debug then - TitanDebug ("MoveFrame" - .." "..tostring(frame_ptr) - .." "..tostring(op) - ) - end -end - ---[[ local -NAME: MoveMenuFrame -DESC: Adjust the MainMenuBar frame. Needed because :GetPoint does NOT always work for MainMenuBar. -This is modeled after MoveFrame to keep it similar. -Titan sets the IsUserPlaced for the MainMenuBar frame so Titan needs to adjust. -VAR: frame_ptr - Text string of the frame name -VAR: start_y - Any offset due to the specific frame -VAR: top_bottom - Frame is at top or bottom, expecting Titan constant for top or bottom -VAR: force - Force the adjust; passed through -OUT: None ---]] -local function MoveMenuFrame(frame_ptr, start_y, top_bottom, force) - local frame = _G[frame_ptr] - local adj = false - if frame and (frame:IsUserPlaced() - or frame.MALockPointHook -- Allow MoveAnything to be used w/o error - ) - and DoAdjust(top_bottom, force) - then - local yOffset = TitanMovable_GetPanelYOffset(top_bottom) -- includes scale adjustment - + VisibleBars() - local xOfs = TitanPanelGetVar("MainMenuBarXAdj") - - SetPosition(frame, "BOTTOM", "UIParent", "BOTTOM", xOfs, yOffset) - adj = true - else - -- Unknown frame... - end -end - ---[[ Titan -NAME: Titan_FCF_UpdateDockPosition -DESC: Secure post hook to help adjust the chat / log frame. -VAR: None -OUT: None -NOTE: -- This is required because Blizz adjusts the chat frame relative to other frames so some of the Blizz code is copied. -- If in combat or if the user has moved the chat frame then no action is taken. -- The frame is adjusted in the Y axis only. -- See See FCF_UpdateDockPosition if this is no longer working - This routine may need to change. -:NOTE ---]] -local function Titan_FCF_UpdateDockPosition() -- See FCF_UpdateDockPosition - if not Titan__InitializedPEW - or not TitanPanelGetVar("LogAdjust") - or TitanPanelGetVar("AuxScreenAdjust") then - return - end - - if not InCombatLockdown() or (InCombatLockdown() - and not _G["DEFAULT_CHAT_FRAME"]:IsProtected()) then - local panelYOffset = TitanMovable_GetPanelYOffset(TITAN_PANEL_PLACE_BOTTOM); - local scale = TitanPanelGetVar("Scale"); - if scale then - panelYOffset = panelYOffset + (24 * scale) -- after 3.3.5 an additional adjust was needed. why? idk - end - - if ( DEFAULT_CHAT_FRAME:IsUserPlaced() ) then - return; - end - - local chatOffset = 85 + panelYOffset; -- Titan change to adjust Y offset - if ( GetNumShapeshiftForms() > 0 or HasPetUI() or PetHasActionBar() ) then - if ( MultiBarBottomLeft:IsShown() ) then - chatOffset = chatOffset + 55; - else - chatOffset = chatOffset + 15; - end - elseif ( MultiBarBottomLeft:IsShown() ) then - chatOffset = chatOffset + 15; - end - DEFAULT_CHAT_FRAME:SetPoint("BOTTOMLEFT", "UIParent", "BOTTOMLEFT", - 32, chatOffset); - FCF_DockUpdate(); - end -end - ---[[ Titan -NAME: Titan_ContainerFrames_Relocate -DESC: Secure post hook to help adjust the bag frames. -VAR: None -OUT: None -NOTE: -- The frame is adjusted in the Y axis only. -- The Blizz routine "ContainerFrames_Relocate" should be examined for any conditions it checks and any changes to the SetPoint. -If Blizz changes the anchor points the SetPoint here must change as well!! -The Blizz routine calculates X & Y offsets to UIParent (screen) so there is not need to store the prior offsets. -Like the Blizz routine we search through the visible bags. Unlike the Blizz routine we only care about the first of each column to adjust for Titan. -This way the Blizz code does not need to be copied here. -:NOTE ---]] -local function Titan_ContainerFrames_Relocate() - if not TitanPanelGetVar("BagAdjust") then - return - end - - local panelYOffset = TitanMovable_GetPanelYOffset(TITAN_PANEL_PLACE_BOTTOM) - local off_y = 10000 -- something ridiculously high - local bottom_y = 0 - local right_x = 0 - local frame = {} - - for index, frameName in ipairs(ContainerFrame1.bags) do - frame = _G[frameName]; - if frame:GetBottom() then bottom_y = frame:GetBottom() end - if ( bottom_y < off_y ) then - -- Start a new column - right_x = frame:GetRight() - frame:ClearAllPoints(); - frame:SetPoint("BOTTOMRIGHT", frame:GetParent(), - "BOTTOMLEFT", -- changed because we are taking the current x value - right_x, -- x is not adjusted - bottom_y + panelYOffset -- y - ) - end - off_y = bottom_y - end -end - -local function calc_bars() -- extra action button - local res = 0 - local out = "" - local main = 0 - local left = 0 - local pet = 0 - local stance = 0 - local cast = 0 - local poss = 0 - local vehicle = 0 - -- This covers the basic UI where there is no pet or extras - if MainMenuBar and MainMenuBar:IsShown() then - main = MainMenuBar:GetHeight() - out = MainMenuBar - end - -- Add the left bottom; the right bottom does not change Y - if MultiBarBottomLeft and MultiBarBottomLeft:IsShown() then - left = MultiBarBottomLeft:GetHeight() - out = MainMenuBar - end - -- These should be mutually exclusive... - if PetActionBarFrame and PetActionBarFrame:IsShown() then - pet = PetActionBarFrame:GetHeight(); - out = PetActionBarFrame - end - if StanceBarFrame and StanceBarFrame:IsShown() then - stance = StanceBarFrame:GetHeight(); - out = StanceBarFrame - end - if MultiCastActionBarFrame and MultiCastActionBarFrame:IsShown() then - cast = MultiCastActionBarFrame:GetHeight(); - out = MultiCastActionBarFrame - end - if PossessBarFrame and PossessBarFrame:IsShown() then - poss = PossessBarFrame:GetHeight(); - out = PossessBarFrame - end - if MainMenuBarVehicleLeaveButton and MainMenuBarVehicleLeaveButton:IsShown() then - vehicle = MainMenuBarVehicleLeaveButton:GetHeight(); - out = MainMenuBarVehicleLeaveButton - end - - res = main + left + pet + stance + cast + poss + vehicle - - return res -end -XXZZ_calc_bars = calc_bars - ---[[ local -NAME: MData table -DESC: MData is a local table that holds each frame Titan may need to adjust. It controls the offsets needed to make room for the Titan bar(s). -Each frame can be adjusted by modifying its 'move' function. -The f_list and MData MUST have matching index so the name and move function correspond. -Each record contains: -move - function to adjust that frame -addonAdj - true if another addon is taking responsibility of adjusting this frame, if false Titan will use the user settings to adjust or not -:DESC -NOTE: -- f_list MUST have frame name as the index so the extra data can be used. -- MoveFrame calculates and offsets for the Titan bars, if shown -- When calculating the initial Y offset, consider the points and relative points of the frame being adjusted. See the move function for specific frame adjustments -- Of course Blizzard had to make the MainMenuBar act differently <sigh>. :GetPoint() does not work on it so a special helper routine was needed. -- The move function sets info in the frame itself. It so inside the move because some frames, such as the ticket frame, may not be created until needed. -:NOTE ---]] - ---[[ Frames to find or remove - [1] = { - frameName = "PlayerFrame", - move = function (force) - MoveFrame("PlayerFrame", 0, TITAN_PANEL_PLACE_TOP, force) - end, - addonAdj = false, }, - [2] = { - frameName = "TargetFrame", - move = function (force) - MoveFrame("TargetFrame", 0, TITAN_PANEL_PLACE_TOP, force) - end, - addonAdj = false, }, - [3] = { - frameNameNA = "PartyMemberFrame1", - move = function (force) - MoveFrame("PartyMemberFrame1", 0, TITAN_PANEL_PLACE_TOP, force) - end, - addonAdj = false, }, - [4] = { - frameName = "TicketStatusFrame", - move = function (force) - MoveFrame("TicketStatusFrame", 0, TITAN_PANEL_PLACE_TOP, force) - end, - addonAdj = false, }, - [5] = { - frameName = "BuffFrame", - move = function (force) - -- The main frames have no adjustment (tops align) to UIParent. - -- But we need to properly adjust for - -- 1) When user does not use either top bar - -- 2) Y if GM Ticket is visible - - -- Use IsShown rather than IsVisible. In some cases (after closing - -- full screen map) the ticket may not yet be visible. - local yOffset = 0 - local y = TitanMovable_GetPanelYOffset(TITAN_PANEL_PLACE_TOP) - if y == 0 then - -- covers case where user disables both top bars - yOffset = BUFF_FRAME_BASE_EXTENT -- From BuffFrame.lua - * -1 -- adjust 'down' on screen - else - if TicketStatusFrame:IsShown() - and TitanPanelGetVar("TicketAdjust") - then - yOffset = (-TicketStatusFrame:GetHeight()) - else - yOffset = TitanPanelGetVar("BuffIconVerticalAdj") -- -13 (8.x) - end - end - MoveFrame("BuffFrame", yOffset, TITAN_PANEL_PLACE_TOP, force) - end, - addonAdj = false, }, - [6] = { - frameName = "MinimapCluster", - move = function (force) - local yOffset = 0 - if MinimapBorderTop - and not MinimapBorderTop:IsShown() then - yOffset = yOffset + (MinimapBorderTop:GetHeight() * 3/5) - 5 - end - MoveFrame("MinimapCluster", yOffset, TITAN_PANEL_PLACE_TOP, force) - end, - addonAdj = false, }, - [7] = { - frameName = "MultiBarRight", - move = function (force) - MoveFrame("MultiBarRight", 0, TITAN_PANEL_PLACE_BOTTOM, force) - end, - addonAdj = false, }, - [8] = { - frameName = "MicroButtonAndBagsBar", - move = function (force) - MoveFrame("MicroButtonAndBagsBar", 0, TITAN_PANEL_PLACE_BOTTOM, force) - end, - addonAdj = false, }, - [9] = { - frameName = "MainMenuBar", -- MainMenuBar - move = function (force) - MoveMenuFrame("MainMenuBar", 0, TITAN_PANEL_PLACE_BOTTOM, force) - end, - addonAdj = false, }, - [10] = { - frameName = "ExtraActionBarFrame", - move = function (force) - -- Only spend cycles if the frame is shown. - if ExtraActionBarFrame - and ExtraActionBarFrame:IsShown() then - --[=[ - Need to calc Y because Y depends on what else is shown - The extra action button is calculated from the center of the screen so this needs more effort than the other buttons - Look at UIParent.lua for logic (UIParent_ManageFramePosition) - --]=] - local actionBarOffset = 45; - local menuBarTop = 55; - local overrideActionBarTop = 40; - local petBattleTop = 60; - - local start_y = ExtraAbilityContainer:GetHeight() -- 18 -- FramePositionDelegate:UIParentManageFramePositions - local rel_start = UIParent:GetHeight() / 2 -- CENTER of UIParent - local yOfs = 0 - local yOfs1 = 0 - yOfs = (rel_start * -1) -- bottom of screen - + calc_bars() -- offset of WoW bars shown - + start_y -- center of extra action button - MoveFrame("ExtraAbilityContainer", yOfs, TITAN_PANEL_PLACE_BOTTOM, force) - end - end, - addonAdj = false, }, ---]] -local MData = { - [1] = { }, - [2] = { }, - [3] = { }, - [4] = { }, - [5] = { }, - [6] = { }, - [7] = { }, - [8] = { }, - [9] = { }, - [10] = { }, -} - ---[[ Titan -NAME: TitanMovable_AddonAdjust -DESC: Set the given frame to be adjusted or not by another addon. This is called from TitanUtils for a developer API. -VAR: frame - frame name (string) -VAR: bool - true (addon will adjust) or false (Titan will use its settings) -OUT: None ---]] -function TitanMovable_AddonAdjust(frame, bool) - for i = 1,#MData,1 do - local fData = MData[i] - local fName = nil - if fData.frameName then - fName = fData.frameName; - end - - if (frame == fName) then - fData.addonAdj = bool - end - end -end ---]====] - local function Titan_AdjustFrame(frame_str, flag, offset) local frame = _G[frame_str] local point, relativeTo, relativePoint, xOfs, yOfs = frame:GetPoint() @@ -781,16 +44,6 @@ local function Titan_AdjustFrame(frame_str, flag, offset) op = "skip - :GetPoint invalid" -- do not proceed end ---[[ -print("T_Movable _AdjustFrame" -.." "..tostring(frame_str) -.." flag "..tostring(TitanPanelGetVar(flag)) -.." x"..tostring(xOfs) -.." y"..tostring(yOfs) -.." "..tostring(TitanPanelGetVar(offset)) -.." "..tostring(frame.original_y) -) ---]] end --[[ API @@ -845,206 +98,6 @@ function TitanMovable_GetPanelYOffset(framePosition) -- used by other addons return 0 end ---[[ Titan -NAME: Titan_AdjustScale -DESC: Update the bars and plugins to the user selected scale. -VAR: None -OUT: None -NOTE: -- Ensure Titan has done its initialization before this is run. -:NOTE ---]] -function Titan_AdjustScale() - -- Only adjust if Titan is fully initialized - if Titan__InitializedPEW then - TitanPanel_SetScale(); - - TitanPanel_ClearAllBarTextures() - TitanPanel_CreateBarTextures() - - for idx,v in pairs (TitanBarData) do - TitanPanel_SetTexture(TITAN_PANEL_DISPLAY_PREFIX..TitanBarData[idx].name - , TITAN_PANEL_PLACE_TOP); - end - - TitanPanel_AdjustFrames(false, "_AdjustScale ") - TitanPanel_RefreshPanelButtons(); - end -end - ---[[ Titan -============= -NAME: Titan_Hook_* -DESC: Set of routines to front the adjust the frames routine. -VAR: None -OUT: None -NOTE: -This group of Titan_Hook_* is : -- to debug moving of frames when TitanPanel_AdjustFrames hooks trigger -- just in case there is specific processing needed per hook -- used when hooks and callbacks are needed - -These may be called from any Titan Panel code -:NOTE ---]] - ---[====[ - ---[[ local -NAME: TitanMovableFrame_MoveFrames -DESC: Loop through MData calling each frame's 'move' function for each Titan controlled frame. -Then update the chat and open bag frames. -OUT: None ---]] -local function TitanMovableFrame_MoveFrames(place, force) - local move_count = 0 -- debug - local str = "" -- debug - local force = force or false - --[[ - Setting the MainMenuBar as user placed is needed because in 8.0.0 because Blizzard changed something in the - way they controlled the frame. With Titan Panel and bottom bars enabled the MainMenuBar - would 'bounce'. Figuring out the true root cause was a bust. - This idea of user placed came from a Titan user who is an addon developer. - However setting user placed causes the main menu bar to not act as we desire due to the way Blizzard coded the bar. - For now we will try to minimize the side effects... - - Later Titan checks rely on the user placed flag so it needs to be set early. - --]] - if DoAdjust(TITAN_PANEL_PLACE_BOTTOM, force) then - TitanMovable_MenuBar_Enable() - end - - if not InCombatLockdown() then - for i = 1,#MData,1 do - if MData[i].frameName then - if MData[i].addonAdj then - -- An addon has taken control of the frame so skip - else - local md = MData[i] - if place == f_list[md.frameName].place or place == TITAN_PANEL_PLACE_BOTH then - -- Adjust the frame per MData - md.move(force) - end - end - end - end - - Titan_FCF_UpdateDockPosition(); -- chat - UpdateContainerFrameAnchors(); -- Move bags as needed - else - -- nothing to do - end -end - -function Titan_Hook_Frames() -- UIParent_ManageFramePositions hook - --[[ - This is the routine that will be called the most. It is the general purpose routine for WoW frames. - As Blizzard has changed (or in some cases added) ways to handle the various bars it has across expansions, - this routine has had to become more complex. - Especially to handle the main menu bar processing along with override bar which also handles 'in vehicle' bars. - The processing is needed to sometimes handle hiding or delaying Titan bars to not interfere with the normal WoW - bars - top or bottom. - - This can hide top or bottom bars to avoid conflicts visually or functionally with WoW bars. - When a normal adjust is requested, this calls TitanPanelBarButton_DisplayBarsWanted rather than - TitanPanel_AdjustFrames because bars to show bars that may have been hidden in a prior invocation. It is - a touch 'heavy' but will force bars back if hidden for any reason. - --]] --- TitanPanel_AdjustFrames(false, "Hook UIParent_ManageFramePositions ") - local reason = "Hook UIParent_* - " - --[[ - Code from ActionBarController.lua ActionBarController_UpdateAll modified for Titan - This hook relies on _UpdateAll calling UIParent_ManageFramePositions near the end of its processing - --]] - -- If we have a skinned vehicle bar - -- or skinned override bar then likely the OverrideActionBar is active - -- If user does not want bottom bar adjust do not hide the bottom bar for vehicles. - -- When a user is using an action bar replacement (Bartender or ElvUI), hiding the bottom bar may not make sense. - if ((HasVehicleActionBar() and UnitVehicleSkin("player") and UnitVehicleSkin("player") ~= "") - or (HasOverrideActionBar() and GetOverrideBarSkin() and GetOverrideBarSkin() ~= 0)) - then -- Override bar in place; hide Titan bottom bar(s) - if (TitanPanelGetVar("AuxScreenAdjust") == 1) then - -- do nothing, the user has turned off adjust - else - reason = reason.."skinned override bar" - TitanPanelBarButton_HideBottomBars() - - -- Blizzard could have updated player frame or other - TitanMovableFrame_MoveFrames(TITAN_PANEL_PLACE_TOP, false) - end - - -- If we have a non-skinned override bar of some sort, use the MainMenuBarArtFrame - elseif ( HasBonusActionBar() or HasOverrideActionBar() or HasVehicleActionBar() or HasTempShapeshiftActionBar() or C_PetBattles.IsInBattle() ) then - reason = reason.."non-skinned override bar" - -- BonusActionBar is rogue in stealth - -- TitanPanelBarButton_HideBottomBars() - elseif ( OrderHallCommandBar and OrderHallCommandBar:IsShown() ) then - reason = reason.."Order Hall bar" - -- Override bar in place; hide Titan bottom bar(s) - TitanPanelBarButton_HideAllBars() - else - if InCombatLockdown() or UnitVehicleSkin("player") then - reason = reason.."waiting..." - --[[ - wait until out of combat just in case... - Putting back a bar (especially bottom bar) in combat could cause the - main menu bar to not work as expected. - --]] - else - reason = reason.."Adjust" - -- Overkill but bottom bars could have been hidden - TitanPanelBarButton_DisplayBarsWanted("Hook _Frames*") - end - end - - if TITAN_PANEL_VARS.debug.movable then - TitanDebug (tostring(reason) - .." c: "..tostring(InCombatLockdown()) - .." b1: "..tostring(TitanPanelGetVar("AuxBar_Show")) - .." b2: "..tostring(TitanPanelGetVar("AuxBar2_Show")) - .." vb+: "..tostring((HasVehicleActionBar() and UnitVehicleSkin("player") and UnitVehicleSkin("player") ~= "") and true or false) - .." ob+: "..tostring((HasOverrideActionBar() and GetOverrideBarSkin() and GetOverrideBarSkin() ~= 0) and true or false) - .." bb: "..tostring(HasBonusActionBar()) - .." ob: "..tostring(HasOverrideActionBar()) - .." sb: "..tostring(HasTempShapeshiftActionBar()) - .." pb: "..tostring(C_PetBattles.IsInBattle()) - ) - end -end - -function Titan_Hook_Ticket_Show() - TitanPanel_AdjustFrames(false, "Hook TicketStatusFrame Show ") -end - -function Titan_Hook_Ticket_Hide() - TitanPanel_AdjustFrames(false, "Hook TicketStatusFrame Hide ") -end - -function Titan_Hook_Target() - TitanPanel_AdjustFrames(false, "Hook TargetFrame_Update ") -end - -function Titan_Hook_Map() - TitanPanel_AdjustFrames(false, "Hook WorldMapFrame.BorderFrame.MaximizeMinimizeFrame.MinimizeButton ") -end - -function Titan_Hook_PEW() - TitanPanel_AdjustFrames(false, "Hook PEW Config timer") -end - -function Titan_Hook_SpecSwitch() - TitanPanel_AdjustFrames(false, "Hook SpecSwitch Config timer ") -end - -function Titan_Hook_MoveAdj() -- in config but not used - TitanPanel_AdjustFrames(false, "Hook MoveAdj Config timer ") -end - -function Titan_Hook_Vehicle() -- in config but not used - TitanPanel_AdjustFrames(false, "Hook Vehicle Config timer ") -end ---]====] - -- ============= --[[ Titan NAME: TitanPanel_AdjustFrames @@ -1064,24 +117,7 @@ function TitanPanel_AdjustFrames(force, reason) ) end - local f = false -- do not require the parameter - if force == true then -- but force it to be boolean - f = true - else - f = false - end - ---[[ -print("T_Movable" -.." "..tostring(hooks_done) -.." "..tostring(reason) -.." mb "..tostring(TitanPanelGetVar("MenuAndBagVerticalAdjOn")) -.." "..tostring(TitanPanelGetVar("MenuAndBagVerticalAdj")) -.." xp "..tostring(TitanPanelGetVar("XPBarVerticalAdjOn")) -.." "..tostring(TitanPanelGetVar("XPBarVerticalAdj")) -) ---]] --- DF no longer react to hooks - now react to PEW and config changes. +-- DF no longer react to hooks - now react to PEW and Titan user config changes. -- Adjust frame positions top and bottom based on user choices if hooks_done then if reason == "Init: PEW (Player Entering World)" @@ -1097,58 +133,12 @@ end --[[ Titan NAME: TitanMovable_SecureFrames -DESC: Once Titan is initialized create the post hooks we need to help adjust frames properly. +DESC: Once Titan is initialized get info we need to help adjust frames properly. VAR: None OUT: None -NOTE: -- The secure post hooks are required because Blizz adjusts frames Titan is interested in at times other than the events Titan registers for. -- This used to be inline code but was moved to a routine to avoid errors as Titan loaded. -:NOTE --]] function TitanMovable_SecureFrames() ---[===[ - ---[[ - if not TitanPanelAce:IsHooked("FCF_UpdateDockPosition", Titan_FCF_UpdateDockPosition) then - TitanPanelAce:SecureHook("FCF_UpdateDockPosition", Titan_FCF_UpdateDockPosition) -- FloatingChatFrame - end ---]] - if not TitanPanelAce:IsHooked("UIParent_ManageFramePositions", Titan_Hook_Frames) then - TitanPanelAce:SecureHook("UIParent_ManageFramePositions", Titan_Hook_Frames) -- UIParent.lua - TitanPanel_AdjustFrames(true, "Hook First UIParent_ManageFramePositions") - end - - if not TitanPanelAce:IsHooked(TicketStatusFrame, "Show", Titan_Hook_Ticket_Show) then - TitanPanelAce:SecureHook(TicketStatusFrame, "Show", Titan_Hook_Ticket_Show) -- HelpFrame.xml - TitanPanelAce:SecureHook(TicketStatusFrame, "Hide", Titan_Hook_Ticket_Hide) -- HelpFrame.xml --- TitanPanelAce:SecureHook("TargetFrame_Update", Titan_Hook_Target) -- TargetFrame.lua - --- DF no longer exists... --- TitanPanelAce:SecureHook("UpdateContainerFrameAnchors", Titan_ContainerFrames_Relocate) -- ContainerFrame.lua - - TitanPanelAce:SecureHook(WorldMapFrame.BorderFrame.MaximizeMinimizeFrame.MinimizeButton, "Show", Titan_Hook_Map) -- WorldMapFrame.lua - --- TitanPanelAce:SecureHook("OrderHall_CheckCommandBar", Titan_Hook_OrderHall) - end - - if not TitanPanelAce:IsHooked("VideoOptionsFrameOkay_OnClick", Titan_AdjustUIScale) then - --[[ - Properly Adjust UI Scale if set - Note: These are the least intrusive hooks we could think of, to properly adjust the Titan Bar(s) - without having to resort to a SetCvar secure hook. Any addon using SetCvar should make sure to use the 3rd - argument in the API call and trigger the CVAR_UPDATE event with an appropriate argument so that other addons - can detect this behavior and fire their own functions (where applicable). - --]] --- TitanPanelAce:SecureHook("VideoOptionsFrameOkay_OnClick", Titan_AdjustUIScale) -- VideoOptionsFrame.lua --- TitanPanelAce:SecureHook(VideoOptionsFrame, "Hide", Titan_AdjustUIScale) -- VideoOptionsFrame.xml - end - - -- Check for other addons that control UI frames. Tell Titan to back off of the frames these addons could control - CheckConflicts() - ---]===] - -- Save the original Y offest for the few frames the user may want to adjust via Titan local point, relativeTo, relativePoint, xOfs, yOfs, frame diff --git a/Titan/TitanPanel.lua b/Titan/TitanPanel.lua index 416effc..b39ee50 100644 --- a/Titan/TitanPanel.lua +++ b/Titan/TitanPanel.lua @@ -63,7 +63,6 @@ function TitanPanel_ResetToDefault() OnAccept = function(self) TitanVariables_UseSettings(TitanSettings.Player, TITAN_PROFILE_RESET); IsTitanPanelReset = true; ---TitanPanel_OkToReload() ReloadUI() end, showAlert = 1, @@ -236,22 +235,6 @@ function TitanSetPanelFont(fontname, fontsize) 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); - end -end ---]] - --[[ local NAME: TitanPanel_CreateABar DESC: Helper to create the Titan bar passed in. @@ -299,15 +282,9 @@ end -------------------------------------------------------------- -- -- Event registration ---_G[TITAN_PANEL_CONTROL]:RegisterEvent("ADDON_LOADED"); _G[TITAN_PANEL_CONTROL]:RegisterEvent("PLAYER_ENTERING_WORLD"); ---_G[TITAN_PANEL_CONTROL]:RegisterEvent("PLAYER_REGEN_DISABLED"); ---_G[TITAN_PANEL_CONTROL]:RegisterEvent("PLAYER_REGEN_ENABLED"); _G[TITAN_PANEL_CONTROL]:RegisterEvent("CVAR_UPDATE"); _G[TITAN_PANEL_CONTROL]:RegisterEvent("PLAYER_LOGOUT"); ---_G[TITAN_PANEL_CONTROL]:RegisterEvent("ACTIVE_TALENT_GROUP_CHANGED"); ---_G[TITAN_PANEL_CONTROL]:RegisterEvent("UNIT_ENTERED_VEHICLE"); ---_G[TITAN_PANEL_CONTROL]:RegisterEvent("UNIT_EXITED_VEHICLE"); _G[TITAN_PANEL_CONTROL]:SetScript("OnEvent", function(_, event, ...) _G[TITAN_PANEL_CONTROL][event](_G[TITAN_PANEL_CONTROL], ...) end) @@ -427,14 +404,6 @@ function TitanPanel_PlayerEnteringWorld() 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. --- DF With DragonFlight, no longer needed --- TitanMovable_AdjustTimer("EnterWorld") - end -------------------------------------------------------------- @@ -521,85 +490,6 @@ function TitanPanelBarButton:PLAYER_LOGOUT() Titan__InitializedPEW = nil end ---[====[ -function TitanPanelBarButton:PLAYER_REGEN_DISABLED() - -- If in combat close all control frames and menus - 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 - -function TitanPanelBarButton:PLAYER_REGEN_ENABLED() - --[[ - - Outside combat check to see if frames need correction - - Note: Quests can replace the main menu bar which hides Titan bottom bar(s)... - On completion / exit these may enable regen AFTER exiting the vehicle. - --]] - if TITAN_PANEL_VARS.debug.movable - or TITAN_PANEL_VARS.debug.events then - TitanDebug ("PLAYER_REGEN_ENABLED" - .." c: "..tostring(InCombatLockdown()) - .." v: "..tostring(UnitInVehicle("player")) - ) - end - - if InCombatLockdown() or UnitInVehicle("player") then - -- Wait for both to clear - else - TitanPanelBarButton_DisplayBarsWanted("PLAYER_REGEN_ENABLED") - end -end - -function TitanPanelBarButton:ACTIVE_TALENT_GROUP_CHANGED() - TitanMovable_AdjustTimer("DualSpec") -end - -function TitanPanelBarButton:UNIT_ENTERED_VEHICLE(self, ...) - if TITAN_PANEL_VARS.debug.movable - or TITAN_PANEL_VARS.debug.events then - TitanDebug ("UNIT_ENTERED_VEHICLE" - .." c: "..tostring(InCombatLockdown()) - .." v: "..tostring(UnitInVehicle("player")) - ) - end - TitanUtils_CloseAllControlFrames(); - TitanUtils_CloseRightClickMenu(); - - -- Needed because 8.0 made changes to the menu bar processing (see TitanMovable) - TitanMovable_MenuBar_Disable() - --[[ - 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, ...) - --[[ - - Note: Some quests replace the menu bar which cause Titan Panel to hide - bottom bar(s). So we need to be certain to make them appear again. - - A combat check will be done inside the adjust which may - FAIL because a regen enabled may come after this event. - --]] - if TITAN_PANEL_VARS.debug.movable - or TITAN_PANEL_VARS.debug.events then - TitanDebug ("UNIT_EXITED_VEHICLE" - .." c: "..tostring(InCombatLockdown()) - .." v: "..tostring(UnitInVehicle("player")) - ) - end - if InCombatLockdown() or UnitInVehicle("player") then - -- Wait for both to clear - else - TitanPanelBarButton_DisplayBarsWanted("UNIT_EXITED_VEHICLE") - end -end ---]====] -- function TitanPanelBarButton:PET_BATTLE_OPENING_START() -- TitanDebug("Pet_battle start: ") @@ -784,17 +674,7 @@ local function handle_giu_cmds(cmd_list) -- DF changed how options are called. The best I get is the Titan 'about', not deeper. Settings.OpenToCategory(TITAN_PANEL_CONFIG.topic.About, TITAN_PANEL_CONFIG.topic.scale) -- so the below does not work as expected... ---[[ - if p1 == "control" then - Settings.OpenToCategory(TITAN_PANEL_CONFIG.topic.About, TITAN_PANEL_CONFIG.topic.scale) - elseif p1 == "trans" then - Settings.OpenToCategory(TITAN_PANEL_CONFIG.topic.trans) - elseif p1 == "skin" then - Settings.OpenToCategory(TITAN_PANEL_CONFIG.topic.About, TITAN_PANEL_CONFIG.topic.skins) - else - handle_slash_help("gui") - end ---]] + end --[[ local @@ -1709,8 +1589,7 @@ function TitanPanelButton_Justify() local button = TitanUtils_GetButton(id); if button and button:GetWidth() then if TitanUtils_GetWhichBar(id) == bar then - if ( TitanPanelButton_IsIcon(id) - or (TitanGetVar(id, "DisplayOnRightSide")) ) then + if (TitanGetVar(id, "DisplayOnRightSide")) then rightWidth = rightWidth + icon_spacing + button:GetWidth(); @@ -1867,20 +1746,7 @@ local function TitanPanel_MainMenu() info.checked = glob --TitanAllGetVar("GlobalProfileUse") info.keepShownOnClick = nil TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); ---[[ - local player, server = TitanUtils_ParseName(TitanAllGetVar("GlobalProfileName")) - info = {}; - info.notCheckable = true - info.text = " "..TitanUtils_GetGreenText(server) - info.value = "server"; - TitanPanelRightClickMenu_AddButton(info); - info = {}; - info.notCheckable = true - info.text = " "..TitanUtils_GetGreenText(player) - info.value = "player"; - TitanPanelRightClickMenu_AddButton(info); ---]] end --[[ local @@ -2132,14 +1998,6 @@ local function TitanPanel_SettingsSelectionMenu() info.value = TitanPanelRightClickMenu_GetDropdMenuValue(); info.func = function() -- do not delete if current profile - .disabled ---[[ - local profilevalue, _, _ = TitanUtils_GetPlayer() - if info.value == profilevalue then - TitanPrint(L["TITAN_PANEL_ERROR_PROF_DELCURRENT"], "info") - TitanPanelRightClickMenu_Close(); - return; - end ---]] if TitanSettings.Players[info.value] then TitanSettings.Players[info.value] = nil; TitanPrint( @@ -2255,8 +2113,6 @@ OUT: string - "Right" or "Left" function TitanPanel_GetPluginSide(id) if ( TitanGetVar(id, "DisplayOnRightSide") ) then return TITAN_RIGHT; - elseif ( TitanPanelButton_IsIcon(id) ) then - return TITAN_RIGHT; else return TITAN_LEFT; end diff --git a/Titan/TitanPanel.xml b/Titan/TitanPanel.xml index 5a58554..f23171e 100644 --- a/Titan/TitanPanel.xml +++ b/Titan/TitanPanel.xml @@ -24,194 +24,9 @@ </Button> <Button name="Titan_Bar__Display_Template" frameStrata="DIALOG" toplevel="true" movable="true" parent="UIParent" virtual="true"> - <!-- Used for debug - may delete at some point - <ButtonText name="$parent_Text" inherits="GameFontNormalSmall" justifyH="LEFT"> - <Anchors> - <Anchor point="TOPLEFT" relativeTo="$parent" relativePoint="TOPLEFT"> - <Offset> - <AbsDimension x="1" y="-5" /> - </Offset> - </Anchor> - </Anchors> - </ButtonText> - --> </Button> <!-- - Each Titan bar has 3 components: - - Display - - Hider - - Auto hide plugin - --> - <Button name="Titan_Bar__Display_Bar" frameStrata="DIALOG" parent="UIParent" inherits="Titan_Bar__Display_Template"> - <Anchors> - <Anchor point="TOPLEFT" relativeTo="UIParent" relativePoint="TOPLEFT"> - <Offset> - <AbsDimension x="0" y="0"/> - </Offset> - </Anchor> - <Anchor point="BOTTOMRIGHT" relativeTo="UIParent" relativePoint="TOPRIGHT"> - <Offset> - <AbsDimension x="0" y="-24"/> - </Offset> - </Anchor> - </Anchors> - </Button> - <Button name="Titan_Bar__Hider_Bar" inherits="TitanPanelBarButtonHiderTemplate" hidden="false"> - <Anchors> - <Anchor point="TOPLEFT" relativeTo="UIParent" relativePoint="TOPLEFT"> - <Offset> - <AbsDimension x="0" y="0"/> - </Offset> - </Anchor> - <Anchor point="BOTTOMRIGHT" relativeTo="UIParent" relativePoint="TOPRIGHT"> - <Offset> - <AbsDimension x="0" y="-24"/> - </Offset> - </Anchor> - </Anchors> - </Button> - - <Button name="Titan_Bar__Display_Bar2" frameStrata="DIALOG" parent="UIParent" inherits="Titan_Bar__Display_Template"> - <Anchors> - <Anchor point="TOPLEFT" relativeTo="UIParent" relativePoint="TOPLEFT"> - <Offset> - <AbsDimension x="0" y="-24"/> - </Offset> - </Anchor> - <Anchor point="BOTTOMRIGHT" relativeTo="UIParent" relativePoint="TOPRIGHT"> - <Offset> - <AbsDimension x="0" y="-48"/> - </Offset> - </Anchor> - </Anchors> - </Button> - <Button name="Titan_Bar__Hider_Bar2" inherits="TitanPanelBarButtonHiderTemplate" hidden="false"> - <Anchors> - <Anchor point="TOPLEFT" relativeTo="UIParent" relativePoint="TOPLEFT"> - <Offset> - <AbsDimension x="0" y="-24"/> - </Offset> - </Anchor> - </Anchors> - </Button> - - <Button name="Titan_Bar__Display_AuxBar2" frameStrata="DIALOG" parent="UIParent" inherits="Titan_Bar__Display_Template"> - <Anchors> - <Anchor point="BOTTOMLEFT" relativeTo="UIParent" relativePoint="BOTTOMLEFT"> - <Offset> - <AbsDimension x="0" y="24"/> - </Offset> - </Anchor> - <Anchor point="TOPRIGHT" relativeTo="UIParent" relativePoint="BOTTOMRIGHT"> - <Offset> - <AbsDimension x="0" y="48"/> - </Offset> - </Anchor> - </Anchors> - </Button> - <Button name="Titan_Bar__Hider_AuxBar2" inherits="TitanPanelBarButtonHiderTemplate" hidden="false"> - <Anchors> - <Anchor point="TOPLEFT" relativeTo="UIParent" relativePoint="TOPLEFT"> - <Offset> - <AbsDimension x="0" y="-24"/> - </Offset> - </Anchor> - </Anchors> - </Button> - - <Button name="Titan_Bar__Display_AuxBar" frameStrata="DIALOG" parent="UIParent" inherits="Titan_Bar__Display_Template"> - <Anchors> - <Anchor point="BOTTOMLEFT" relativeTo="UIParent" relativePoint="BOTTOMLEFT"> - <Offset> - <AbsDimension x="0" y="0"/> - </Offset> - </Anchor> - <Anchor point="TOPRIGHT" relativeTo="UIParent" relativePoint="BOTTOMRIGHT"> - <Offset> - <AbsDimension x="0" y="24"/> - </Offset> - </Anchor> - </Anchors> - </Button> - <Button name="Titan_Bar__Hider_AuxBar" inherits="TitanPanelBarButtonHiderTemplate" hidden="false"> - <Anchors> - <Anchor point="TOPLEFT" relativeTo="UIParent" relativePoint="TOPLEFT"> - <Offset> - <AbsDimension x="0" y="-24"/> - </Offset> - </Anchor> - </Anchors> - </Button> - - <!-- - The Auto hide plugin must be wrapped in a frame for the code to work correctly. - --> - <Frame parent="UIParent"> - <Frames> - <Button name="TitanPanelAutoHide_BarButton" inherits="TitanPanelIconTemplate" frameStrata="FULLSCREEN" toplevel="true"> - <Scripts> - <OnLoad> - Titan_AutoHide_OnLoad(self); - TitanPanelButton_OnLoad(self); - </OnLoad> - <OnShow> - Titan_AutoHide_OnShow(self); - </OnShow> - <OnClick> - Titan_AutoHide_OnClick(self, button); - TitanPanelButton_OnClick(self, button); - </OnClick> - </Scripts> - </Button> - <Button name="TitanPanelAutoHide_Bar2Button" inherits="TitanPanelIconTemplate" frameStrata="FULLSCREEN" toplevel="true"> - <Scripts> - <OnLoad> - Titan_AutoHide_OnLoad(self); - TitanPanelButton_OnLoad(self); - </OnLoad> - <OnShow> - Titan_AutoHide_OnShow(self); - </OnShow> - <OnClick> - Titan_AutoHide_OnClick(self, button); - TitanPanelButton_OnClick(self, button); - </OnClick> - </Scripts> - </Button> - <Button name="TitanPanelAutoHide_AuxBar2Button" inherits="TitanPanelIconTemplate" frameStrata="FULLSCREEN" toplevel="true"> - <Scripts> - <OnLoad> - Titan_AutoHide_OnLoad(self); - TitanPanelButton_OnLoad(self); - </OnLoad> - <OnShow> - Titan_AutoHide_OnShow(self); - </OnShow> - <OnClick> - Titan_AutoHide_OnClick(self, button); - TitanPanelButton_OnClick(self, button); - </OnClick> - </Scripts> - </Button> - <Button name="TitanPanelAutoHide_AuxBarButton" inherits="TitanPanelIconTemplate" frameStrata="FULLSCREEN" toplevel="true"> - <Scripts> - <OnLoad> - Titan_AutoHide_OnLoad(self); - TitanPanelButton_OnLoad(self); - </OnLoad> - <OnShow> - Titan_AutoHide_OnShow(self); - </OnShow> - <OnClick> - Titan_AutoHide_OnClick(self, button); - TitanPanelButton_OnClick(self, button); - </OnClick> - </Scripts> - </Button> - </Frames> - </Frame> - <!-- These two frames are placed at the bottom of the top and top of the bottom to give addons a notion of what space Titan is using. diff --git a/Titan/TitanPanelTemplate.lua b/Titan/TitanPanelTemplate.lua index 9b8e445..600893a 100644 --- a/Titan/TitanPanelTemplate.lua +++ b/Titan/TitanPanelTemplate.lua @@ -267,18 +267,6 @@ local function TitanPanelButton_IsText(id) end end ---[[ Titan -NAME: TitanPanelButton_IsIcon -DESC: Is the given Titan plugin of type icon? -VAR: id - string name of the plugin -OUT: boolean ---]] -function TitanPanelButton_IsIcon(id) - if (TitanPanelButton_GetType(id) == TITAN_PANEL_BUTTON_TYPE_ICON) then - return 1; - end -end - --[[ local NAME: TitanPanelButton_IsCombo DESC: Is the given Titan plugin of type combo? @@ -291,6 +279,18 @@ local function TitanPanelButton_IsCombo(id) end end +--[[ Titan +NAME: TitanPanelButton_IsIcon +DESC: Is the given Titan plugin of type icon? +VAR: id - string name of the plugin +OUT: boolean +--]] +function TitanPanelButton_IsIcon(id) + if (TitanPanelButton_GetType(id) == TITAN_PANEL_BUTTON_TYPE_ICON) then + return 1; + end +end + --[[ local NAME: TitanPanelButton_IsCustom DESC: Is the given Titan plugin of type custom? @@ -485,7 +485,7 @@ VAR: value - the value OUT: string - encoded color string of text and value --]] function TitanOptionSlider_TooltipText(text, value) - return text .. " " .. GREEN_FONT_COLOR_CODE .. value .. FONT_COLOR_CODE_CLOSE; + return (text or "?") .. " " .. GREEN_FONT_COLOR_CODE .. value .. FONT_COLOR_CODE_CLOSE; end --[[ API @@ -663,35 +663,34 @@ function TitanPanelButton_OnClick(self, button, isChildButton) -- Used by plugin local position = TitanUtils_GetWhichBar(id) local scale = TitanPanelGetVar("Scale"); if (isControlFrameShown) then - local buttonCenter = (self:GetLeft() + self:GetRight()) / 2 * scale; - local controlFrameRight = buttonCenter + controlFrame:GetWidth() / 2; - local y_off = TITAN_PANEL_BAR_HEIGHT * scale - if ( position == TITAN_PANEL_PLACE_TOP ) then - controlFrame:ClearAllPoints(); - controlFrame:SetPoint("TOP", "UIParent", "TOPLEFT", buttonCenter, -y_off); - - -- Adjust control frame position if it's off the screen - local offscreenX, offscreenY = TitanUtils_GetOffscreen(controlFrame); - if ( offscreenX == -1 ) then - controlFrame:ClearAllPoints(); - controlFrame:SetPoint("TOPLEFT", "UIParent", "TOPLEFT", 0, -y_off); - elseif ( offscreenX == 1 ) then - controlFrame:ClearAllPoints(); - controlFrame:SetPoint("TOPRIGHT", "UIParent", "TOPRIGHT", 0, -y_off); - end - else + + -- Note: This uses anchor points to place the control frame relative to the plugin on the screen. + local parent = self:GetName() -- plugin with the control frame + local point = "" -- point of the control frame + local rel_point = "" -- The middle - top or bottom edge - of the plugin to anchor to + if ( position == TitanBarOrder[1] + or position == TitanBarOrder[2] ) then -- a top bar - is there a better check??? + point = "TOP" + rel_point = "BOTTOM" + else -- a bottom bar + point = "BOTTOM" + rel_point = "TOP" + end + + local x = 0 + local y = 0 + + controlFrame:ClearAllPoints(); + controlFrame:SetPoint(point.."LEFT", parent, rel_point, 0, 0) -- default left of plugin + + -- Adjust control frame position if it's off the screen + local offscreenX, offscreenY = TitanUtils_GetOffscreen(controlFrame); + if ( offscreenX == -1 ) then + -- Off to left of screen which should not happen... + elseif ( offscreenX == 1 ) then + -- off to right of screen, flip to right of plugin controlFrame:ClearAllPoints(); - controlFrame:SetPoint("BOTTOM", "UIParent", "BOTTOMLEFT", buttonCenter, y_off); - - -- Adjust control frame position if it's off the screen - local offscreenX, offscreenY = TitanUtils_GetOffscreen(controlFrame); - if ( offscreenX == -1 ) then - controlFrame:ClearAllPoints(); - controlFrame:SetPoint("BOTTOMLEFT", "UIParent", "BOTTOMLEFT", 0, y_off); - elseif ( offscreenX == 1 ) then - controlFrame:ClearAllPoints(); - controlFrame:SetPoint("BOTTOMRIGHT", "UIParent", "BOTTOMRIGHT", 0, y_off); - end + controlFrame:SetPoint(point.."RIGHT", parent, rel_point, 0, 0) end controlFrame:Show(); diff --git a/Titan/TitanUtils.lua b/Titan/TitanUtils.lua index 7fcfd30..37bbc5f 100644 --- a/Titan/TitanUtils.lua +++ b/Titan/TitanUtils.lua @@ -263,13 +263,15 @@ end --[[ API NAME: TitanUtils_ToRight DESC: See if the plugin is to be on the right. - There are 3 methods to place a plugin on the right: + These are the methods to place a plugin on the right: 1) DisplayOnRightSide saved variable logic (preferred) - 2) Create a plugin button using the TitanPanelIconTemplate - 3) Place a plugin in TITAN_PANEL_NONMOVABLE_PLUGINS (NOT preferred) + 2) Place a plugin in TITAN_PANEL_NONMOVABLE_PLUGINS (NOT preferred) :DESC VAR: None OUT: bool - true or nil. true if the plugin is to be placed on the right side of a bar. +NOTE: +- Using the Titan template TitanPanelIconTemplate used to enforce right side only but was removed during DragonFlight to give users more flexibility. +:NOTE --]] function TitanUtils_ToRight(id) local found = nil @@ -279,9 +281,7 @@ function TitanUtils_ToRight(id) end end - if TitanGetVar(id, "DisplayOnRightSide") - or TitanPanelButton_IsIcon(id) - then + if TitanGetVar(id, "DisplayOnRightSide") then found = true end @@ -708,15 +708,18 @@ function TitanUtils_ToString(text) return TitanUtils_Ternary(text, text, ""); end -------------------------------------------------- +-------------------------------------------------------------- +-- +-- Right click menu routines +-- --[[ 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. +Over time Titan used the menu routines written by Blizzard then 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. It also helps insulate 3rd party Titan plugin authors from Blizz or lib changes. --]] --[[ API @@ -760,19 +763,22 @@ VAR: level - level to put the line OUT: None --]] function TitanPanelRightClickMenu_AddToggleRightSide(id, level) - -- copy of TitanPanelRightClickMenu_AddToggleVar adding a remove button - local info = {}; - info.text = L["TITAN_CLOCK_MENU_DISPLAY_ON_RIGHT_SIDE"]; - info.value = {id, "DisplayOnRightSide"}; - info.func = function() - local bar = TitanUtils_GetWhichBar(id) - TitanPanelRightClickMenu_ToggleVar({id, "DisplayOnRightSide"}) - TitanPanel_RemoveButton(id); - TitanUtils_AddButtonOnBar(bar, id) - end - info.checked = TitanGetVar(id, "DisplayOnRightSide"); - info.keepShownOnClick = 1; - UIDropDownMenu_AddButton(info, level); + local plugin = TitanUtils_GetPlugin(id) + if plugin.controlVariables and plugin.controlVariables.DisplayOnRightSide then + -- copy of TitanPanelRightClickMenu_AddToggleVar adding a remove button + local info = {}; + info.text = L["TITAN_CLOCK_MENU_DISPLAY_ON_RIGHT_SIDE"]; + info.value = {id, "DisplayOnRightSide"}; + info.func = function() + local bar = TitanUtils_GetWhichBar(id) + TitanPanelRightClickMenu_ToggleVar({id, "DisplayOnRightSide"}) + TitanPanel_RemoveButton(id); + TitanUtils_AddButtonOnBar(bar, id) + end + info.checked = TitanGetVar(id, "DisplayOnRightSide"); + info.keepShownOnClick = 1; + UIDropDownMenu_AddButton(info, level); + end end --[[ API @@ -877,8 +883,10 @@ VAR: level - level to put the line OUT: None --]] function TitanPanelRightClickMenu_AddToggleIcon(id, level) - TitanPanelRightClickMenu_AddToggleVar(L["TITAN_PANEL_MENU_SHOW_ICON"], - id, "ShowIcon", nil, level); + local plugin = TitanUtils_GetPlugin(id) + if plugin.controlVariables and plugin.controlVariables.ShowIcon then + TitanPanelRightClickMenu_AddToggleVar(L["TITAN_PANEL_MENU_SHOW_ICON"], id, "ShowIcon", nil, level); + end end --[[ API @@ -889,8 +897,10 @@ VAR: level - level to put the line OUT: None --]] function TitanPanelRightClickMenu_AddToggleLabelText(id, level) - TitanPanelRightClickMenu_AddToggleVar(L["TITAN_PANEL_MENU_SHOW_LABEL_TEXT"], - id, "ShowLabelText", nil, level); + local plugin = TitanUtils_GetPlugin(id) + if plugin.controlVariables and plugin.controlVariables.ShowLabelText then + TitanPanelRightClickMenu_AddToggleVar(L["TITAN_PANEL_MENU_SHOW_LABEL_TEXT"], id, "ShowLabelText", nil, level); + end end --[[ API @@ -901,8 +911,10 @@ VAR: level - level to put the line OUT: None --]] function TitanPanelRightClickMenu_AddToggleColoredText(id, level) - TitanPanelRightClickMenu_AddToggleVar(L["TITAN_PANEL_MENU_SHOW_COLORED_TEXT"], - id, "ShowColoredText", nil, level); + local plugin = TitanUtils_GetPlugin(id) + if plugin.controlVariables and plugin.controlVariables.ShowColoredText then + TitanPanelRightClickMenu_AddToggleVar(L["TITAN_PANEL_MENU_SHOW_COLORED_TEXT"], id, "ShowColoredText", nil, level); + end end --[[ API @@ -1009,6 +1021,27 @@ function TitanPanelRightClickMenu_SetCustomBackdrop(frame) , 1); end +--[[ API +NAME: TitanPanelRightClickMenu_AddControlVars +DESC: Menu - add the set of options that are in the plugin registry control variables . +VAR: id - id of the plugin +OUT: None +NOTE: Assume top level only +--]] +function TitanPanelRightClickMenu_AddControlVars(id, hide_text) + local level = 1 -- assume top menu + TitanPanelRightClickMenu_AddSeparator(level) + + TitanPanelRightClickMenu_AddToggleIcon(id, level) + TitanPanelRightClickMenu_AddToggleLabelText(id, level) + TitanPanelRightClickMenu_AddToggleColoredText(id, level) + TitanPanelRightClickMenu_AddToggleRightSide(id, level) + + TitanPanelRightClickMenu_AddSpacer(); + TitanPanelRightClickMenu_AddCommand(L["TITAN_PANEL_MENU_HIDE"], TITAN_VOLUME_ID, TITAN_PANEL_MENU_FUNC_HIDE); +end + + -------------------------------------------------------------- -- -- Plugin manipulation routines diff --git a/TitanBag/TitanBag.lua b/TitanBag/TitanBag.lua index 3846d38..99467a9 100644 --- a/TitanBag/TitanBag.lua +++ b/TitanBag/TitanBag.lua @@ -7,6 +7,8 @@ -- ******************************** Constants ******************************* local _G = getfenv(0); local TITAN_BAG_ID = "Bag"; +local TITAN_BUTTON = "TitanPanel"..TITAN_BAG_ID.."Button" + local TITAN_BAG_THRESHOLD_TABLE = { Values = { 0.5, 0.75, 0.9 }, Colors = { HIGHLIGHT_FONT_COLOR, NORMAL_FONT_COLOR, ORANGE_FONT_COLOR, RED_FONT_COLOR }, @@ -92,10 +94,12 @@ print(ZZbags[21858].style) -- ******************************** Functions ******************************* +--[[ plugin -- ************************************************************************** -- NAME : TitanPanelBagButton_OnLoad() -- DESC : Registers the plugin upon it loading -- ************************************************************************** +--]] function TitanPanelBagButton_OnLoad(self) self.registry = { id = TITAN_BAG_ID, @@ -110,7 +114,6 @@ function TitanPanelBagButton_OnLoad(self) controlVariables = { ShowIcon = true, ShowLabelText = true, - ShowRegularText = false, ShowColoredText = true, DisplayOnRightSide = true, }, @@ -128,10 +131,12 @@ function TitanPanelBagButton_OnLoad(self) self:RegisterEvent("PLAYER_ENTERING_WORLD"); end +--[[ plugin -- ************************************************************************** -- NAME : TitanPanelBagButton_OnEvent() -- DESC : Parse events registered to plugin and act on them -- ************************************************************************** +--]] function TitanPanelBagButton_OnEvent(self, event, ...) if (event == "PLAYER_ENTERING_WORLD") and (not self:IsEventRegistered("BAG_UPDATE")) then self:RegisterEvent("BAG_UPDATE"); @@ -150,17 +155,20 @@ function TitanPanelBagButton_OnUpdate(self) self:SetScript("OnUpdate", nil) end +--[[ plugin -- ************************************************************************** -- NAME : TitanPanelBagButton_OnClick(button) -- DESC : Opens all bags on a LeftClick -- VARS : button = value of action -- ************************************************************************** +--]] function TitanPanelBagButton_OnClick(self, button) if (button == "LeftButton") then ToggleAllBags(); end end +--[[ -- ************************************************************************** -- NAME : isBag(id) -- DESC : Determine if this is a bag. Then check for a profession bag using its id @@ -171,6 +179,7 @@ end -- ************************************************************************** -- using GetItemInfo caused a 'script ran too long' error on Shadowlands ptr (9.x) although it worked in retail (8.x) -- GetItemInfoInstant returns the needed id and uses client files - no server call. +--]] local function isBag(bag_name, pos) --[[ print("isBag:" @@ -331,15 +340,18 @@ TitanDebug("GetButtonText: <<<") return L["TITAN_BAG_BUTTON_LABEL"], bagRichText; end +-- plugin function TitanPanelBagButton_GetButtonText(id) local strA, strB = GetButtonText(id) return strA, strB end +--[[ plugin -- ************************************************************************** -- NAME : TitanPanelBagButton_GetTooltipText() -- DESC : Display tooltip text -- ************************************************************************** +--]] function TitanPanelBagButton_GetTooltipText() local totalSlots, usedSlots, availableSlots; local returnstring = ""; @@ -417,10 +429,13 @@ function TitanPanelBagButton_GetTooltipText() return returnstring..TitanUtils_GetGreenText(L["TITAN_BAG_TOOLTIP_HINTS"]); end +--[[ plugin -- ************************************************************************** -- NAME : TitanPanelRightClickMenu_PrepareBagMenu() -- DESC : Display rightclick menu options +-- NOTE : Titan builds this name to call on right click -- ************************************************************************** +--]] function TitanPanelRightClickMenu_PrepareBagMenu() local info -- level 2 @@ -465,37 +480,37 @@ function TitanPanelRightClickMenu_PrepareBagMenu() info.checked = TitanUtils_Toggle(TitanGetVar(TITAN_BAG_ID, "CountProfBagSlots")); TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); - TitanPanelRightClickMenu_AddSpacer(); - TitanPanelRightClickMenu_AddToggleIcon(TITAN_BAG_ID); - TitanPanelRightClickMenu_AddToggleLabelText(TITAN_BAG_ID); - TitanPanelRightClickMenu_AddToggleColoredText(TITAN_BAG_ID); - TitanPanelRightClickMenu_AddToggleRightSide(TITAN_BAG_ID); - TitanPanelRightClickMenu_AddSpacer(); - TitanPanelRightClickMenu_AddCommand(L["TITAN_PANEL_MENU_HIDE"], TITAN_BAG_ID, TITAN_PANEL_MENU_FUNC_HIDE); + TitanPanelRightClickMenu_AddControlVars(TITAN_BAG_ID) end +--[[ -- ************************************************************************** -- NAME : TitanPanelBagButton_ShowUsedSlots() -- DESC : Set option to show used slots -- ************************************************************************** +--]] function TitanPanelBagButton_ShowUsedSlots() TitanSetVar(TITAN_BAG_ID, "ShowUsedSlots", 1); TitanPanelButton_UpdateButton(TITAN_BAG_ID); end +--[[ -- ************************************************************************** -- NAME : TitanPanelBagButton_ShowAvailableSlots() -- DESC : Set option to show available slots -- ************************************************************************** +--]] function TitanPanelBagButton_ShowAvailableSlots() TitanSetVar(TITAN_BAG_ID, "ShowUsedSlots", nil); TitanPanelButton_UpdateButton(TITAN_BAG_ID); end +--[[ -- ************************************************************************** -- NAME : TitanPanelBagButton_ToggleIgnoreProfBagSlots() -- DESC : Set option to count profession bag slots -- ************************************************************************** +--]] function TitanPanelBagButton_ToggleIgnoreProfBagSlots() TitanToggleVar(TITAN_BAG_ID, "CountProfBagSlots"); TitanPanelButton_UpdateButton(TITAN_BAG_ID); @@ -504,3 +519,32 @@ end function TitanPanelBagButton_ShowDetailedInfo() TitanToggleVar(TITAN_BAG_ID, "ShowDetailedInfo"); end + +-- ====== Create needed frames +local function Create_Frames() + if _G[TITAN_BUTTON] then + return -- if already created + end + + -- general container frame + local f = CreateFrame("Frame", nil, UIParent) +-- f:Hide() + + -- Titan plugin button + local window = CreateFrame("Button", TITAN_BUTTON, f, "TitanPanelComboTemplate") + window:SetFrameStrata("FULLSCREEN") + -- Using SetScript("OnLoad", does not work + TitanPanelBagButton_OnLoad(window); +-- TitanPanelButton_OnLoad(window); -- Titan XML template calls this... + + window:SetScript("OnEvent", function(self, event, ...) + TitanPanelBagButton_OnEvent(self, event, ...) + end) + window:SetScript("OnClick", function(self, button) + TitanPanelBagButton_OnClick(self, button); + TitanPanelButton_OnClick(self, button); + end) +end + + +Create_Frames() -- do the work diff --git a/TitanBag/TitanBag.toc b/TitanBag/TitanBag.toc index e2d02e5..0c2b04c 100644 --- a/TitanBag/TitanBag.toc +++ b/TitanBag/TitanBag.toc @@ -1,10 +1,10 @@ ## Interface: 100000 -## Title: Titan Panel [|cffeda55fBag|r] |cff00aa006.00.04.100000|r +## Title: Titan Panel [|cffeda55fBag|r] |cff00aa006.00.05.100000|r ## Notes: Adds bag and free slot information to Titan Panel ## Author: Titan Panel Development Team (http://www.titanpanel.org) ## SavedVariables: ## OptionalDeps: ## Dependencies: Titan -## Version: 6.00.04.100000 +## Version: 6.00.05.100000 ## X-Child-Of: Titan -TitanBag.xml +TitanBag.lua diff --git a/TitanBag/TitanBag.xml b/TitanBag/TitanBag.xml deleted file mode 100644 index 8ad97b1..0000000 --- a/TitanBag/TitanBag.xml +++ /dev/null @@ -1,23 +0,0 @@ -<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="TitanBag.lua"/> - <Frame parent="UIParent"> - <Frames> - <Button name="TitanPanelBagButton" inherits="TitanPanelComboTemplate" frameStrata="FULLSCREEN" toplevel="true"> - <Scripts> - <OnLoad> - TitanPanelBagButton_OnLoad(self); - TitanPanelButton_OnLoad(self); - </OnLoad> - <OnEvent> - TitanPanelBagButton_OnEvent(self, event, ...); - </OnEvent> - <OnClick> - TitanPanelBagButton_OnClick(self, button); - TitanPanelButton_OnClick(self, button); - </OnClick> - </Scripts> - </Button> - </Frames> - </Frame> -</Ui> \ No newline at end of file diff --git a/TitanClock/TitanClock.lua b/TitanClock/TitanClock.lua index 7bbd89f..fcf7685 100644 --- a/TitanClock/TitanClock.lua +++ b/TitanClock/TitanClock.lua @@ -1,11 +1,15 @@ +--[[ -- ************************************************************************** -- * TitanClock.lua -- * -- * By: The Titan Panel Development Team -- ************************************************************************** +--]] -- ******************************** Constants ******************************* TITAN_CLOCK_ID = "Clock"; +local TITAN_BUTTON = "TitanPanel"..TITAN_CLOCK_ID.."Button" + local TITAN_CLOCK_FORMAT_12H = "12H"; local TITAN_CLOCK_FORMAT_24H = "24H"; local TITAN_CLOCK_FRAME_SHOW_TIME = 0.5; @@ -18,10 +22,12 @@ local updateTable = {TITAN_CLOCK_ID, TITAN_PANEL_UPDATE_ALL }; local realmName = GetRealmName(); -- ******************************** Functions ******************************* +--[[ -- ************************************************************************** -- NAME : TitanPanelClockButton_OnLoad() -- DESC : Registers the plugin upon it loading -- ************************************************************************** +--]] function TitanPanelClockButton_OnLoad(self) self.registry = { id = TITAN_CLOCK_ID, @@ -34,7 +40,6 @@ function TitanPanelClockButton_OnLoad(self) controlVariables = { ShowIcon = false, ShowLabelText = true, - ShowRegularText = false, ShowColoredText = true, DisplayOnRightSide = true, }, @@ -42,6 +47,7 @@ function TitanPanelClockButton_OnLoad(self) OffsetHour = 0, Format = TITAN_CLOCK_FORMAT_12H, TimeMode = "Server", + ShowIcon = true, ShowLabelText = false, ShowColoredText = false, DisplayOnRightSide = 1, @@ -62,20 +68,24 @@ local function TitanPanelClockButton_GetColored(text) return label; end +--[[ -- ************************************************************************** -- NAME : TitanPanelClockButton_OnShow() -- DESC : Create repeating timer when plugin is visible -- ************************************************************************** +--]] function TitanPanelClockButton_OnShow() if not ClockTimer then ClockTimer = AceTimer.ScheduleRepeatingTimer("TitanPanelClock", TitanPanelPluginHandle_OnUpdate, 30, updateTable) end end +--[[ -- ************************************************************************** -- NAME : TitanPanelClockButton_OnHide() -- DESC : Destroy repeating timer when plugin is hidden -- ************************************************************************** +--]] function TitanPanelClockButton_OnHide() AceTimer.CancelTimer("TitanPanelClock", ClockTimer, true) ClockTimer = nil; @@ -106,15 +116,18 @@ function TitanPanelClockButton_OnClick(self, button) TitanPanelRightClickMenu_Close(); end ToggleCalendar() + elseif button == "LeftButton" then else TitanPanelButton_OnClick(self, button); end end +--[[ -- ************************************************************************** -- NAME : TitanPanelClockButton_GetButtonText() -- DESC : Display time on button based on set variables -- ************************************************************************** +--]] function TitanPanelClockButton_GetButtonText() local clocktime = ""; local labeltext = ""; @@ -225,10 +238,12 @@ function TitanPanelClockButton_GetTime(displaytype, offset) end +--[[ -- ************************************************************************** -- NAME : TitanPanelClockButton_GetTooltipText() -- DESC : Display tooltip text -- ************************************************************************** +--]] function TitanPanelClockButton_GetTooltipText() local _, clockTimeLocal = TitanPanelClockButton_GetTime ("Local", 0) local _, clockTimeServer = TitanPanelClockButton_GetTime ("Server", 0) @@ -250,10 +265,12 @@ function TitanPanelClockButton_GetTooltipText() TitanUtils_GetGreenText(L["TITAN_CLOCK_TOOLTIP_HINT3"]); end +--[[ -- ************************************************************************** -- NAME : TitanPanelClockControlSlider_OnEnter() -- DESC : Display slider tooltip -- ************************************************************************** +--]] function TitanPanelClockControlSlider_OnEnter(self) self.tooltipText = TitanOptionSlider_TooltipText(L["TITAN_CLOCK_CONTROL_TOOLTIP"], TitanPanelClock_GetOffsetText(TitanGetVar(TITAN_CLOCK_ID, "OffsetHour"))); GameTooltip:SetOwner(self, "ANCHOR_BOTTOMLEFT"); @@ -261,20 +278,24 @@ function TitanPanelClockControlSlider_OnEnter(self) TitanUtils_StopFrameCounting(self:GetParent()); end +--[[ -- ************************************************************************** -- NAME : TitanPanelClockControlSlider_OnLeave() -- DESC : Hide slider tooltip -- ************************************************************************** +--]] function TitanPanelClockControlSlider_OnLeave(self) self.tooltipText = nil; GameTooltip:Hide(); TitanUtils_StartFrameCounting(self:GetParent(), TITAN_CLOCK_FRAME_SHOW_TIME); end +--[[ -- ************************************************************************** -- NAME : TitanPanelClockControlSlider_OnShow() -- DESC : Display slider tooltip options -- ************************************************************************** +--]] function TitanPanelClockControlSlider_OnShow(self) _G[self:GetName().."Text"]:SetText(TitanPanelClock_GetOffsetText(TitanGetVar(TITAN_CLOCK_ID, "OffsetHour"))); _G[self:GetName().."High"]:SetText(L["TITAN_CLOCK_CONTROL_LOW"]); @@ -284,48 +305,15 @@ function TitanPanelClockControlSlider_OnShow(self) self:SetValueStep(0.5); self:SetObeyStepOnDrag(true) -- since 5.4.2 (Mists of Pandaria) self:SetValue(0 - TitanGetVar(TITAN_CLOCK_ID, "OffsetHour")); - - local position = TitanUtils_GetRealPosition(TITAN_CLOCK_ID); - local scale = TitanPanelGetVar("Scale"); - - --TitanPanelClockControlFrame:SetPoint("BOTTOMRIGHT", "TitanPanel" .. TitanUtils_GetWhichBar(TITAN_CLOCK_ID) .."Button", "TOPRIGHT", 0, 0); - if (position == TITAN_PANEL_PLACE_TOP) then - TitanPanelClockControlFrame:ClearAllPoints(); - if TitanGetVar(TITAN_CLOCK_ID, "DisplayOnRightSide") == 1 then - TitanPanelClockControlFrame:SetPoint("TOPLEFT", TITAN_PANEL_DISPLAY_PREFIX..TitanUtils_GetWhichBar(TITAN_CLOCK_ID), "BOTTOMLEFT", UIParent:GetRight() - TitanPanelClockControlFrame:GetWidth(), -4); - else - TitanPanelClockControlFrame:SetPoint("TOPLEFT", "TitanPanel" ..TITAN_CLOCK_ID.."Button", "BOTTOMLEFT", -10, -4 * scale); - -- Adjust frame position if it's off the screen - local offscreenX, offscreenY = TitanUtils_GetOffscreen(TitanPanelClockControlFrame); - if ( offscreenX == -1 ) then - TitanPanelClockControlFrame:SetPoint("TOPLEFT", "TitanPanel" ..TITAN_CLOCK_ID.."Button", "BOTTOMLEFT", 0, 0); - elseif ( offscreenX == 1 ) then - TitanPanelClockControlFrame:SetPoint("TOPRIGHT", "TitanPanel" ..TITAN_CLOCK_ID.."Button", "BOTTOMRIGHT", 0, 0); - end - end - else - TitanPanelClockControlFrame:ClearAllPoints(); - if TitanGetVar(TITAN_CLOCK_ID, "DisplayOnRightSide") == 1 then - TitanPanelClockControlFrame:SetPoint("BOTTOMLEFT", TITAN_PANEL_DISPLAY_PREFIX..TitanUtils_GetWhichBar(TITAN_CLOCK_ID), "TOPLEFT", UIParent:GetRight() - TitanPanelClockControlFrame:GetWidth(), 0); - else - TitanPanelClockControlFrame:SetPoint("BOTTOMLEFT", "TitanPanel" ..TITAN_CLOCK_ID.."Button", "TOPLEFT", -10, 4 * scale); - -- Adjust frame position if it's off the screen - local offscreenX, offscreenY = TitanUtils_GetOffscreen(TitanPanelClockControlFrame); - if ( offscreenX == -1 ) then - TitanPanelClockControlFrame:SetPoint("BOTTOMLEFT", "TitanPanel" ..TITAN_CLOCK_ID.."Button", "TOPLEFT", 0, 0); - elseif ( offscreenX == 1 ) then - TitanPanelClockControlFrame:SetPoint("BOTTOMRIGHT", "TitanPanel" ..TITAN_CLOCK_ID.."Button", "TOPRIGHT", 0, 0); - end - end - end - end +--[[ -- ************************************************************************** -- NAME : TitanPanelClockControlSlider_OnValueChanged(arg1) -- DESC : Display slider tooltip text -- VARS : arg1 = positive or negative change to apply -- ************************************************************************** +--]] function TitanPanelClockControlSlider_OnValueChangedWheel(self, a1) _G[self:GetName().."Text"]:SetText(TitanPanelClock_GetOffsetText(0 - self:GetValue())); local tempval = self:GetValue(); @@ -368,10 +356,12 @@ function TitanPanelClockControlSlider_OnValueChanged(self, a1) end end +--[[ -- ************************************************************************** -- NAME : TitanPanelClockControlCheckButton_OnShow() -- DESC : Define clock hour options -- ************************************************************************** +--]] function TitanPanelClockControlCheckButton_OnShow(self) TitanPanelClockControlCheckButtonText:SetText(L["TITAN_CLOCK_CHECKBUTTON"]); @@ -382,10 +372,12 @@ function TitanPanelClockControlCheckButton_OnShow(self) end end +--[[ -- ************************************************************************** -- NAME : TitanPanelClockControlCheckButton_OnClick() -- DESC : Toggle clock hour option -- ************************************************************************** +--]] function TitanPanelClockControlCheckButton_OnClick(self, button) if (self:GetChecked()) then TitanSetVar(TITAN_CLOCK_ID, "Format", TITAN_CLOCK_FORMAT_24H); @@ -399,10 +391,12 @@ function TitanPanelClockControlCheckButton_OnClick(self, button) TitanPanelButton_UpdateButton(TITAN_CLOCK_ID); end +--[[ -- ************************************************************************** -- NAME : TitanPanelClockControlCheckButton_OnEnter() -- DESC : Display clock hour option tooltip -- ************************************************************************** +--]] function TitanPanelClockControlCheckButton_OnEnter(self) self.tooltipText = L["TITAN_CLOCK_CHECKBUTTON_TOOLTIP"]; GameTooltip:SetOwner(self, "ANCHOR_BOTTOMLEFT"); @@ -410,21 +404,25 @@ function TitanPanelClockControlCheckButton_OnEnter(self) TitanUtils_StopFrameCounting(self:GetParent()); end +--[[ -- ************************************************************************** -- NAME : TitanPanelClockControlCheckButton_OnLeave() -- DESC : Hide clock hour option tooltip -- ************************************************************************** +--]] function TitanPanelClockControlCheckButton_OnLeave(self) self.tooltipText = nil; GameTooltip:Hide(); TitanUtils_StartFrameCounting(self:GetParent(), TITAN_CLOCK_FRAME_SHOW_TIME); end +--[[ -- ************************************************************************** -- NAME : TitanPanelClock_GetOffsetText(offset) -- DESC : Get hour offset value and return -- VARS : offset = hour offset from server time -- ************************************************************************** +--]] function TitanPanelClock_GetOffsetText(offset) if (offset > 0) then return TitanUtils_GetGreenText("+" .. tostring(offset)); @@ -435,10 +433,12 @@ function TitanPanelClock_GetOffsetText(offset) end end +--[[ -- ************************************************************************** -- NAME : TitanPanelClockControlFrame_OnLoad() -- DESC : Create clock option frame -- ************************************************************************** +--]] function TitanPanelClockControlFrame_OnLoad(self) _G[self:GetName().."Title"]:SetText(L["TITAN_CLOCK_CONTROL_TITLE"]); --[[ @@ -451,19 +451,23 @@ and set the values in the code (Lua) TitanPanelRightClickMenu_SetCustomBackdrop(self) end +--[[ -- ************************************************************************** -- NAME : TitanPanelClockControlFrame_OnUpdate(elapsed) -- DESC : If dropdown is visible, see if its timer has expired. If so, hide frame -- VARS : elapsed = <research> -- ************************************************************************** +--]] function TitanPanelClockControlFrame_OnUpdate(self, elapsed) TitanUtils_CheckFrameCounting(self, elapsed); end +--[[ -- ************************************************************************** -- NAME : TitanPanelRightClickMenu_PrepareClockMenu() -- DESC : Generate clock right click menu options -- ************************************************************************** +--]] function TitanPanelRightClickMenu_PrepareClockMenu() TitanPanelRightClickMenu_AddTitle(TitanPlugins[TITAN_CLOCK_ID].menuText); @@ -497,6 +501,29 @@ function TitanPanelRightClickMenu_PrepareClockMenu() info.checked = function() return TitanGetVar(TITAN_CLOCK_ID, "TimeMode") == "ServerAdjustedLocal" end TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); + info = {}; -- 12 or 24 hour format + info.text = L["TITAN_CLOCK_CHECKBUTTON"] + info.func = function() + if (TitanGetVar(TITAN_CLOCK_ID, "Format") == TITAN_CLOCK_FORMAT_12H) then + TitanSetVar(TITAN_CLOCK_ID, "Format", TITAN_CLOCK_FORMAT_24H); + else + TitanSetVar(TITAN_CLOCK_ID, "Format", TITAN_CLOCK_FORMAT_12H); + end + if ( ServerHourFormat[realmName] ) then + ServerHourFormat[realmName] = TitanGetVar(TITAN_CLOCK_ID, "Format"); + end + + TitanPanelButton_UpdateButton(TITAN_CLOCK_ID) + end + info.checked = function() + if (TitanGetVar(TITAN_CLOCK_ID, "Format") == TITAN_CLOCK_FORMAT_24H) then + return true + else + return false + end + end + TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); + TitanPanelRightClickMenu_AddSpacer(); info = {}; @@ -513,23 +540,15 @@ function TitanPanelRightClickMenu_PrepareClockMenu() info.keepShownOnClick = 1; TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); - info = {}; - info.text = L["TITAN_CLOCK_MENU_DISPLAY_ON_RIGHT_SIDE"]; - info.func = TitanPanelClockButton_ToggleRightSideDisplay; - info.checked = TitanGetVar(TITAN_CLOCK_ID, "DisplayOnRightSide"); - TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); - - TitanPanelRightClickMenu_AddToggleLabelText(TITAN_CLOCK_ID); - TitanPanelRightClickMenu_AddToggleColoredText(TITAN_CLOCK_ID); - - TitanPanelRightClickMenu_AddSpacer(); - TitanPanelRightClickMenu_AddCommand(L["TITAN_PANEL_MENU_HIDE"], TITAN_CLOCK_ID, TITAN_PANEL_MENU_FUNC_HIDE); + TitanPanelRightClickMenu_AddControlVars(TITAN_CLOCK_ID) end +--[[ -- ************************************************************************** -- NAME : TitanPanelClockButton_ToggleRightSideDisplay() -- DESC : Add clock button to bar -- ************************************************************************** +--]] function TitanPanelClockButton_ToggleRightSideDisplay() TitanToggleVar(TITAN_CLOCK_ID, "DisplayOnRightSide"); TitanPanel_RemoveButton(TITAN_CLOCK_ID); @@ -547,7 +566,6 @@ function TitanPanelClockButton_ToggleGameTimeFrameShown() end end - function TitanPanelClockButton_ToggleMapTime() TitanToggleVar(TITAN_CLOCK_ID, "HideMapTime"); if TimeManagerClockButton and TimeManagerClockButton:GetName() then @@ -558,3 +576,113 @@ function TitanPanelClockButton_ToggleMapTime() end end end + +-- ====== Create needed frames +local function Create_Frames() + if _G[TITAN_BUTTON] then + return -- if already created + end + + -- general container frame + local f = CreateFrame("Frame", nil, UIParent) +-- f:Hide() + + -- Titan plugin button + local window = CreateFrame("Button", TITAN_BUTTON, f, "TitanPanelTextTemplate") + window:SetFrameStrata("FULLSCREEN") + -- Using SetScript("OnLoad", does not work + TitanPanelClockButton_OnLoad(window); +-- TitanPanelButton_OnLoad(window); -- Titan XML template calls this... + + window:SetScript("OnShow", function(self) + TitanPanelClockButton_OnShow() + TitanPanelButton_OnShow(self) + end) + window:SetScript("OnHide", function(self) + TitanPanelClockButton_OnHide() + end) + window:SetScript("OnEvent", function(self, event, ...) + TitanPanelClockButton_OnEvent(self, event, ...) + end) + window:SetScript("OnClick", function(self, button) + TitanPanelClockButton_OnClick(self, button) + TitanPanelButton_OnClick(self, button) + end) + + +---[===[ + -- Config screen + local cname = "TitanPanelClockControlFrame" + local config = CreateFrame("Frame", cname, f, BackdropTemplateMixin and "BackdropTemplate") + config:SetFrameStrata("FULLSCREEN") -- FULLSCREEN + config:Hide() -- + config:SetWidth(90) + config:SetHeight(200) + + config:SetScript("OnShow", function(self) + end) + config:SetScript("OnEnter", function(self) + TitanUtils_StopFrameCounting(self) + end) + config:SetScript("OnLeave", function(self) + TitanUtils_StartFrameCounting(self, 0.5) + end) + config:SetScript("OnUpdate", function(self, elapsed) + TitanPanelClockControlFrame_OnUpdate(self, elapsed) + end) + + -- Config Title + local str = nil + local style = "GameFontNormalSmall" + str = config:CreateFontString(cname.."Title", "ARTWORK", style) + str:SetPoint("TOP", config, 0, -10) + + -- Config slider sections + local slider = nil + + -- Hours offset + local inherit = "TitanOptionsSliderTemplate" + local offset = CreateFrame("Slider", "TitanPanelClockControlSlider", config, inherit) + offset:SetPoint("TOP", config, 0, -40) + offset:SetScript("OnShow", function(self) + TitanPanelClockControlSlider_OnShow(self) + end) + offset:SetScript("OnValueChanged", function(self) + TitanPanelClockControlSlider_OnValueChanged(self, value) + end) + offset:SetScript("OnMouseWheel", function(self) + TitanPanelClockControlSlider_OnValueChangedWheel(self, delta) + end) + offset:SetScript("OnEnter", function(self) + TitanPanelClockControlSlider_OnEnter(self) + end) + offset:SetScript("OnLeave", function(self) + TitanPanelClockControlSlider_OnLeave(self) + end) + + -- 24 hour format + local hour = CreateFrame("CheckButton", "TitanPanelClockControlCheckButton", config, "InterfaceOptionsBaseCheckButtonTemplate") + hour:SetPoint("TOP", offset, "BOTTOM", -25, -20) + hour:SetWidth(24) + hour:SetHeight(24) + hour:SetScript("OnShow", function(self) + TitanPanelClockControlCheckButton_OnShow(self) + end) + hour:SetScript("OnClick", function(self) + TitanPanelClockControlCheckButton_OnClick(self, delta) + end) + hour:SetScript("OnEnter", function(self) + TitanPanelClockControlCheckButton_OnEnter(self) + end) + hour:SetScript("OnLeave", function(self) + TitanPanelClockControlCheckButton_OnLeave(self) + end) + + -- Now that the parts exist, initialize + TitanPanelClockControlFrame_OnLoad(config) + +--]===] +end + + +Create_Frames() -- do the work diff --git a/TitanClock/TitanClock.toc b/TitanClock/TitanClock.toc index f8bf4a6..c907ee9 100644 --- a/TitanClock/TitanClock.toc +++ b/TitanClock/TitanClock.toc @@ -1,10 +1,10 @@ ## Interface: 100000 -## Title: Titan Panel [|cffeda55fClock|r] |cff00aa006.00.04.100000|r +## Title: Titan Panel [|cffeda55fClock|r] |cff00aa006.00.05.100000|r ## Notes: Adds a clock to Titan Panel ## Author: Titan Panel Development Team (http://www.titanpanel.org) ## SavedVariables: ## OptionalDeps: ## Dependencies: Titan -## Version: 6.00.04.100000 +## Version: 6.00.05.100000 ## X-Child-Of: Titan -TitanClock.xml +TitanClock.lua diff --git a/TitanClock/TitanClock.xml b/TitanClock/TitanClock.xml deleted file mode 100644 index d3374ed..0000000 --- a/TitanClock/TitanClock.xml +++ /dev/null @@ -1,135 +0,0 @@ -<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="TitanClock.lua"/> - <Frame name="TitanPanelClockControlFrameTemplate" inherits="BackdropTemplate" virtual="true" hidden="true"> - <Size> - <AbsDimension x="90" y="200" /> - </Size> -<!-- -Blizzard decided to remove direct Backdrop API in 9.0 (Shadowlands) so inherit the template -and set the values in the code. ---> -<!-- - <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="5" top="5" bottom="5"/> - </BackgroundInsets> - </Backdrop> ---> - <Layers> - <Layer> - <FontString name="$parentTitle" inherits="GameFontNormalSmall"> - <Anchors> - <Anchor point="TOP"> - <Offset> - <AbsDimension x="0" y="-10" /> - </Offset> - </Anchor> - </Anchors> - </FontString> - </Layer> - </Layers> - <Frames> - <Slider name="TitanPanelClockControlSlider" inherits="TitanOptionsSliderTemplate"> - <Anchors> - <Anchor point="TOP"> - <Offset> - <AbsDimension x="0" y="-40"/> - </Offset> - </Anchor> - </Anchors> - <Scripts> - <OnShow> - TitanPanelClockControlSlider_OnShow(self); - </OnShow> - <OnValueChanged> - TitanPanelClockControlSlider_OnValueChanged(self, value); - </OnValueChanged> - <OnMouseWheel> - TitanPanelClockControlSlider_OnValueChangedWheel(self, delta); - </OnMouseWheel> - <OnEnter> - TitanPanelClockControlSlider_OnEnter(self); - </OnEnter> - <OnLeave> - TitanPanelClockControlSlider_OnLeave(self) - </OnLeave> - </Scripts> - </Slider> -<!-- DF made a change to the options templates -OptionsCheckButtonTemplate --> - <CheckButton name="TitanPanelClockControlCheckButton" inherits="InterfaceOptionsBaseCheckButtonTemplate"> - <Size> - <AbsDimension x="24" y="24"/> - </Size> - <Anchors> - <Anchor point="TOP" relativeTo="TitanPanelClockControlSlider" relativePoint="BOTTOM"> - <Offset> - <AbsDimension x="-25" y="-20"/> - </Offset> - </Anchor> - </Anchors> - <Scripts> - <OnShow> - TitanPanelClockControlCheckButton_OnShow(self); - </OnShow> - <OnClick> - TitanPanelClockControlCheckButton_OnClick(self, button); - </OnClick> - <OnEnter> - TitanPanelClockControlCheckButton_OnEnter(self); - </OnEnter> - <OnLeave> - TitanPanelClockControlCheckButton_OnLeave(self) - </OnLeave> - </Scripts> - </CheckButton> - </Frames> - <Scripts> - <OnLoad> - TitanPanelClockControlFrame_OnLoad(self); - </OnLoad> - <OnEnter> - TitanUtils_StopFrameCounting(self); - </OnEnter> - <OnLeave> - TitanUtils_StartFrameCounting(self, 0.5); - </OnLeave> - <OnUpdate> - TitanPanelClockControlFrame_OnUpdate(self, elapsed); - </OnUpdate> - </Scripts> - </Frame> - <Frame parent="UIParent" inherits="BackdropTemplate"> - <Frames> - <Button name="TitanPanelClockButton" inherits="TitanPanelTextTemplate" frameStrata="FULLSCREEN" toplevel="true"> - <Scripts> - <OnLoad> - TitanPanelClockButton_OnLoad(self); - TitanPanelButton_OnLoad(self); - </OnLoad> - <OnShow> - TitanPanelClockButton_OnShow(); - TitanPanelButton_OnShow(self); - </OnShow> - <OnHide> - TitanPanelClockButton_OnHide(); - </OnHide> - <OnEvent> - TitanPanelClockButton_OnEvent(self, event, ...); - </OnEvent> - <OnClick> - TitanPanelClockButton_OnClick(self, button); - </OnClick> - </Scripts> - </Button> - <Frame name="TitanPanelClockControlFrame" inherits="TitanPanelClockControlFrameTemplate" frameStrata="FULLSCREEN" toplevel="true" /> - </Frames> - </Frame> -</Ui> \ No newline at end of file diff --git a/TitanGold/TitanGold.lua b/TitanGold/TitanGold.lua index 3e3155c..ddd46c9 100644 --- a/TitanGold/TitanGold.lua +++ b/TitanGold/TitanGold.lua @@ -8,6 +8,7 @@ -- ******************************** Constants ******************************* local TITAN_GOLD_ID = "Gold"; +local TITAN_BUTTON = "TitanPanel"..TITAN_GOLD_ID.."Button" local TITAN_GOLD_COUNT_FORMAT = "%d"; local TITAN_GOLD_VERSION = TITAN_VERSION; local TITAN_GOLD_SPACERBAR = "-----------------------"; @@ -987,14 +988,7 @@ function TitanPanelRightClickMenu_PrepareGoldMenu() TitanPanelRightClickMenu_AddCommand(L["TITAN_GOLD_RESET_SESS_TEXT"], TITAN_GOLD_ID, "TitanPanelGoldButton_ResetSession"); - TitanPanelRightClickMenu_AddSeparator(); - TitanPanelRightClickMenu_AddToggleIcon(TITAN_GOLD_ID); - TitanPanelRightClickMenu_AddToggleLabelText(TITAN_GOLD_ID); - TitanPanelRightClickMenu_AddToggleColoredText(TITAN_GOLD_ID); - TitanPanelRightClickMenu_AddSeparator(); - - -- Generic function to toggle and hide - TitanPanelRightClickMenu_AddCommand(L["TITAN_PANEL_MENU_HIDE"], TITAN_GOLD_ID, TITAN_PANEL_MENU_FUNC_HIDE); + TitanPanelRightClickMenu_AddControlVars(TITAN_GOLD_ID) end -- Second (2nd) level for show / delete | sort by @@ -1207,3 +1201,35 @@ function TitanGold_ClearDB() }; StaticPopup_Show("TITANGOLD_CLEAR_DATABASE"); end + +-- ====== Create needed frames +local function Create_Frames() + if _G[TITAN_BUTTON] then + return -- if already created + end + + -- general container frame + local f = CreateFrame("Frame", nil, UIParent) +-- f:Hide() + + -- Titan plugin button + local window = CreateFrame("Button", TITAN_BUTTON, f, "TitanPanelComboTemplate") + window:SetFrameStrata("FULLSCREEN") + -- Using SetScript("OnLoad", does not work + TitanPanelGoldButton_OnLoad(window); +-- TitanPanelButton_OnLoad(window); -- Titan XML template calls this... + + window:SetScript("OnShow", function(self) + TitanPanelGoldButton_OnShow(self); + TitanPanelButton_OnShow(self); + end) + window:SetScript("OnHide", function(self) + TitanPanelGoldButton_OnHide(self); + end) + window:SetScript("OnEvent", function(self, event, ...) + TitanGold_OnEvent(self, event, ...) + end) +end + + +Create_Frames() -- do the work diff --git a/TitanGold/TitanGold.toc b/TitanGold/TitanGold.toc index 3a9c26e..c70c97c 100644 --- a/TitanGold/TitanGold.toc +++ b/TitanGold/TitanGold.toc @@ -1,10 +1,10 @@ ## Interface: 100000 -## Title: Titan Panel [|cffeda55fGold|r] |cff00aa006.00.04.100000|r +## Title: Titan Panel [|cffeda55fGold|r] |cff00aa006.00.05.100000|r ## Notes: Keeps track of all gold held by a player's toons on a per server/faction basis. ## Author: Titan Panel Development Team (http://www.titanpanel.org) ## SavedVariables: GoldSave ## OptionalDeps: ## Dependencies: Titan -## Version: 6.00.04.100000 +## Version: 6.00.05.100000 ## X-Child-Of: Titan -TitanGold.xml +TitanGold.lua diff --git a/TitanGold/TitanGold.xml b/TitanGold/TitanGold.xml deleted file mode 100644 index e714411..0000000 --- a/TitanGold/TitanGold.xml +++ /dev/null @@ -1,26 +0,0 @@ -<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="TitanGold.lua"/> - <Frame parent="UIParent"> - <Frames> - <Button name="TitanPanelGoldButton" inherits="TitanPanelComboTemplate" frameStrata="FULLSCREEN" toplevel="true"> - <Scripts> - <OnLoad> - TitanPanelGoldButton_OnLoad(self); - TitanPanelButton_OnLoad(self); - </OnLoad> - <OnShow> - TitanPanelGoldButton_OnShow(); - TitanPanelButton_OnShow(self); - </OnShow> - <OnHide> - TitanPanelGoldButton_OnHide(); - </OnHide> - <OnEvent> - TitanGold_OnEvent(self, event, ...); - </OnEvent> - </Scripts> - </Button> - </Frames> - </Frame> -</Ui> \ No newline at end of file diff --git a/TitanLocation/TitanLocation.lua b/TitanLocation/TitanLocation.lua index cde8264..6b4b12c 100755 --- a/TitanLocation/TitanLocation.lua +++ b/TitanLocation/TitanLocation.lua @@ -8,6 +8,7 @@ -- ******************************** Constants ******************************* local _G = getfenv(0); local TITAN_LOCATION_ID = "Location"; +local TITAN_BUTTON = "TitanPanel"..TITAN_LOCATION_ID.."Button" local OFFSET_X = 0.0022 -- 0.0022; local OFFSET_Y = -0.0262 -- -0.0262; local cachedX = 0; @@ -382,13 +383,7 @@ function TitanPanelRightClickMenu_PrepareLocationMenu() info.hasArrow = 1; TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); - TitanPanelRightClickMenu_AddSpacer(); - TitanPanelRightClickMenu_AddToggleIcon(TITAN_LOCATION_ID); - TitanPanelRightClickMenu_AddToggleLabelText(TITAN_LOCATION_ID); - TitanPanelRightClickMenu_AddToggleColoredText(TITAN_LOCATION_ID); - TitanPanelRightClickMenu_AddToggleRightSide(TITAN_LOCATION_ID); - TitanPanelRightClickMenu_AddSpacer(); - TitanPanelRightClickMenu_AddCommand(L["TITAN_PANEL_MENU_HIDE"], TITAN_LOCATION_ID, TITAN_PANEL_MENU_FUNC_HIDE); + TitanPanelRightClickMenu_AddControlVars(TITAN_LOCATION_ID) end --[[ @@ -598,3 +593,40 @@ print("TLoc" end end + + +-- ====== Create needed frames +local function Create_Frames() + if _G[TITAN_BUTTON] then + return -- if already created + end + + -- general container frame + local f = CreateFrame("Frame", nil, UIParent) +-- f:Hide() + + -- Titan plugin button + local window = CreateFrame("Button", TITAN_BUTTON, f, "TitanPanelComboTemplate") + window:SetFrameStrata("FULLSCREEN") + -- Using SetScript("OnLoad", does not work + TitanPanelLocationButton_OnLoad(window); +-- TitanPanelButton_OnLoad(window); -- Titan XML template calls this... + + window:SetScript("OnShow", function(self) + TitanPanelLocationButton_OnShow(self); + TitanPanelButton_OnShow(self); + end) + window:SetScript("OnHide", function(self) + TitanPanelLocationButton_OnHide(self) + end) + window:SetScript("OnEvent", function(self, event, ...) + TitanPanelLocationButton_OnEvent(self, event, ...) + end) + window:SetScript("OnClick", function(self, button) + TitanPanelLocationButton_OnClick(self, button); + TitanPanelButton_OnClick(self, button); + end) +end + + +Create_Frames() -- do the work diff --git a/TitanLocation/TitanLocation.toc b/TitanLocation/TitanLocation.toc index c08e6aa..b3163ea 100644 --- a/TitanLocation/TitanLocation.toc +++ b/TitanLocation/TitanLocation.toc @@ -1,10 +1,10 @@ ## Interface: 100000 -## Title: Titan Panel [|cffeda55fLocation|r] |cff00aa006.00.04.100000|r +## Title: Titan Panel [|cffeda55fLocation|r] |cff00aa006.00.05.100000|r ## Notes: Adds coordinates and location information to Titan Panel ## Author: Titan Panel Development Team (http://www.titanpanel.org) ## SavedVariables: ## OptionalDeps: ## Dependencies: Titan -## Version: 6.00.04.100000 +## Version: 6.00.05.100000 ## X-Child-Of: Titan -TitanLocation.xml +TitanLocation.lua diff --git a/TitanLocation/TitanLocation.xml b/TitanLocation/TitanLocation.xml deleted file mode 100644 index 453e6d2..0000000 --- a/TitanLocation/TitanLocation.xml +++ /dev/null @@ -1,30 +0,0 @@ -<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="TitanLocation.lua"/> - <Frame parent="UIParent"> - <Frames> - <Button name="TitanPanelLocationButton" inherits="TitanPanelComboTemplate" frameStrata="FULLSCREEN" toplevel="true"> - <Scripts> - <OnLoad> - TitanPanelLocationButton_OnLoad(self); - TitanPanelButton_OnLoad(self); - </OnLoad> - <OnShow> - TitanPanelLocationButton_OnShow(); - TitanPanelButton_OnShow(self); - </OnShow> - <OnHide> - TitanPanelLocationButton_OnHide(); - </OnHide> - <OnEvent> - TitanPanelLocationButton_OnEvent(self, event, ...); - </OnEvent> - <OnClick> - TitanPanelLocationButton_OnClick(self, button); - TitanPanelButton_OnClick(self, button); - </OnClick> - </Scripts> - </Button> - </Frames> - </Frame> -</Ui> \ No newline at end of file diff --git a/TitanLootType/TitanLootType.lua b/TitanLootType/TitanLootType.lua index 851f472..890964f 100644 --- a/TitanLootType/TitanLootType.lua +++ b/TitanLootType/TitanLootType.lua @@ -1,11 +1,14 @@ +--[[ -- ************************************************************************** -- * TitanLootType.lua -- * -- * By: The Titan Panel Development Team -- ************************************************************************** +--]] -- ******************************** Constants ******************************* local TITAN_LOOTTYPE_ID = "LootType"; +local TITAN_BUTTON = "TitanPanel"..TITAN_LOOTTYPE_ID.."Button" local _G = getfenv(0); local L = LibStub("AceLocale-3.0"):GetLocale("Titan", true) local TitanLootMethod = {}; @@ -18,13 +21,17 @@ TitanLootMethod["needbeforegreed"] = {text = L["TITAN_LOOTTYPE_NEED_BEFORE_GREED TitanLootMethod["personalloot"] = {text = L["TITAN_LOOTTYPE_PERSONAL"]}; -- ******************************** Variables ******************************* +local loot_spec_name = "" +local current_spec = "" -- ******************************** Functions ******************************* +--[[ -- ************************************************************************** -- NAME : TitanPanelLootTypeButton_OnLoad() -- DESC : Registers the plugin upon it loading -- ************************************************************************** +--]] function TitanPanelLootTypeButton_OnLoad(self) self.registry = { id = TITAN_LOOTTYPE_ID, @@ -39,7 +46,6 @@ function TitanPanelLootTypeButton_OnLoad(self) controlVariables = { ShowIcon = true, ShowLabelText = true, - ShowRegularText = false, ShowColoredText = false, DisplayOnRightSide = true, }, @@ -50,6 +56,8 @@ function TitanPanelLootTypeButton_OnLoad(self) DisplayOnRightSide = false, ShowDungeonDiff = false, DungeonDiffType = "AUTO", + ShowLootType = true, + ShowLootSpec = true, } }; @@ -57,6 +65,9 @@ function TitanPanelLootTypeButton_OnLoad(self) self:RegisterEvent("RAID_ROSTER_UPDATE"); self:RegisterEvent("PARTY_LOOT_METHOD_CHANGED"); self:RegisterEvent("CHAT_MSG_SYSTEM"); + + self:RegisterEvent("PLAYER_SPECIALIZATION_CHANGED") + self:RegisterEvent("PLAYER_LOOT_SPEC_UPDATED") end function TitanPanelLootTypeButton_GetDungeonDifficultyIDText(isRaid, withpar) @@ -97,10 +108,12 @@ function TitanPanelLootTypeButton_GetDungeonDifficultyIDText(isRaid, withpar) return diffstr end +--[[ -- ************************************************************************** -- NAME : TitanPanelLootTypeButton_OnEvent() -- DESC : Parse events registered to plugin and act on them -- ************************************************************************** +--]] function TitanPanelLootTypeButton_OnEvent(self, event, ...) local arg1 = ...; if event == "CHAT_MSG_SYSTEM" then @@ -138,14 +151,17 @@ function TitanPanelLootTypeButton_OnEvent(self, event, ...) TitanPanelPluginHandle_OnUpdate(updateTable) end +--[[ -- ************************************************************************** -- NAME : TitanPanelLootTypeButton_GetButtonText(id) -- DESC : Calculate loottype and then display data on button -- VARS : id = button ID -- ************************************************************************** +--]] function TitanPanelLootTypeButton_GetButtonText(id) local lootTypeText, lootThreshold, color, dungeondiff; dungeondiff = ""; + if (GetNumSubgroupMembers() > 0) or (GetNumGroupMembers() > 0) then lootTypeText = TitanLootMethod[GetLootMethod()].text; lootThreshold = GetLootThreshold(); @@ -167,55 +183,120 @@ function TitanPanelLootTypeButton_GetButtonText(id) if GetNumGroupMembers() > 0 then dungeondiff = dungeondiff.." "..TitanPanelLootTypeButton_GetDungeonDifficultyIDText(true, true) end end end - return L["TITAN_LOOTTYPE_BUTTON_LABEL"], TitanUtils_GetColoredText(lootTypeText, color)..dungeondiff; + + -- Determine current spec + local spec = 0 + local id, name, descr, icon, role, is_rec, is_allowed + spec = GetSpecialization() -- 1-4 ; nil or 5 (Initial) assume none + if spec == nil or spec == 5 then + name = (NONE or "None...") + else + id, name, descr, icon, role, is_rec, is_allowed = GetSpecializationInfo(spec) + end + current_spec = name -- for tool tip + + -- Determine loot spec + local loot_label = (LOOT.." "..SPECIALIZATION or "Loot Spec")..": " + local loot_spec = GetLootSpecialization() + if loot_spec == 0 then -- 0 means current spec + else -- Id means user has set + id, name, descr, icon, role, is_rec, is_allowed = GetSpecializationInfoByID(loot_spec) + end + + loot_spec_name = name -- for tool tip +--[[ +print("T Loot" +.." "..tostring(spec).." " +.." "..tostring(loot_spec).." " +--.." "..tostring(GetSpecializationInfo(spec)).." " +.." "..tostring(name).." " +) +--]] + local show_loot_type = TitanGetVar(TITAN_LOOTTYPE_ID, "ShowLootType") + local show_loot_spec = TitanGetVar(TITAN_LOOTTYPE_ID, "ShowLootSpec") + local ltl, ltd, csl, csd, lsl, lsd + + if show_loot_type then + ltl = L["TITAN_LOOTTYPE_BUTTON_LABEL"] + ltd = TitanUtils_GetColoredText(lootTypeText, color)..dungeondiff + else + ltl = "" + ltd = "" + end + + csl = (SPECIALIZATION or "Spec")..": " + csd = current_spec + + if show_loot_spec then + lsl = loot_label + lsd = loot_spec_name + else + lsl = "" + lsd = "" + end + + return ltl, ltd, csl, TitanUtils_GetHighlightText(csd), lsl, TitanUtils_GetHighlightText(lsd) + end +--[[ -- ************************************************************************** -- NAME : TitanPanelLootTypeButton_GetTooltipText() -- DESC : Display tooltip text -- ************************************************************************** +--]] function TitanPanelLootTypeButton_GetTooltipText() + local party = "" if (GetNumSubgroupMembers() > 0) or (GetNumGroupMembers() > 0) then local lootTypeText = TitanLootMethod[GetLootMethod()].text; local lootThreshold = GetLootThreshold(); local itemQualityDesc = _G["ITEM_QUALITY"..lootThreshold.."_DESC"]; local color = _G["ITEM_QUALITY_COLORS"][lootThreshold]; - return "".. - L["TITAN_LOOTTYPE_DUNGEONDIFF_LABEL"]..": \t"..TitanPanelLootTypeButton_GetDungeonDifficultyIDText().."\n".. - L["TITAN_LOOTTYPE_DUNGEONDIFF_LABEL2"]..": \t"..TitanPanelLootTypeButton_GetDungeonDifficultyIDText(true).."\n".. + party = "".. _G["LOOT_METHOD"]..": \t"..TitanUtils_GetHighlightText(lootTypeText).."\n".. - _G["LOOT_THRESHOLD"]..": \t"..TitanUtils_GetColoredText(itemQualityDesc, color).."\n".. - TitanUtils_GetGreenText(L["TITAN_LOOTTYPE_TOOLTIP_HINT1"]).."\n".. - TitanUtils_GetGreenText(L["TITAN_LOOTTYPE_TOOLTIP_HINT2"]); + _G["LOOT_THRESHOLD"]..": \t"..TitanUtils_GetColoredText(itemQualityDesc, color).."\n" else - return L["TITAN_LOOTTYPE_DUNGEONDIFF_LABEL"]..": \t"..TitanPanelLootTypeButton_GetDungeonDifficultyIDText().."\n".. + party = TitanUtils_GetNormalText(_G["ERR_NOT_IN_GROUP"]).."\n" + end + local tt = "".. + L["TITAN_LOOTTYPE_DUNGEONDIFF_LABEL"]..": \t"..TitanPanelLootTypeButton_GetDungeonDifficultyIDText().."\n".. L["TITAN_LOOTTYPE_DUNGEONDIFF_LABEL2"]..": \t"..TitanPanelLootTypeButton_GetDungeonDifficultyIDText(true).."\n".. - TitanUtils_GetNormalText(_G["ERR_NOT_IN_GROUP"]).."\n".. + (SPECIALIZATION or "Spec")..": \t"..current_spec.."\n".. + (SELECT_LOOT_SPECIALIZATION or "Loot Spec")..": \t"..loot_spec_name.."\n".. + party.. + "\n".. TitanUtils_GetGreenText(L["TITAN_LOOTTYPE_TOOLTIP_HINT1"]).."\n".. - TitanUtils_GetGreenText(L["TITAN_LOOTTYPE_TOOLTIP_HINT2"]); - end + TitanUtils_GetGreenText(L["TITAN_LOOTTYPE_TOOLTIP_HINT2"]).. + "" + return tt end +--[[ -- ************************************************************************** -- NAME : TitanPanelLootType_Random100() -- DESC : Define random 100 loottype -- ************************************************************************** +--]] function TitanPanelLootType_Random100() TitanSetVar(TITAN_LOOTTYPE_ID, "RandomRoll", 100); end +--[[ -- ************************************************************************** -- NAME : TitanPanelLootType_Random1000() -- DESC : Define random 1000 loottype -- ************************************************************************** +--]] function TitanPanelLootType_Random1000() TitanSetVar(TITAN_LOOTTYPE_ID, "RandomRoll", 1000); end +--[[ -- ************************************************************************** -- NAME : TitanPanelLootType_GetRoll(num) -- DESC : Confirm loottype is random roll -- ************************************************************************** +--]] function TitanPanelLootType_GetRoll(num) local temp = TitanGetVar(TITAN_LOOTTYPE_ID, "RandomRoll"); if temp == num then @@ -224,10 +305,12 @@ function TitanPanelLootType_GetRoll(num) return nil; end +--[[ -- ************************************************************************** -- NAME : TitanPanelRightClickMenu_PrepareLootTypeMenu() -- DESC : Display rightclick menu options -- ************************************************************************** +--]] function TitanPanelRightClickMenu_PrepareLootTypeMenu() local info = {}; if TitanPanelRightClickMenu_GetDropdownLevel() == 2 and TitanPanelRightClickMenu_GetDropdMenuValue() == "RandomRoll" then @@ -439,27 +522,69 @@ function TitanPanelRightClickMenu_PrepareLootTypeMenu() info.hasArrow = 1; TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); + TitanPanelRightClickMenu_AddSpacer(); + info = {}; + info.text = SHOW.." "..(LOOT_METHOD or "Loot Type") + info.func = function() TitanPanelRightClickMenu_ToggleVar({TITAN_LOOTTYPE_ID, "ShowLootType"}) end + info.checked = TitanGetVar(TITAN_LOOTTYPE_ID, "ShowLootType") + TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); + + info = {}; + info.text = SHOW.." "..(SELECT_LOOT_SPECIALIZATION or "Loot Spec") + info.func = function() TitanPanelRightClickMenu_ToggleVar({TITAN_LOOTTYPE_ID, "ShowLootSpec"}) end + info.checked = TitanGetVar(TITAN_LOOTTYPE_ID, "ShowLootSpec") + TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); + + TitanPanelRightClickMenu_AddSpacer(); info = {}; info.notCheckable = true info.text = L["TITAN_LOOTTYPE_RANDOM_ROLL_LABEL"]; info.value = "RandomRoll"; info.hasArrow = 1; TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); - TitanPanelRightClickMenu_AddSpacer(); - TitanPanelRightClickMenu_AddToggleIcon(TITAN_LOOTTYPE_ID); - TitanPanelRightClickMenu_AddToggleLabelText(TITAN_LOOTTYPE_ID); - TitanPanelRightClickMenu_AddToggleRightSide(TITAN_LOOTTYPE_ID); - TitanPanelRightClickMenu_AddSpacer(); - TitanPanelRightClickMenu_AddCommand(L["TITAN_PANEL_MENU_HIDE"], TITAN_LOOTTYPE_ID, TITAN_PANEL_MENU_FUNC_HIDE); + + TitanPanelRightClickMenu_AddControlVars(TITAN_LOOTTYPE_ID) end end +--[[ -- ************************************************************************** -- NAME : TitanPanelBagButton_OnClick(button) -- DESC : Generate random roll on leftclick of button -- ************************************************************************** +--]] function TitanPanelLootTypeButton_OnClick(self, button) if button == "LeftButton" then RandomRoll(1, TitanGetVar(TITAN_LOOTTYPE_ID, "RandomRoll")); end end + + +-- ====== Create needed frames +local function Create_Frames() + if _G[TITAN_BUTTON] then + return -- if already created + end + + -- general container frame + local f = CreateFrame("Frame", nil, UIParent) +-- f:Hide() + + -- Titan plugin button + local window = CreateFrame("Button", TITAN_BUTTON, f, "TitanPanelComboTemplate") + window:SetFrameStrata("FULLSCREEN") + -- Using SetScript("OnLoad", does not work + TitanPanelLootTypeButton_OnLoad(window); +-- TitanPanelButton_OnLoad(window); -- Titan XML template calls this... + + window:SetScript("OnEvent", function(self, event, ...) + TitanPanelLootTypeButton_OnEvent(self, event, ...) + end) + window:SetScript("OnClick", function(self, button) + TitanPanelLootTypeButton_OnClick(self, button); + TitanPanelButton_OnClick(self, button); + end) +end + + +Create_Frames() -- do the work diff --git a/TitanLootType/TitanLootType.toc b/TitanLootType/TitanLootType.toc index 596f181..9cf8b7a 100644 --- a/TitanLootType/TitanLootType.toc +++ b/TitanLootType/TitanLootType.toc @@ -1,10 +1,10 @@ ## Interface: 100000 -## Title: Titan Panel [|cffeda55fLootType|r] |cff00aa006.00.04.100000|r +## Title: Titan Panel [|cffeda55fLootType|r] |cff00aa006.00.05.100000|r ## Notes: Adds group loot and instance difficulty information to Titan Panel ## Author: Titan Panel Development Team (http://www.titanpanel.org) ## SavedVariables: ## OptionalDeps: ## Dependencies: Titan -## Version: 6.00.04.100000 +## Version: 6.00.05.100000 ## X-Child-Of: Titan -TitanLootType.xml +TitanLootType.lua diff --git a/TitanLootType/TitanLootType.xml b/TitanLootType/TitanLootType.xml deleted file mode 100644 index 814c8fb..0000000 --- a/TitanLootType/TitanLootType.xml +++ /dev/null @@ -1,23 +0,0 @@ -<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="TitanLootType.lua"/> - <Frame parent="UIParent"> - <Frames> - <Button name="TitanPanelLootTypeButton" inherits="TitanPanelComboTemplate" frameStrata="FULLSCREEN" toplevel="true"> - <Scripts> - <OnLoad> - TitanPanelLootTypeButton_OnLoad(self); - TitanPanelButton_OnLoad(self); - </OnLoad> - <OnEvent> - TitanPanelLootTypeButton_OnEvent(self, event, ...); - </OnEvent> - <OnClick> - TitanPanelLootTypeButton_OnClick(self, button); - TitanPanelButton_OnClick(self, button); - </OnClick> - </Scripts> - </Button> - </Frames> - </Frame> -</Ui> diff --git a/TitanPerformance/TitanPerformance.lua b/TitanPerformance/TitanPerformance.lua index 3863081..3132024 100644 --- a/TitanPerformance/TitanPerformance.lua +++ b/TitanPerformance/TitanPerformance.lua @@ -6,6 +6,7 @@ -- ******************************** Constants ******************************* local TITAN_PERFORMANCE_ID = "Performance"; +local TITAN_BUTTON = "TitanPanel"..TITAN_PERFORMANCE_ID.."Button" local TITAN_PERF_FRAME_SHOW_TIME = 0.5; local updateTable = {TITAN_PERFORMANCE_ID, TITAN_PANEL_UPDATE_ALL}; @@ -597,13 +598,7 @@ function TitanPanelRightClickMenu_PreparePerformanceMenu() info.hasArrow = 1; TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); - TitanPanelRightClickMenu_AddSpacer(); - TitanPanelRightClickMenu_AddToggleIcon(TITAN_PERFORMANCE_ID); - TitanPanelRightClickMenu_AddToggleLabelText(TITAN_PERFORMANCE_ID); - TitanPanelRightClickMenu_AddToggleColoredText(TITAN_PERFORMANCE_ID); - TitanPanelRightClickMenu_AddToggleRightSide(TITAN_PERFORMANCE_ID); - TitanPanelRightClickMenu_AddSpacer(); - TitanPanelRightClickMenu_AddCommand(L["TITAN_PANEL_MENU_HIDE"], TITAN_PERFORMANCE_ID, TITAN_PANEL_MENU_FUNC_HIDE); + TitanPanelRightClickMenu_AddControlVars(TITAN_PERFORMANCE_ID) end -- ************************************************************************** @@ -830,3 +825,93 @@ function TitanPanelPerfControlFrame_OnUpdate(self, elapsed) TitanUtils_CheckFrameCounting(self, elapsed); end end + +-- ====== Create needed frames +local function Create_Frames() + if _G[TITAN_BUTTON] then + return -- if already created + end + + -- general container frame + local f = CreateFrame("Frame", nil, UIParent) +-- f:Hide() + + -- Titan plugin button + local window = CreateFrame("Button", TITAN_BUTTON, f, "TitanPanelComboTemplate") + window:SetFrameStrata("FULLSCREEN") + -- Using SetScript("OnLoad", does not work + TitanPanelPerformanceButton_OnLoad(window); +-- TitanPanelButton_OnLoad(window); -- Titan XML template calls this... + + window:SetScript("OnShow", function(self) + TitanPanelPerformanceButton_OnShow() + TitanPanelButton_OnShow(self) + end) + window:SetScript("OnHide", function(self) + TitanPanelPerformanceButton_OnHide() + end) + window:SetScript("OnEvent", function(self, event, ...) + TitanPanelPerformanceButton_OnEvent(self, event, ...) + end) + window:SetScript("OnClick", function(self, button) + TitanPanelPerformanceButton_OnClick(self, button) + TitanPanelButton_OnClick(self, button) + end) + + +---[===[ + -- Config screen + local cname = "TitanPanelPerfControlFrame" + local config = CreateFrame("Frame", cname, f, BackdropTemplateMixin and "BackdropTemplate") + config:SetFrameStrata("FULLSCREEN") + config:Hide() + config:SetWidth(120) + config:SetHeight(170) + + config:SetScript("OnEnter", function(self) + TitanUtils_StopFrameCounting(self) + end) + config:SetScript("OnLeave", function(self) + TitanUtils_StartFrameCounting(self, 0.5) + end) + config:SetScript("OnUpdate", function(self, elapsed) + TitanPanelPerfControlFrame_OnUpdate(self, elapsed) + end) + + -- Config Title + local str = nil + local style = "GameFontNormalSmall" + str = config:CreateFontString(cname.."Title", "ARTWORK", style) + str:SetPoint("TOP", config, 0, -10) + + -- Config slider sections + local slider = nil + + -- Hours offset + local inherit = "TitanOptionsSliderTemplate" + local offset = CreateFrame("Slider", "TitanPanelClockControlSlider", config, inherit) + offset:SetPoint("TOP", config, 0, -40) + offset:SetScript("OnShow", function(self) + TitanPanelPerfControlSlider_OnShow(self) + end) + offset:SetScript("OnValueChanged", function(self) + TitanPanelPerfControlSlider_OnValueChanged(self, value) + end) + offset:SetScript("OnMouseWheel", function(self) + TitanPanelPerfControlSlider_OnValueChanged(self, delta) + end) + offset:SetScript("OnEnter", function(self) + TitanPanelPerfControlSlider_OnEnter(self) + end) + offset:SetScript("OnLeave", function(self) + TitanPanelPerfControlSlider_OnLeave(self) + end) + + -- Now that the parts exist, initialize + TitanPanelPerfControlFrame_OnLoad(config) + +--]===] +end + + +Create_Frames() -- do the work diff --git a/TitanPerformance/TitanPerformance.toc b/TitanPerformance/TitanPerformance.toc index 23e6f90..0c97e9d 100644 --- a/TitanPerformance/TitanPerformance.toc +++ b/TitanPerformance/TitanPerformance.toc @@ -1,10 +1,10 @@ ## Interface: 100000 -## Title: Titan Panel [|cffeda55fPerformance|r] |cff00aa006.00.04.100000|r +## Title: Titan Panel [|cffeda55fPerformance|r] |cff00aa006.00.05.100000|r ## Notes: Adds FPS and Garbage collection information to Titan Panel ## Author: Titan Panel Development Team (http://www.titanpanel.org) ## SavedVariables: ## OptionalDeps: ## Dependencies: Titan -## Version: 6.00.04.100000 +## Version: 6.00.05.100000 ## X-Child-Of: Titan -TitanPerformance.xml +TitanPerformance.lua diff --git a/TitanPerformance/TitanPerformance.xml b/TitanPerformance/TitanPerformance.xml deleted file mode 100644 index 0e369e5..0000000 --- a/TitanPerformance/TitanPerformance.xml +++ /dev/null @@ -1,109 +0,0 @@ -<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="TitanPerformance.lua"/> - <Frame name="TitanPanelPerfControlFrameTemplate" inherits="BackdropTemplate" virtual="true" hidden="true"> - <Size> - <AbsDimension x="120" y="170" /> - </Size> -<!-- -Blizzard decided to remove direct Backdrop API in 9.0 (Shadowlands) so inherit the template -and set the values in the code. - <Backdrop bgFile="Interface\FullScreenTextures\OutOfControl" edgeFile="Interface\Tooltips\UI-Tooltip-Border" tile="true"> - <EdgeSize> - <AbsValue val="16"/> - </EdgeSize> - <TileSize> - <AbsValue val="16"/> - </TileSize> - <BackgroundInsets> - <AbsInset left="2" right="2" top="2" bottom="2"/> - </BackgroundInsets> - </Backdrop> ---> - <Layers> - <Layer> - <FontString name="$parentTitle" inherits="GameFontNormalSmall"> - <Anchors> - <Anchor point="TOP"> - <Offset> - <AbsDimension x="0" y="-10" /> - </Offset> - </Anchor> - </Anchors> - </FontString> - </Layer> - </Layers> - <Frames> - <Slider name="TitanPanelPerfControlSlider" inherits="TitanOptionsSliderTemplate"> - <Anchors> - <Anchor point="TOP"> - <Offset> - <AbsDimension x="0" y="-40"/> - </Offset> - </Anchor> - </Anchors> - <Scripts> - <OnShow> - TitanPanelPerfControlSlider_OnShow(self); - </OnShow> - <OnValueChanged> - TitanPanelPerfControlSlider_OnValueChanged(self, value); - </OnValueChanged> - <OnMouseWheel> - TitanPanelPerfControlSlider_OnValueChanged(self, delta); - </OnMouseWheel> - <OnEnter> - TitanPanelPerfControlSlider_OnEnter(self); - </OnEnter> - <OnLeave> - TitanPanelPerfControlSlider_OnLeave(self) - </OnLeave> - </Scripts> - </Slider> - </Frames> - <Scripts> - <OnLoad> - TitanPanelPerfControlFrame_OnLoad(self); - </OnLoad> - <OnEnter> - TitanUtils_StopFrameCounting(self); - </OnEnter> - <OnLeave> - TitanUtils_StartFrameCounting(self, 0.5); - </OnLeave> - <OnShow> - TitanUtils_StartFrameCounting(self, 0.5); - </OnShow> - <OnUpdate> - TitanPanelPerfControlFrame_OnUpdate(self, elapsed); - </OnUpdate> - </Scripts> - </Frame> - <Frame parent="UIParent"> - <Frames> - <Button name="TitanPanelPerformanceButton" inherits="TitanPanelComboTemplate" frameStrata="FULLSCREEN" toplevel="true"> - <Scripts> - <OnLoad> - TitanPanelPerformanceButton_OnLoad(self); - TitanPanelButton_OnLoad(self); - </OnLoad> - <OnEvent> - TitanPanelPerformanceButton_OnEvent(self, event, ...); - </OnEvent> - <OnShow> - TitanPanelPerformanceButton_OnShow(); - TitanPanelButton_OnShow(self); - </OnShow> - <OnHide> - TitanPanelPerformanceButton_OnHide(); - </OnHide> - <OnClick> - TitanPanelPerformanceButton_OnClick(self, button); - TitanPanelButton_OnClick(self, button); - </OnClick> - </Scripts> - </Button> - <Frame name="TitanPanelPerfControlFrame" inherits="TitanPanelPerfControlFrameTemplate" frameStrata="FULLSCREEN_DIALOG" toplevel="true" /> - </Frames> - </Frame> -</Ui> \ No newline at end of file diff --git a/TitanRepair/TitanRepair.lua b/TitanRepair/TitanRepair.lua index 3be0e28..5273c0c 100644 --- a/TitanRepair/TitanRepair.lua +++ b/TitanRepair/TitanRepair.lua @@ -6,6 +6,8 @@ -- ******************************** Constants ******************************* local TITAN_REPAIR_ID = "Repair"; +local TITAN_BUTTON = "TitanPanel"..TITAN_REPAIR_ID.."Button" + local L = LibStub("AceLocale-3.0"):GetLocale("Titan", true) local TitanRepairModule = LibStub("AceAddon-3.0"):NewAddon("TitanRepair", "AceHook-3.0", "AceTimer-3.0") local _G = getfenv(0); @@ -91,7 +93,6 @@ function TitanPanelRepairButton_OnLoad(self) controlVariables = { ShowIcon = true, ShowLabelText = true, - ShowRegularText = false, ShowColoredText = true, DisplayOnRightSide = true, }, @@ -1370,13 +1371,7 @@ local info; info.hasArrow = 1; TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); - TitanPanelRightClickMenu_AddSpacer(); - TitanPanelRightClickMenu_AddToggleIcon(TITAN_REPAIR_ID); - TitanPanelRightClickMenu_AddToggleLabelText(TITAN_REPAIR_ID); - TitanPanelRightClickMenu_AddToggleColoredText(TITAN_REPAIR_ID); - TitanPanelRightClickMenu_AddToggleRightSide(TITAN_REPAIR_ID); - TitanPanelRightClickMenu_AddSpacer(); - TitanPanelRightClickMenu_AddCommand(L["TITAN_PANEL_MENU_HIDE"], TITAN_REPAIR_ID, TITAN_PANEL_MENU_FUNC_HIDE); + TitanPanelRightClickMenu_AddControlVars(TITAN_REPAIR_ID) end @@ -1558,6 +1553,36 @@ function TitanRepair_GetRepairInvCost() return result; end +-- ====== Create needed frames +local function Create_Frames() + if _G[TITAN_BUTTON] then + return -- if already created + end + + -- general container frame + local f = CreateFrame("Frame", nil, UIParent) +-- f:Hide() + + -- Titan plugin button + local window = CreateFrame("Button", TITAN_BUTTON, f, "TitanPanelComboTemplate") + window:SetFrameStrata("FULLSCREEN") + -- Using SetScript("OnLoad", does not work + TitanPanelRepairButton_OnLoad(window); +-- TitanPanelButton_OnLoad(window); -- Titan XML template calls this... + + window:SetScript("OnEvent", function(self, event, ...) + TitanPanelRepairButton_OnEvent(self, event, ...) + end) + + + -- Tooltip frame + local tt = CreateFrame("GameTooltip", "TitanRepairTooltip", f, "GameTooltipTemplate") +end + + +Create_Frames() -- do the work + -- Hooks --TitanRepairModule:SecureHook("DurabilityFrame_SetAlerts", TitanRepair_DurabilityFrame) TitanRepairModule:SecureHook(DurabilityFrame, "Show", function() TitanRepair_DurabilityFrame(true) end) + diff --git a/TitanRepair/TitanRepair.toc b/TitanRepair/TitanRepair.toc index e8e44f8..e7b6767 100644 --- a/TitanRepair/TitanRepair.toc +++ b/TitanRepair/TitanRepair.toc @@ -1,10 +1,10 @@ ## Interface: 100000 -## Title: Titan Panel [|cffeda55fRepair|r] |cff00aa006.00.04.100000|r +## Title: Titan Panel [|cffeda55fRepair|r] |cff00aa006.00.05.100000|r ## Notes: Provides a configurable durability display. Also adds the ability to auto repair items and inventory at vendors ## Author: Titan Panel Development Team (http://www.titanpanel.org) ## SavedVariables: ## OptionalDeps: ## Dependencies: Titan -## Version: 6.00.04.100000 +## Version: 6.00.05.100000 ## X-Child-Of: Titan -TitanRepair.xml +TitanRepair.lua diff --git a/TitanRepair/TitanRepair.xml b/TitanRepair/TitanRepair.xml deleted file mode 100644 index 0de1119..0000000 --- a/TitanRepair/TitanRepair.xml +++ /dev/null @@ -1,21 +0,0 @@ -<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="TitanRepair.lua"/> - - <GameTooltip name="TitanRepairTooltip" inherits="GameTooltipTemplate" parent="UIParent" hidden="true"/> - <Frame parent="UIParent"> - <Frames> - <Button name="TitanPanelRepairButton" inherits="TitanPanelComboTemplate" frameStrata="FULLSCREEN" toplevel="true"> - <Scripts> - <OnLoad> - TitanPanelRepairButton_OnLoad(self); - TitanPanelButton_OnLoad(self); - </OnLoad> - <OnEvent> - TitanPanelRepairButton_OnEvent(self, event, ...); - </OnEvent> - </Scripts> - </Button> - </Frames> - </Frame> -</Ui> diff --git a/TitanVolume/TitanVolume.lua b/TitanVolume/TitanVolume.lua index 70e1f03..eda0292 100644 --- a/TitanVolume/TitanVolume.lua +++ b/TitanVolume/TitanVolume.lua @@ -1,10 +1,14 @@ +--[[ -- ************************************************************************** -- * TitanBag.lua -- * -- * By: The Titan Panel Development Team -- ************************************************************************** +--]] local TITAN_VOLUME_ID = "Volume"; +local TITAN_VOLUME_BUTTON = "TitanPanel"..TITAN_VOLUME_ID.."Button" + local TITAN_VOLUME_FRAME_SHOW_TIME = 0.5; local TITAN_VOLUME_ARTWORK_PATH = "Interface\\AddOns\\TitanVolume\\Artwork\\"; local _G = getfenv(0); @@ -20,6 +24,12 @@ function TitanPanelVolumeButton_OnLoad(self) tooltipTextFunction = "TitanPanelVolumeButton_GetTooltipText", iconWidth = 32, iconButtonWidth = 18, + controlVariables = { + ShowIcon = false, + ShowLabelText = false, + ShowColoredText = false, + DisplayOnRightSide = true, + }, savedVariables = { OverrideBlizzSettings = false, VolumeMaster = 1, @@ -86,18 +96,6 @@ function TitanPanelMasterVolumeControlSlider_OnShow(self) self:SetValueStep(0.01); self:SetObeyStepOnDrag(true) -- since 5.4.2 (Mists of Pandaria) self:SetValue(1 - GetCVar("Sound_MasterVolume")); - - local position = TitanUtils_GetRealPosition(TITAN_VOLUME_ID); - - TitanPanelVolumeControlFrame:SetPoint("BOTTOMRIGHT", TITAN_PANEL_DISPLAY_PREFIX..TitanUtils_GetWhichBar(TITAN_VOLUME_ID), "TOPRIGHT", 0, 0); - if (position == TITAN_PANEL_PLACE_TOP) then - TitanPanelVolumeControlFrame:ClearAllPoints(); - TitanPanelVolumeControlFrame:SetPoint("TOPLEFT", TITAN_PANEL_DISPLAY_PREFIX..TitanUtils_GetWhichBar(TITAN_VOLUME_ID), "BOTTOMLEFT", UIParent:GetRight() - TitanPanelVolumeControlFrame:GetWidth(), -4); - else - TitanPanelVolumeControlFrame:ClearAllPoints(); - TitanPanelVolumeControlFrame:SetPoint("BOTTOMLEFT", TITAN_PANEL_DISPLAY_PREFIX..TitanUtils_GetWhichBar(TITAN_VOLUME_ID), "TOPLEFT", UIParent:GetRight() - TitanPanelVolumeControlFrame:GetWidth(), 0); - end - end function TitanPanelMasterVolumeControlSlider_OnValueChanged(self, a1) @@ -163,9 +161,9 @@ _G[self:GetName().."Text"]:SetText(TitanPanelVolume_GetVolumeText(1 - self:GetVa end end --- 'Sound' +-- 'Sound Effects' function TitanPanelSoundVolumeControlSlider_OnEnter(self) - self.tooltipText = TitanOptionSlider_TooltipText(OPTION_TOOLTIP_SOUND_VOLUME, TitanPanelVolume_GetVolumeText(GetCVar("Sound_SFXVolume"))); + self.tooltipText = TitanOptionSlider_TooltipText(OPTION_TOOLTIP_FX_VOLUME, TitanPanelVolume_GetVolumeText(GetCVar("Sound_SFXVolume"))); GameTooltip:SetOwner(self, "ANCHOR_BOTTOMLEFT"); GameTooltip:SetText(self.tooltipText, nil, nil, nil, nil, 1); TitanUtils_StopFrameCounting(self:GetParent()); @@ -194,14 +192,14 @@ _G[self:GetName().."Text"]:SetText(TitanPanelVolume_GetVolumeText(1 - self:GetVa -- Update GameTooltip if (self.tooltipText) then - self.tooltipText = TitanOptionSlider_TooltipText(OPTION_TOOLTIP_SOUND_VOLUME, TitanPanelVolume_GetVolumeText(1 - self:GetValue())); + self.tooltipText = TitanOptionSlider_TooltipText(OPTION_TOOLTIP_FX_VOLUME, TitanPanelVolume_GetVolumeText(1 - self:GetValue())); GameTooltip:SetText(self.tooltipText, nil, nil, nil, nil, 1); end end -- 'Ambience' function TitanPanelAmbienceVolumeControlSlider_OnEnter(self) - self.tooltipText = TitanOptionSlider_TooltipText(OPTION_TOOLTIP_ENABLE_AMBIENCE, TitanPanelVolume_GetVolumeText(GetCVar("Sound_AmbienceVolume"))); + self.tooltipText = TitanOptionSlider_TooltipText(OPTION_TOOLTIP_AMBIENCE_VOLUME, TitanPanelVolume_GetVolumeText(GetCVar("Sound_AmbienceVolume"))); GameTooltip:SetOwner(self, "ANCHOR_BOTTOMLEFT"); GameTooltip:SetText(self.tooltipText, nil, nil, nil, nil, 1); TitanUtils_StopFrameCounting(self:GetParent()); @@ -237,10 +235,6 @@ local tempval = self:GetValue(); end end -function TitanPanelVolume_GetVolumeText(volume) - return tostring(floor(100 * volume + 0.5)) .. "%"; -end - -- 'Dialog' function TitanPanelDialogVolumeControlSlider_OnEnter(self) self.tooltipText = TitanOptionSlider_TooltipText(OPTION_TOOLTIP_DIALOG_VOLUME, TitanPanelVolume_GetVolumeText(GetCVar("Sound_DialogVolume"))); @@ -279,6 +273,7 @@ local tempval = self:GetValue(); end end + function TitanPanelVolume_GetVolumeText(volume) return tostring(floor(100 * volume + 0.5)) .. "%"; end @@ -358,10 +353,10 @@ end ]]-- function TitanPanelVolumeControlFrame_OnLoad(self) - _G[self:GetName().."Title"]:SetText(VOLUME); - _G[self:GetName().."MasterTitle"]:SetText(MASTER_VOLUME); + _G[self:GetName().."Title"]:SetText(SOUND_OPTIONS); -- VOLUME + _G[self:GetName().."MasterTitle"]:SetText(VOLUME); --MASTER_VOLUME _G[self:GetName().."MusicTitle"]:SetText(MUSIC_VOLUME); - _G[self:GetName().."SoundTitle"]:SetText(SOUND_VOLUME); + _G[self:GetName().."SoundTitle"]:SetText(ENABLE_SOUNDFX); -- FX_VOLUME _G[self:GetName().."AmbienceTitle"]:SetText(AMBIENCE_VOLUME); _G[self:GetName().."DialogTitle"]:SetText(DIALOG_VOLUME); -- _G[self:GetName().."MicrophoneTitle"]:SetText(L["TITAN_VOLUME_MICROPHONE_CONTROL_TITLE"]); @@ -433,6 +428,186 @@ function TitanPanelRightClickMenu_PrepareVolumeMenu() info.checked = TitanGetVar(TITAN_VOLUME_ID, "OverrideBlizzSettings"); TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); - TitanPanelRightClickMenu_AddSpacer(); - TitanPanelRightClickMenu_AddCommand(L["TITAN_PANEL_MENU_HIDE"], TITAN_VOLUME_ID, TITAN_PANEL_MENU_FUNC_HIDE); + TitanPanelRightClickMenu_AddControlVars(TITAN_VOLUME_ID) end + +-- ====== Create needed frames +local function Create_Frames() + if _G[TITAN_VOLUME_BUTTON] then + return -- if already created + end + + -- general container frame + local f = CreateFrame("Frame", nil, UIParent) +-- f:Hide() + + -- Titan plugin button + local window = CreateFrame("Button", TITAN_VOLUME_BUTTON, f, "TitanPanelIconTemplate") + window:SetFrameStrata("FULLSCREEN") + -- Using SetScript("OnLoad", does not work + TitanPanelVolumeButton_OnLoad(window); +-- TitanPanelButton_OnLoad(window); -- Titan XML template calls this...w + + window:SetScript("OnShow", function(self) + TitanPanelVolumeButton_OnShow() + TitanPanelButton_OnShow(self) + end) + window:SetScript("OnEnter", function(self) + TitanPanelVolumeButton_OnEnter() + TitanPanelButton_OnEnter(self) + end) + window:SetScript("OnEvent", function(self, event, ...) + TitanPanelVolumeButton_OnEvent(self, event, ...) +-- ... not allowed here so grab the potential args that may be needed +-- TitanPanelVolumeButton_OnEvent(self, event, arg1, arg2, arg3, arg4) + end) + + +---[===[ + -- Config screen + local cname = "TitanPanelVolumeControlFrame" + local config = CreateFrame("Frame", cname, f, BackdropTemplateMixin and "BackdropTemplate") + config:SetFrameStrata("FULLSCREEN") -- + config:Hide() + config:SetWidth(400) + config:SetHeight(200) + + config:SetScript("OnEnter", function(self) + TitanUtils_StopFrameCounting(self) + end) + config:SetScript("OnLeave", function(self) + TitanUtils_StartFrameCounting(self, 0.5) + end) + config:SetScript("OnUpdate", function(self, elapsed) +-- TitanPanelVolumeControlFrame_OnUpdate(self, elapsed) + TitanUtils_CheckFrameCounting(self, elapsed) + end) + + -- Config font sections + local str = nil + local style = "GameFontNormalSmall" + str = config:CreateFontString(cname.."Title", "ARTWORK", style) + str:SetPoint("TOP", config, 0, -10) + + str = config:CreateFontString(cname.."MasterTitle", "ARTWORK", style) + str:SetPoint("TOP", config, -160, -30) + + str = config:CreateFontString(cname.."SoundTitle", "ARTWORK", style) + str:SetPoint("TOP", config, -90, -30) + + str = config:CreateFontString(cname.."MusicTitle", "ARTWORK", style) + str:SetPoint("TOP", config, -20, -30) + + str = config:CreateFontString(cname.."AmbienceTitle", "ARTWORK", style) + str:SetPoint("TOP", config, 50, -30) + + str = config:CreateFontString(cname.."DialogTitle", "ARTWORK", style) + str:SetPoint("TOP", config, 130, -30) + + -- Config slider sections + local slider = nil + + -- Master + local inherit = "TitanOptionsSliderTemplate" + local master = CreateFrame("Slider", "TitanPanelMasterVolumeControlSlider", config, inherit) + master:SetPoint("TOP", config, -160, -60) + master:SetScript("OnShow", function(self) + TitanPanelMasterVolumeControlSlider_OnShow(self) + end) + master:SetScript("OnValueChanged", function(self) + TitanPanelMasterVolumeControlSlider_OnValueChanged(self, value) + end) + master:SetScript("OnMouseWheel", function(self) + TitanPanelUnifiedVolumeControlSlider_OnMouseWheel(self, delta) + end) + master:SetScript("OnEnter", function(self) + TitanPanelMasterVolumeControlSlider_OnEnter(self) + end) + master:SetScript("OnLeave", function(self) + TitanPanelMasterVolumeControlSlider_OnLeave(self) + end) + + -- Sound + local sound = CreateFrame("Slider", "TitanPanelSoundVolumeControlSlider", config, inherit) + sound:SetPoint("TOP", config, -90, -60) + sound:SetScript("OnShow", function(self) + TitanPanelSoundVolumeControlSlider_OnShow(self) + end) + sound:SetScript("OnValueChanged", function(self) + TitanPanelSoundVolumeControlSlider_OnValueChanged(self, value) + end) + sound:SetScript("OnMouseWheel", function(self) + TitanPanelUnifiedVolumeControlSlider_OnMouseWheel(self, delta) + end) + sound:SetScript("OnEnter", function(self) + TitanPanelSoundVolumeControlSlider_OnEnter(self) + end) + sound:SetScript("OnLeave", function(self) + TitanPanelSoundVolumeControlSlider_OnLeave(self) + end) + + -- Music + local music = CreateFrame("Slider", "TitanPanelMusicVolumeControlSlider", config, inherit) + music:SetPoint("TOP", config, -20, -60) + music:SetScript("OnShow", function(self) + TitanPanelMusicVolumeControlSlider_OnShow(self) + end) + music:SetScript("OnValueChanged", function(self) + TitanPanelMusicVolumeControlSlider_OnValueChanged(self, value) + end) + music:SetScript("OnMouseWheel", function(self) + TitanPanelUnifiedVolumeControlSlider_OnMouseWheel(self, delta) + end) + music:SetScript("OnEnter", function(self) + TitanPanelMusicVolumeControlSlider_OnEnter(self) + end) + music:SetScript("OnLeave", function(self) + TitanPanelMusicVolumeControlSlider_OnLeave(self) + end) + + -- Ambience + local ambience = CreateFrame("Slider", "TitanPanelAmbienceVolumeControlSlider", config, inherit) + ambience:SetPoint("TOP", config, 50, -60) + ambience:SetScript("OnShow", function(self) + TitanPanelAmbienceVolumeControlSlider_OnShow(self) + end) + ambience:SetScript("OnValueChanged", function(self) + TitanPanelAmbienceVolumeControlSlider_OnValueChanged(self, value) + end) + ambience:SetScript("OnMouseWheel", function(self) + TitanPanelUnifiedVolumeControlSlider_OnMouseWheel(self, delta) + end) + ambience:SetScript("OnEnter", function(self) + TitanPanelAmbienceVolumeControlSlider_OnEnter(self) + end) + ambience:SetScript("OnLeave", function(self) + TitanPanelAmbienceVolumeControlSlider_OnLeave(self) + end) + + -- Dialog + local dialog = CreateFrame("Slider", "TitanPanelDialogVolumeControlSlider", config, inherit) + dialog:SetPoint("TOP", config, 130, -60) + dialog:SetScript("OnShow", function(self) + TitanPanelDialogVolumeControlSlider_OnShow(self) + end) + dialog:SetScript("OnValueChanged", function(self) + TitanPanelDialogVolumeControlSlider_OnValueChanged(self, value) + end) + dialog:SetScript("OnMouseWheel", function(self) + TitanPanelUnifiedVolumeControlSlider_OnMouseWheel(self, delta) + end) + dialog:SetScript("OnEnter", function(self) + TitanPanelDialogVolumeControlSlider_OnEnter(self) + end) + dialog:SetScript("OnLeave", function(self) + TitanPanelDialogVolumeControlSlider_OnLeave(self) + end) + + -- Now that the parts exist, initialize + TitanPanelVolumeControlFrame_OnLoad(config) + +--]===] +end + + +Create_Frames() -- do the work diff --git a/TitanVolume/TitanVolume.toc b/TitanVolume/TitanVolume.toc index 164c1ed..13bbe5e 100644 --- a/TitanVolume/TitanVolume.toc +++ b/TitanVolume/TitanVolume.toc @@ -1,10 +1,10 @@ ## Interface: 100000 -## Title: Titan Panel [|cffeda55fVolume|r] |cff00aa006.00.04.23.7.100000|r +## Title: Titan Panel [|cffeda55fVolume|r] |cff00aa006.00.05.23.7.100000|r ## Notes: Adds a volume control icon on your Titan Bar ## Author: Titan Panel Development Team (http://www.titanpanel.org) ## SavedVariables: ## OptionalDeps: ## Dependencies: Titan -## Version: 6.00.04.100000 +## Version: 6.00.05.100000 ## X-Child-Of: Titan -TitanVolume.xml +TitanVolume.lua diff --git a/TitanVolume/TitanVolume.xml b/TitanVolume/TitanVolume.xml deleted file mode 100644 index 22b75ce..0000000 --- a/TitanVolume/TitanVolume.xml +++ /dev/null @@ -1,326 +0,0 @@ -<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="TitanVolume.lua"/> - <Frame name="TitanPanelVolumeControlFrameTemplate" inherits="BackdropTemplate" virtual="true" hidden="true"> - <Size> - <AbsDimension x="400" y="200" /> - </Size> -<!-- -Blizzard decided to remove direct Backdrop API in 9.0 (Shadowlands) so inherit the template -and set the values in the code. - <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="5" top="5" bottom="5"/> - </BackgroundInsets> - </Backdrop> ---> - <Layers> - <Layer> - <FontString name="$parentTitle" inherits="GameFontNormalSmall"> - <Anchors> - <Anchor point="TOP"> - <Offset> - <AbsDimension x="0" y="-10" /> - </Offset> - </Anchor> - </Anchors> - </FontString> - <FontString name="$parentMasterTitle" inherits="GameFontNormalSmall"> - <Anchors> - <Anchor point="TOP"> - <Offset> - <AbsDimension x="-160" y="-30" /> - </Offset> - </Anchor> - </Anchors> - </FontString> - <FontString name="$parentSoundTitle" inherits="GameFontNormalSmall"> - <Anchors> - <Anchor point="TOP"> - <Offset> - <AbsDimension x="-90" y="-30" /> - </Offset> - </Anchor> - </Anchors> - </FontString> - <FontString name="$parentMusicTitle" inherits="GameFontNormalSmall"> - <Anchors> - <Anchor point="TOP"> - <Offset> - <AbsDimension x="-20" y="-30" /> - </Offset> - </Anchor> - </Anchors> - </FontString> - <FontString name="$parentAmbienceTitle" inherits="GameFontNormalSmall"> - <Anchors> - <Anchor point="TOP"> - <Offset> - <AbsDimension x="50" y="-30" /> - </Offset> - </Anchor> - </Anchors> - </FontString> - <FontString name="$parentDialogTitle" inherits="GameFontNormalSmall"> - <Anchors> - <Anchor point="TOP"> - <Offset> - <AbsDimension x="130" y="-30" /> - </Offset> - </Anchor> - </Anchors> - </FontString> -<!-- - <FontString name="$parentMicrophoneTitle" inherits="GameFontNormalSmall"> - <Anchors> - <Anchor point="TOP"> - <Offset> - <AbsDimension x="130" y="-30" /> - </Offset> - </Anchor> - </Anchors> - </FontString> - <FontString name="$parentSpeakerTitle" inherits="GameFontNormalSmall"> - <Anchors> - <Anchor point="TOP"> - <Offset> - <AbsDimension x="210" y="-30" /> - </Offset> - </Anchor> - </Anchors> - </FontString> ---> - </Layer> - </Layers> - <Frames> - <Slider name="TitanPanelMasterVolumeControlSlider" inherits="TitanOptionsSliderTemplate"> - <Anchors> - <Anchor point="TOP"> - <Offset> - <AbsDimension x="-160" y="-60"/> - </Offset> - </Anchor> - </Anchors> - <Scripts> - <OnShow> - TitanPanelMasterVolumeControlSlider_OnShow(self); - </OnShow> - <OnValueChanged> - TitanPanelMasterVolumeControlSlider_OnValueChanged(self, value); - </OnValueChanged> - <OnMouseWheel> - TitanPanelUnifiedVolumeControlSlider_OnMouseWheel(self, delta); - </OnMouseWheel> - <OnEnter> - TitanPanelMasterVolumeControlSlider_OnEnter(self); - </OnEnter> - <OnLeave> - TitanPanelMasterVolumeControlSlider_OnLeave(self) - </OnLeave> - </Scripts> - </Slider> - <Slider name="TitanPanelSoundVolumeControlSlider" inherits="TitanOptionsSliderTemplate"> - <Anchors> - <Anchor point="TOP"> - <Offset> - <AbsDimension x="-90" y="-60"/> - </Offset> - </Anchor> - </Anchors> - <Scripts> - <OnShow> - TitanPanelSoundVolumeControlSlider_OnShow(self); - </OnShow> - <OnValueChanged> - TitanPanelSoundVolumeControlSlider_OnValueChanged(self, value); - </OnValueChanged> - <OnMouseWheel> - TitanPanelUnifiedVolumeControlSlider_OnMouseWheel(self, delta); - </OnMouseWheel> - <OnEnter> - TitanPanelSoundVolumeControlSlider_OnEnter(self); - </OnEnter> - <OnLeave> - TitanPanelSoundVolumeControlSlider_OnLeave(self) - </OnLeave> - </Scripts> - </Slider> - <Slider name="TitanPanelMusicVolumeControlSlider" inherits="TitanOptionsSliderTemplate"> - <Anchors> - <Anchor point="TOP"> - <Offset> - <AbsDimension x="-20" y="-60"/> - </Offset> - </Anchor> - </Anchors> - <Scripts> - <OnShow> - TitanPanelMusicVolumeControlSlider_OnShow(self); - </OnShow> - <OnValueChanged> - TitanPanelMusicVolumeControlSlider_OnValueChanged(self, value); - </OnValueChanged> - <OnMouseWheel> - TitanPanelUnifiedVolumeControlSlider_OnMouseWheel(self, delta); - </OnMouseWheel> - <OnEnter> - TitanPanelMusicVolumeControlSlider_OnEnter(self); - </OnEnter> - <OnLeave> - TitanPanelMusicVolumeControlSlider_OnLeave(self) - </OnLeave> - </Scripts> - </Slider> - <Slider name="TitanPanelAmbienceVolumeControlSlider" inherits="TitanOptionsSliderTemplate"> - <Anchors> - <Anchor point="TOP"> - <Offset> - <AbsDimension x="50" y="-60"/> - </Offset> - </Anchor> - </Anchors> - <Scripts> - <OnShow> - TitanPanelAmbienceVolumeControlSlider_OnShow(self); - </OnShow> - <OnValueChanged> - TitanPanelAmbienceVolumeControlSlider_OnValueChanged(self, value); - </OnValueChanged> - <OnMouseWheel> - TitanPanelUnifiedVolumeControlSlider_OnMouseWheel(self, delta); - </OnMouseWheel> - <OnEnter> - TitanPanelAmbienceVolumeControlSlider_OnEnter(self); - </OnEnter> - <OnLeave> - TitanPanelAmbienceVolumeControlSlider_OnLeave(self) - </OnLeave> - </Scripts> - </Slider> - <Slider name="TitanPanelDialogVolumeControlSlider" inherits="TitanOptionsSliderTemplate"> - <Anchors> - <Anchor point="TOP"> - <Offset> - <AbsDimension x="130" y="-60"/> - </Offset> - </Anchor> - </Anchors> - <Scripts> - <OnShow> - TitanPanelDialogVolumeControlSlider_OnShow(self); - </OnShow> - <OnValueChanged> - TitanPanelDialogVolumeControlSlider_OnValueChanged(self, value); - </OnValueChanged> - <OnMouseWheel> - TitanPanelUnifiedVolumeControlSlider_OnMouseWheel(self, delta); - </OnMouseWheel> - <OnEnter> - TitanPanelDialogVolumeControlSlider_OnEnter(self); - </OnEnter> - <OnLeave> - TitanPanelDialogVolumeControlSlider_OnLeave(self) - </OnLeave> - </Scripts> - </Slider> -<!-- - <Slider name="TitanPanelMicrophoneVolumeControlSlider" inherits="TitanOptionsSliderTemplate"> - <Anchors> - <Anchor point="TOP"> - <Offset> - <AbsDimension x="130" y="-60"/> - </Offset> - </Anchor> - </Anchors> - <Scripts> - <OnShow> - TitanPanelMicrophoneVolumeControlSlider_OnShow(self); - </OnShow> - <OnValueChanged> - TitanPanelMicrophoneVolumeControlSlider_OnValueChanged(self, value); - </OnValueChanged> - <OnMouseWheel> - TitanPanelUnifiedVolumeControlSlider_OnMouseWheel(self, delta); - </OnMouseWheel> - <OnEnter> - TitanPanelMicrophoneVolumeControlSlider_OnEnter(self); - </OnEnter> - <OnLeave> - TitanPanelMicrophoneVolumeControlSlider_OnLeave(self) - </OnLeave> - </Scripts> - </Slider> - <Slider name="TitanPanelSpeakerVolumeControlSlider" inherits="TitanOptionsSliderTemplate"> - <Anchors> - <Anchor point="TOP"> - <Offset> - <AbsDimension x="210" y="-60"/> - </Offset> - </Anchor> - </Anchors> - <Scripts> - <OnShow> - TitanPanelSpeakerVolumeControlSlider_OnShow(self); - </OnShow> - <OnValueChanged> - TitanPanelSpeakerVolumeControlSlider_OnValueChanged(self, value); - </OnValueChanged> - <OnMouseWheel> - TitanPanelUnifiedVolumeControlSlider_OnMouseWheel(self, delta); - </OnMouseWheel> - <OnEnter> - TitanPanelSpeakerVolumeControlSlider_OnEnter(self); - </OnEnter> - <OnLeave> - TitanPanelSpeakerVolumeControlSlider_OnLeave(self) - </OnLeave> - </Scripts> - </Slider> ---> - </Frames> - <Scripts> - <OnLoad> - TitanPanelVolumeControlFrame_OnLoad(self); - </OnLoad> - <OnEnter> - TitanUtils_StopFrameCounting(self); - </OnEnter> - <OnLeave> - TitanUtils_StartFrameCounting(self, 0.5); - </OnLeave> - <OnUpdate> - TitanPanelVolumeControlFrame_OnUpdate(self, elapsed); - </OnUpdate> - </Scripts> - </Frame> - <Frame parent="UIParent"> - <Frames> - <Button name="TitanPanelVolumeButton" inherits="TitanPanelIconTemplate" frameStrata="FULLSCREEN" toplevel="true"> - <Scripts> - <OnLoad> - TitanPanelVolumeButton_OnLoad(self); - TitanPanelButton_OnLoad(self); - </OnLoad> - <OnShow> - TitanPanelVolumeButton_OnShow(); - TitanPanelButton_OnShow(self); - </OnShow> - <OnEnter> - TitanPanelVolumeButton_OnEnter(); - TitanPanelButton_OnEnter(self); - </OnEnter> - <OnEvent> - TitanPanelVolumeButton_OnEvent(self, event, ...); - </OnEvent> - </Scripts> - </Button> - <Frame name="TitanPanelVolumeControlFrame" inherits="TitanPanelVolumeControlFrameTemplate" frameStrata="FULLSCREEN" toplevel="true" /> - </Frames> - </Frame> - </Ui> \ No newline at end of file diff --git a/TitanXP/TitanXP.lua b/TitanXP/TitanXP.lua index 2173bd3..44f1452 100644 --- a/TitanXP/TitanXP.lua +++ b/TitanXP/TitanXP.lua @@ -8,6 +8,8 @@ -- ******************************** Constants ******************************* local TITAN_XP_ID = "XP"; +local TITAN_XP_BUTTON = "TitanPanel"..TITAN_XP_ID.."Button" + local _G = getfenv(0); local TITAN_XP_FREQUENCY = 1; local updateTable = {TITAN_XP_ID, TITAN_PANEL_UPDATE_ALL}; @@ -54,7 +56,6 @@ function TitanPanelXPButton_OnLoad(self) controlVariables = { ShowIcon = true, ShowLabelText = true, - ShowRegularText = false, ShowColoredText = false, DisplayOnRightSide = true }, @@ -79,13 +80,15 @@ function TitanPanelXPButton_OnLoad(self) self:RegisterEvent("CHAT_MSG_COMBAT_XP_GAIN"); end +--[[ -- ************************************************************************** -- NAME : TitanPanelXPButton_OnShow() -- DESC : Display the icon in the bar --- NOTE : For a lack of better check at the moment TitanPanel_ButtonAdded +-- NOTE : For a lack of better check at the moment TitanPanelXPButton_ButtonAdded -- is a global variable set to true only when a button has just been -- added to the panel -- ************************************************************************** +--]] function TitanPanelXPButton_OnShow() TitanPanelXPButton_SetIcon(); found = nil; @@ -109,11 +112,13 @@ function TitanPanelXPButton_OnHide() end end +--[[ -- ************************************************************************** -- NAME : TitanPanelXPButton_OnEvent(arg1, arg2) -- DESC : Parse events registered to addon and act on them -- VARS : arg1 = <research> , arg2 = <research> -- ************************************************************************** +--]] function TitanPanelXPButton_OnEvent(self, event, a1, a2, ...) if (event == "PLAYER_ENTERING_WORLD") then if (not self.sessionTime) then @@ -152,11 +157,13 @@ function TitanPanelXPButton_OnEvent(self, event, a1, a2, ...) end end +--[[ -- ************************************************************************** -- NAME : TitanPanelXPButton_OnUpdate(elapsed) -- DESC : Update button data -- VARS : elapsed = <research> -- ************************************************************************** +--]] function TitanPanelXPButton_OnUpdate(self, elapsed) TITAN_XP_FREQUENCY = TITAN_XP_FREQUENCY - elapsed; if (TITAN_XP_FREQUENCY <=0) then @@ -170,6 +177,7 @@ function TitanPanelXPButton_OnUpdate(self, elapsed) end +--[[ -- ************************************************************************** -- NAME : TitanPanelXPButton_GetButtonText(id) -- DESC : Calculate time based logic for button text @@ -177,6 +185,7 @@ end -- NOTE : Because the panel gets loaded before XP we need to check whether -- the variables have been initialized and take action if they haven't -- ************************************************************************** +--]] function TitanPanelXPButton_GetButtonText(id) if (TitanPanelXPButton.startSessionTime == nil) then return; @@ -257,10 +266,12 @@ function TitanPanelXPButton_GetButtonText(id) end end +--[[ -- ************************************************************************** -- NAME : TitanPanelXPButton_GetTooltipText() -- DESC : Display tooltip text -- ************************************************************************** +--]] function TitanPanelXPButton_GetTooltipText() local totalTime = TitanPanelXPButton.totalTime; local sessionTime = time() - TitanPanelXPButton.startSessionTime; @@ -301,10 +312,12 @@ function TitanPanelXPButton_GetTooltipText() L["TITAN_XP_TOOLTIP_TOLEVEL_SESSION"].."\t"..TitanUtils_GetHighlightText(TitanUtils_GetAbbrTimeText(estTimeToLevelThisSession)); end +--[[ -- ************************************************************************** -- NAME : TitanPanelXPButton_SetIcon() -- DESC : Define icon based on faction -- ************************************************************************** +--]] function TitanPanelXPButton_SetIcon() local icon = TitanPanelXPButtonIcon; local factionGroup, factionName = UnitFactionGroup("player"); @@ -338,10 +351,12 @@ TitanDebug("Sep: " TitanPanelButton_UpdateButton(TITAN_XP_ID); end +--[[ -- ************************************************************************** -- NAME : TitanPanelRightClickMenu_PrepareXPMenu() -- DESC : Display rightclick menu options -- ************************************************************************** +--]] function TitanPanelRightClickMenu_PrepareXPMenu() local info = {}; @@ -423,18 +438,15 @@ function TitanPanelRightClickMenu_PrepareXPMenu() end TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); - TitanPanelRightClickMenu_AddSpacer(); - TitanPanelRightClickMenu_AddToggleIcon(TITAN_XP_ID); - TitanPanelRightClickMenu_AddToggleLabelText(TITAN_XP_ID); - TitanPanelRightClickMenu_AddToggleRightSide(TITAN_XP_ID); - TitanPanelRightClickMenu_AddSpacer(); - TitanPanelRightClickMenu_AddCommand(L["TITAN_PANEL_MENU_HIDE"], TITAN_XP_ID, TITAN_PANEL_MENU_FUNC_HIDE); + TitanPanelRightClickMenu_AddControlVars(TITAN_XP_ID) end +--[[ -- ************************************************************************** -- NAME : TitanPanelXPButton_ShowSessionTime() -- DESC : Display session time in bar if set -- ************************************************************************** +--]] function TitanPanelXPButton_ShowSessionTime() TitanSetVar(TITAN_XP_ID, "DisplayType", "ShowSessionTime"); TitanPanelButton_UpdateButton(TITAN_XP_ID); @@ -445,10 +457,12 @@ function TitanPanelXPButton_ShowSessionTime() end +--[[ -- ************************************************************************** -- NAME : TitanPanelXPButton_ShowXPPerHourSession() -- DESC : Display per hour in session data in bar if set -- ************************************************************************** +--]] function TitanPanelXPButton_ShowXPPerHourSession() TitanSetVar(TITAN_XP_ID, "DisplayType", "ShowXPPerHourSession"); TitanPanelButton_UpdateButton(TITAN_XP_ID); @@ -458,10 +472,12 @@ function TitanPanelXPButton_ShowXPPerHourSession() TitanSetVar(TITAN_XP_ID, "ShowSimpleNumOfGains", false); end +--[[ -- ************************************************************************** -- NAME : TitanPanelXPButton_ShowXPPerHourLevel() -- DESC : Display per hour to level data in bar if set -- ************************************************************************** +--]] function TitanPanelXPButton_ShowXPPerHourLevel() TitanSetVar(TITAN_XP_ID, "DisplayType", "ShowXPPerHourLevel"); TitanPanelButton_UpdateButton(TITAN_XP_ID); @@ -471,19 +487,23 @@ function TitanPanelXPButton_ShowXPPerHourLevel() TitanSetVar(TITAN_XP_ID, "ShowSimpleNumOfGains", false); end +--[[ -- ************************************************************************** -- NAME : TitanPanelXPButton_ShowXPSimple() -- DESC : Display simple XP data (% level, rest, xp to level) in bar if set -- ************************************************************************** - function TitanPanelXPButton_ShowXPSimple() +--]] +function TitanPanelXPButton_ShowXPSimple() TitanSetVar(TITAN_XP_ID, "DisplayType", "ShowXPSimple"); TitanPanelButton_UpdateButton(TITAN_XP_ID); end +--[[ -- ************************************************************************** -- NAME : TitanPanelXPButton_ResetSession() -- DESC : Reset session and accumulated variables -- ************************************************************************** +--]] function TitanPanelXPButton_ResetSession() TitanPanelXPButton.initXP = UnitXP("player"); TitanPanelXPButton.accumXP = 0; @@ -492,10 +512,48 @@ function TitanPanelXPButton_ResetSession() lastXP = TitanPanelXPButton.initXP; end +--[[ -- ************************************************************************** -- NAME : TitanPanelXPButton_RefreshPlayed() -- DESC : Get total time played -- ************************************************************************** +--]] function TitanPanelXPButton_RefreshPlayed() RequestTimePlayed(); end + +-- ====== Create needed frames +local function Create_Frames() + if _G[TITAN_XP_BUTTON] then + return -- if already created + end + + -- general container frame + local f = CreateFrame("Frame", nil, UIParent) +-- f:Hide() + + -- Titan plugin button + local window = CreateFrame("Button", TITAN_XP_BUTTON, f, "TitanPanelComboTemplate") + window:SetFrameStrata("FULLSCREEN") + -- Using SetScript("OnLoad", does not work + TitanPanelXPButton_OnLoad(window); +-- TitanPanelButton_OnLoad(window); -- Titan XML template calls this... + + window:SetScript("OnShow", function(self) + TitanPanelXPButton_OnShow() + TitanPanelButton_OnShow(self) + end) + window:SetScript("OnEnter", function(self) + TitanPanelVolumeButton_OnEnter() + TitanPanelButton_OnEnter(self) + end) + window:SetScript("OnEvent", function(self, event, ...) + TitanPanelXPButton_OnEvent(self, event, ...) + end) + window:SetScript("OnUpdate", function(self, elapsed) + TitanPanelXPButton_OnUpdate(self, elapsed) + end) +end + + +Create_Frames() -- do the work diff --git a/TitanXP/TitanXP.toc b/TitanXP/TitanXP.toc index f6f1d6f..5446d49 100644 --- a/TitanXP/TitanXP.toc +++ b/TitanXP/TitanXP.toc @@ -1,10 +1,10 @@ ## Interface: 100000 -## Title: Titan Panel [|cffeda55fXP|r] |cff00aa006.00.04.100000|r +## Title: Titan Panel [|cffeda55fXP|r] |cff00aa006.00.05.100000|r ## Notes: Adds information to Titan Panel about XP earned and time to level ## Author: Titan Panel Development Team (http://www.titanpanel.org) ## SavedVariables: ## OptionalDeps: ## Dependencies: Titan -## Version: 6.00.04.100000 +## Version: 6.00.05.100000 ## X-Child-Of: Titan -TitanXP.xml +TitanXP.lua diff --git a/TitanXP/TitanXP.xml b/TitanXP/TitanXP.xml deleted file mode 100644 index 3cddfc8..0000000 --- a/TitanXP/TitanXP.xml +++ /dev/null @@ -1,29 +0,0 @@ -<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="TitanXP.lua"/> - <Frame parent="UIParent"> - <Frames> - <Button name="TitanPanelXPButton" inherits="TitanPanelComboTemplate" frameStrata="FULLSCREEN" toplevel="true"> - <Scripts> - <OnLoad> - TitanPanelXPButton_OnLoad(self); - TitanPanelButton_OnLoad(self); - </OnLoad> - <OnShow> - TitanPanelXPButton_OnShow(); - TitanPanelButton_OnShow(self); - </OnShow> - <OnHide> - TitanPanelXPButton_OnHide(); - </OnHide> - <OnEvent> - TitanPanelXPButton_OnEvent(self, event, ...); - </OnEvent> - <OnUpdate> - TitanPanelXPButton_OnUpdate(self, elapsed); - </OnUpdate> - </Scripts> - </Button> - </Frames> - </Frame> -</Ui> \ No newline at end of file