local M,d=...local l=d.DevTool local U=LibStub("\065\099\101\071\085\073-\051\046\048")function l.LoadInterfaceOptions(M)if not M.MainWindow.optionsFrame then local d=CreateFrame("\070\114\097\109\101","\068\101\118\084\111\111\108\079\112\116\105\111\110\115\077\097\105\110\070\114\097\109\101",M.MainWindow,"\068\101\118\084\111\111\108\079\112\116\105\111\110\115\070\114\097\109\101\082\111\119\084\101\109\112\108\097\116\101")d:SetPoint("\066\079\084\084\079\077",M.MainWindow,"\084\079\080")d:SetPoint("\076\069\070\084")d:SetPoint("\082\073\071\072\084")d:Hide()M:CreateColorPickerFrame(d)M.MainWindow.optionsFrame=d end end function l.CreateColorPickerFrame(d,M)local j="\084\079\080\076\069\070\084"local v=M local x="\084\079\080\076\069\070\084"local C=5 local i=-5 for l,A in pairs({"\116\097\098\108\101";"\102\117\110\099\116\105\111\110";"\115\116\114\105\110\103","\110\117\109\098\101\114";"\100\101\102\097\117\108\116"})do local m=U:Create("\067\111\108\111\114\080\105\099\107\101\114")m:SetLabel(A)m:SetHasAlpha(true)m:SetColor(unpack(d.db.profile.colorVals[A]))m.frame:SetParent(M)m.frame:SetPoint(j,v,x,C,i)m.frame:SetWidth(100)m.frame:SetHeight(25)m:SetCallback("\079\110\086\097\108\117\101\067\104\097\110\103\101\100",function(M,l,U,j,v,x)d.db.profile.colorVals[A]={U;j;v,x}d.colors[A]:SetRGBA(U,j,v,x)d:UpdateMainTableUI()end)m.frame:Show()j="\076\069\070\084"v=m.frame x="\082\073\071\072\084"i=0 C=5 end local A=U:Create("\083\108\105\100\101\114")A:SetSliderValues(8,24,1)A:SetValue(d.db.profile.fontSize)A.frame:SetParent(M)A.frame:SetPoint(j,v,x,0,5)A.frame:SetWidth(200)A:SetCallback("\079\110\086\097\108\117\101\067\104\097\110\103\101\100",function(M,U,j)print(j)d.db.profile.fontSize=j l:UpdateMainTableUI()end)A.frame:Show()end
-- DevTool is a World of Warcraft® addon development tool.
-- Copyright (c) 2021-2024 Britt W. Yazel
-- Copyright (c) 2016-2021 Peter aka "Varren"
-- This code is licensed under the MIT license (see LICENSE for details)

local _, addonTable = ... --make use of the default addon namespace
local DevTool = addonTable.DevTool

local AceGUI = LibStub("AceGUI-3.0")

function DevTool:LoadInterfaceOptions()
	if not self.MainWindow.optionsFrame then
		local frame = CreateFrame("Frame", "DevToolOptionsMainFrame", self.MainWindow, "DevToolOptionsFrameRowTemplate")
		frame:SetPoint("BOTTOM", self.MainWindow, "TOP")
		frame:SetPoint("LEFT")
		frame:SetPoint("RIGHT")
		frame:Hide()

		self:CreateColorPickerFrame(frame)
		self.MainWindow.optionsFrame = frame
	end

end

function DevTool:CreateColorPickerFrame(parent)
	local point = "TOPLEFT"
	local relativeTo = parent
	local relativePoint = "TOPLEFT"
	local xOffset = 5
	local yOffset = -5

	-- Color Pickers
	for _, menuItem in pairs({ "table", "function", "string", "number", "default" }) do

		local ColorPicker = AceGUI:Create("ColorPicker")
		ColorPicker:SetLabel(menuItem)
		ColorPicker:SetHasAlpha(true)

		ColorPicker:SetColor(unpack(self.db.profile.colorVals[menuItem]))

		ColorPicker.frame:SetParent(parent)
		ColorPicker.frame:SetPoint(point, relativeTo, relativePoint, xOffset, yOffset)

		ColorPicker.frame:SetWidth(100)
		ColorPicker.frame:SetHeight(25)

		ColorPicker:SetCallback("OnValueChanged", function(widget, event, r, g, b, a)
			self.db.profile.colorVals[menuItem] = { r, g, b, a }
			self.colors[menuItem]:SetRGBA(r, g, b, a)
			self:UpdateMainTableUI()
		end)

		ColorPicker.frame:Show()

		point = "LEFT"
		relativeTo = ColorPicker.frame
		relativePoint = "RIGHT"
		yOffset = 0
		xOffset = 5
	end

	-- Text Size Slider
	local TextSizeSlider = AceGUI:Create("Slider")
	TextSizeSlider:SetSliderValues(8, 24, 1)
	TextSizeSlider:SetValue(self.db.profile.fontSize)

	TextSizeSlider.frame:SetParent(parent)
	TextSizeSlider.frame:SetPoint(point, relativeTo, relativePoint, 0, 5)

	TextSizeSlider.frame:SetWidth(200)

	TextSizeSlider:SetCallback("OnValueChanged", function(widget, event, size)
		print(size)
		self.db.profile.fontSize = size
		DevTool:UpdateMainTableUI()
	end)

	TextSizeSlider.frame:Show()
end