Skip to content

Commit

Permalink
Wip - Commands bar frame
Browse files Browse the repository at this point in the history
  • Loading branch information
Neogeekmo committed Apr 15, 2024
1 parent 248e57e commit 9394ecb
Show file tree
Hide file tree
Showing 7 changed files with 164 additions and 25 deletions.
2 changes: 1 addition & 1 deletion APR-Recorder.toc
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ Commands.lua
Event.lua

frames/autocompleteLocales.lua
frames/CommandsBar.lua
frames/exportExtraLineText.lua
frames/exportRoute.lua
frames/fillersSelection.lua
frames/QuestionPopUp.lua
frames/RecorderBar.lua
frames/selectButton.lua
frames/StepOptionBar.lua
31 changes: 16 additions & 15 deletions Commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,28 +28,29 @@ function AprRC.command:SlashCmd(input)
return
elseif inputText == "help" or inputText == "h" then
print(L_APR["COMMAND_LIST"] .. ":")
print("|cffeda55f/aprrc grind |r- " .. "Grind")
print("|cffeda55f/aprrc achievement |r- " .. "HasAchievement")
print("|cffeda55f/aprrc button, btn |r- " .. "Button")
print("|cffeda55f/aprrc class |r- " .. "Class")
print("|cffeda55f/aprrc donedb |r- " .. "DoneDB")
print("|cffeda55f/aprrc eta |r- " .. "ETA")
print("|cffeda55f/aprrc export |r- " .. "To export data")
print("|cffeda55f/aprrc faction |r- " .. "Faction")
print("|cffeda55f/aprrc fillers, filler |r- " .. "Fillers")
print("|cffeda55f/aprrc forcereset, fr |r- " .. "Clear the Saved Variables")
print("|cffeda55f/aprrc gender |r- " .. "Gender")
print("|cffeda55f/aprrc race |r- " .. "Race")
print("|cffeda55f/aprrc spelltrigger |r- " .. "SpellTrigger")
print("|cffeda55f/aprrc button, btn |r- " .. "Button")
print("|cffeda55f/aprrc grind |r- " .. "Grind")
print("|cffeda55f/aprrc help, h |r- " .. L_APR["HELP_COMMAND"])
print("|cffeda55f/aprrc noachievement |r- " .. "DontHaveAchievement")
print("|cffeda55f/aprrc achievement |r- " .. "HasAchievement")
print("|cffeda55f/aprrc fillers, filler |r- " .. "Fillers")
print("|cffeda55f/aprrc faction |r- " .. "Faction")
print("|cffeda55f/aprrc noarrow |r- " .. "NoArrow")
print("|cffeda55f/aprrc qpartdb |r- " .. "QpartDB")
print("|cffeda55f/aprrc pickupdb |r- " .. "PickUpDB")
print("|cffeda55f/aprrc waypoint |r- " .. "Waypoint")
print("|cffeda55f/aprrc range |r- " .. "Range")
print("|cffeda55f/aprrc qpartdb |r- " .. "QpartDB")
print("|cffeda55f/aprrc qpartpart |r- " .. "QpartPart")
print("|cffeda55f/aprrc donedb |r- " .. "DoneDB")
print("|cffeda55f/aprrc eta |r- " .. "ETA")
print("|cffeda55f/aprrc zonetrigger |r- " .. "ZoneStepTrigger")
print("|cffeda55f/aprrc race |r- " .. "Race")
print("|cffeda55f/aprrc range |r- " .. "Range")
print("|cffeda55f/aprrc spelltrigger |r- " .. "SpellTrigger")
print("|cffeda55f/aprrc text, txt |r- " .. "ExtraLineText")
print("|cffeda55f/aprrc help, h |r- " .. L_APR["HELP_COMMAND"])
print("|cffeda55f/aprrc forcereset, fr |r- " .. "Clear the Saved Variables")
print("|cffeda55f/aprrc waypoint |r- " .. "Waypoint")
print("|cffeda55f/aprrc zonetrigger |r- " .. "ZoneStepTrigger")
return
end
if CanDoCommand() then
Expand Down
6 changes: 5 additions & 1 deletion Config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ function AprRC.settings:InitializeSettings()
position = {},
isRecording = false,
},
stepOptionBarFrame = {},
commandsBarFrame = {
rotation = "HORIZONTAL",
position = {},
isRecording = false,
},
--debug
enableMinimapButton = true,
debug = false,
Expand Down
2 changes: 2 additions & 0 deletions Core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ AprRC = _G.LibStub("AceAddon-3.0"):NewAddon(AprRC, "APR-Recorder", "AceEvent-3.0
AprRC.Color = {
white = { 1, 1, 1 },
red = { 1, 0, 0 },
darkblue = { 0, 0.5, 0.5 },

}
AprRC.Backdrop = {
defaut = {
Expand Down
128 changes: 128 additions & 0 deletions frames/CommandsBar.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
local _G = _G
local L = LibStub("AceLocale-3.0"):GetLocale("APR-Recorder")
local LibWindow = LibStub("LibWindow-1.1")

AprRC.commandsBar = AprRC:NewModule('CommandsBar')

-- Frame dimensions
local FRAME_WIDTH = 200
local FRAME_HEIGHT = 35
local BUTTON_SIZE = 24
local BUTTON_PADDING = 5

-- ---------------------------------------------------------------------------------------
-- --------------------------------- Command Frames --------------------------------------
-- ---------------------------------------------------------------------------------------

-- -- Create the frame for Command Bar
-- local CommandBarFrame = CreateFrame("Frame", "CommandBarFrame", UIParent, "BackdropTemplate")
-- CommandBarFrame:SetSize(FRAME_WIDTH, FRAME_HEIGHT)
-- CommandBarFrame:SetFrameStrata("MEDIUM")
-- CommandBarFrame:SetClampedToScreen(true)
-- CommandBarFrame:SetBackdrop(AprRC.Backdrop.defaut)
-- CommandBarFrame:SetBackdropColor(unpack(AprRC.Backdrop.defaultBackdrop))

-- -- Define buttons for each command
-- local commands = {
-- "achievement",
-- "button",
-- "class",
-- "donedb",
-- "eta",
-- "faction",
-- "fillers",
-- "gender",
-- "grind",
-- "noachievement",
-- "noarrow",
-- "pickupdb",
-- "qpartdb",
-- "race",
-- "range",
-- "spelltrigger",
-- "text",
-- "waypoint",
-- "zonetrigger",
-- }

-- local buttons = {}
-- for i, cmd in ipairs(commands) do
-- local btn = CreateFrame("Button", "APRCommandBarButton" .. i, CommandBarFrame, "UIPanelButtonTemplate")
-- btn:SetSize(BUTTON_SIZE, BUTTON_SIZE)
-- btn:SetPoint("TOPLEFT", 0, 0)
-- btn:SetText(cmd)
-- btn:SetScript("OnEnter", function(self)
-- GameTooltip:SetOwner(self, "ANCHOR_BOTTOM")
-- GameTooltip:AddLine(cmd, unpack(AprRC.Color.darkblue))
-- GameTooltip:Show()
-- end)
-- btn:SetScript("OnLeave", function(self) GameTooltip:Hide() end)
-- btn:SetScript("OnClick", function()
-- AprRC.command:SlashCmd(cmd)
-- end)
-- table.insert(buttons, btn)
-- end

-- local rotationBtn = CreateButton(RecordBarFrame, "interface/buttons/ui-rotationleft-button-up",
-- AprRC.Color.white, "Rotate")
-- rotationBtn:SetScript("OnClick", function()
-- AprRC.settings.profile.recordBarFrame.rotation = AprRC.settings.profile.recordBarFrame.rotation == "HORIZONTAL" and
-- "VERTICAL" or "HORIZONTAL"
-- AprRC.record:AdjustBarRotation(RecordBarFrame)
-- end)


-- ---------------------------------------------------------------------------------------
-- ----------------------------- Function Command Frames ---------------------------------
-- ---------------------------------------------------------------------------------------
-- function AprRC.commandsBar:OnInit()
-- LibWindow.RegisterConfig(CommandBarFrame, AprRC.settings.profile.recordBarFrame.position)
-- RecordBarFrame.RegisteredForLibWindow = true
-- LibWindow.MakeDraggable(RecordBarFrame)
-- RecordBarFrame:SetPoint("CENTER", UIParent, "CENTER", 0, 0)

-- self:RefreshFrameAnchor()
-- end

-- function AprRC.commandsBar:RefreshFrameAnchor()
-- if not AprRC.settings.profile.enableAddon or C_PetBattles.IsInBattle() then
-- RecordBarFrame:Hide()
-- return
-- end
-- RecordBarFrame:EnableMouse(true)
-- self:AdjustBarRotation(RecordBarFrame)
-- UpdateRecordButton(recordBtn)
-- LibWindow.RestorePosition(RecordBarFrame)
-- RecordBarFrame:Show()
-- end


-- function AprRC.commandsBar:AdjustBarRotation(bar)
-- local buttons = { recordBtn, updateBtn, rotationBtn }
-- local spacing = 10
-- local offsetX, offsetY = 5, -5
-- local rotation = AprRC.settings.profile.recordBarFrame.rotation
-- for i, btn in ipairs(buttons) do
-- if rotation == "HORIZONTAL" then
-- btn:SetPoint("TOPLEFT", offsetX, offsetY)
-- offsetX = offsetX + btn:GetWidth() + spacing
-- else -- VERTICAL
-- btn:SetPoint("TOPLEFT", offsetX, offsetY)
-- offsetY = offsetY - btn:GetHeight() - spacing
-- end
-- end
-- if rotation == "HORIZONTAL" then
-- bar:SetHeight(FRAME_HEIGHT)
-- bar:SetWidth(FRAME_WIDTH + (#buttons - 1) * spacing)
-- else
-- bar:SetWidth(FRAME_HEIGHT)
-- bar:SetHeight(FRAME_WIDTH + (#buttons - 1) * spacing)
-- end
-- end

-- -- Function to update or hide buttons based on conditions
-- function AprRC.commandBar:UpdateButtons()
-- for i, btn in ipairs(buttons) do
-- btn:SetShown(AprRC.settings.profile.recordBarFrame.isRecording)
-- end
-- end
16 changes: 12 additions & 4 deletions frames/RecorderBar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,22 @@ local function UpdateRecordButton(button)
end
end

local function CreateButton(parent, iconPath, color)
local function CreateButton(parent, iconPath, color, message)
local btn = CreateFrame("Button", nil, parent)
btn:SetSize(24, 24)
btn:SetPoint("TOPLEFT", 0, 0)
btn.icon = btn:CreateTexture(nil, "BACKGROUND")
btn.icon:SetAllPoints(btn)
btn.icon:SetTexture(iconPath)
btn.icon:SetVertexColor(unpack(color))
btn:SetScript("OnEnter", function(self)
GameTooltip:SetOwner(self, "ANCHOR_BOTTOM")
GameTooltip:AddLine(message, unpack(AprRC.Color.darkblue))
GameTooltip:Show()
end)
btn:SetScript("OnLeave", function(self) GameTooltip:Hide() end)



btn:SetPushedTexture([[Interface\Buttons\heckbuttonglow]])
btn:SetHighlightTexture([[Interface\Buttons\UI-Panel-MinimizeButton-Highlight]])
Expand All @@ -41,7 +49,7 @@ local function CreateButton(parent, iconPath, color)
return btn
end

local recordBtn = CreateButton(RecordBarFrame, "interface/timemanager/resetbutton", AprRC.Color.red)
local recordBtn = CreateButton(RecordBarFrame, "interface/timemanager/resetbutton", AprRC.Color.red, "Record/Stop")
recordBtn:SetScript("OnClick", function()
AprRC.settings.profile.recordBarFrame.isRecording = not AprRC.settings.profile.recordBarFrame.isRecording
if AprRC.settings.profile.recordBarFrame.isRecording then
Expand Down Expand Up @@ -72,13 +80,13 @@ recordBtn:SetScript("OnClick", function()
end
end)

local updateBtn = CreateButton(RecordBarFrame, "interface/buttons/ui-optionsbutton", AprRC.Color.white)
local updateBtn = CreateButton(RecordBarFrame, "interface/buttons/ui-optionsbutton", AprRC.Color.white, "Setting")
updateBtn:SetScript("OnClick", function()
AprRC.settings:OpenSettings(AprRC.title)
end)

local rotationBtn = CreateButton(RecordBarFrame, "interface/buttons/ui-rotationleft-button-up",
AprRC.Color.white)
AprRC.Color.white, "Rotate")
rotationBtn:SetScript("OnClick", function()
AprRC.settings.profile.recordBarFrame.rotation = AprRC.settings.profile.recordBarFrame.rotation == "HORIZONTAL" and
"VERTICAL" or "HORIZONTAL"
Expand Down
4 changes: 0 additions & 4 deletions frames/StepOptionBar.lua

This file was deleted.

0 comments on commit 9394ecb

Please sign in to comment.