Skip to content

Commit

Permalink
Add route selection on record
Browse files Browse the repository at this point in the history
  • Loading branch information
Neogeekmo committed May 3, 2024
1 parent 5153ad5 commit 0af00a1
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 7 deletions.
1 change: 1 addition & 0 deletions APR-Recorder.toc
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,5 @@ frames/exportRoute.lua
frames/fillersSelection.lua
frames/QuestionPopUp.lua
frames/RecorderBar.lua
frames/routeSelector.lua
frames/selectButton.lua
15 changes: 8 additions & 7 deletions frames/RecorderBar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,14 @@ local recordBtn = CreateButton(RecordBarFrame, "interface/timemanager/resetbutto
recordBtn:SetScript("OnClick", function()
AprRC.settings.profile.recordBarFrame.isRecording = not AprRC.settings.profile.recordBarFrame.isRecording
if AprRC.settings.profile.recordBarFrame.isRecording then
if AprRCData.CurrentRoute.name ~= "" then
if not AprRC:IsTableEmpty(AprRCData.Routes) then
APR.questionDialog:CreateQuestionPopup(
"New Route?",
"Continue route " .. AprRCData.CurrentRoute.name .. "?",
function()
AprRC.questionDialog:CreateEditBoxPopupWithCallback("Route Name", function(text)
AprRC:InitRoute(text)
UpdateRecordButton(recordBtn)
end)
UpdateRecordButton(recordBtn)
end,
function()
UpdateRecordButton(recordBtn)
AprRC.SelectRoute:Show()
end,
YES,
NO,
Expand Down Expand Up @@ -145,3 +142,7 @@ function AprRC.record:StopRecord()
UpdateRecordButton(recordBtn)
AprRC:UpdateRoute()
end

function AprRC.record:UpdateRecordButton()
UpdateRecordButton(recordBtn)
end
51 changes: 51 additions & 0 deletions frames/routeSelector.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
local AceGUI = LibStub("AceGUI-3.0")

AprRC.SelectRoute = AprRC:NewModule('SelectRoute')

function AprRC.SelectRoute:Show()
local frame = AceGUI:Create("Frame")
frame:SetTitle("Select Route")
frame.statustext:GetParent():Hide()
frame:SetCallback("OnClose", function(widget) AceGUI:Release(widget) end)
frame:SetWidth(600)
frame:SetHeight(100)
frame:SetLayout("Flow")

local dropdown = AceGUI:Create("Dropdown")
dropdown:SetFullWidth(true)
local routeList = {}
for index, route in ipairs(AprRCData.Routes) do
routeList[index] = route.name
end
local selectedRouteName = routeList[1]
dropdown:SetList(routeList)
dropdown:SetValue(1)
frame:AddChild(dropdown)

dropdown:SetCallback("OnValueChanged", function(widget, event, index)
selectedRouteName = routeList[index]
end)

local confirmBtn = AceGUI:Create("Button")
confirmBtn:SetText(CONTINUE)
confirmBtn:SetWidth(200)
confirmBtn:SetCallback("OnClick", function()
local route = AprRC:FindRouteByName(selectedRouteName)
AprRCData.CurrentRoute = { name = selectedRouteName, steps = route.steps }
AceGUI:Release(frame)
AprRC.record:UpdateRecordButton()
end)
frame:AddChild(confirmBtn)

local newRouteBtn = AceGUI:Create("Button")
newRouteBtn:SetText(NEW)
newRouteBtn:SetWidth(200)
newRouteBtn:SetCallback("OnClick", function()
AceGUI:Release(frame)
AprRC.questionDialog:CreateEditBoxPopupWithCallback("Route Name", function(text)
AprRC:InitRoute(text)
AprRC.record:UpdateRecordButton()
end)
end)
frame:AddChild(newRouteBtn)
end

0 comments on commit 0af00a1

Please sign in to comment.