Quantcast

Replaced AceConfig with tekKonfig

Adrian L Lange [08-06-09 - 03:48]
Replaced AceConfig with tekKonfig
- Clock disabled
- Size issue
- No color picker
- Dropdown issues
Filename
libs/tekKonfig/tekKonfig.xml
libs/tekKonfig/tekKonfigCheckbox.lua
libs/tekKonfig/tekKonfigDropdown.lua
libs/tekKonfig/tekKonfigGroup.lua
libs/tekKonfig/tekKonfigHeading.lua
libs/tekKonfig/tekKonfigScroll.lua
libs/tekKonfig/tekKonfigSlider.lua
pMinimap.toc
pMinimap_Config.lua
diff --git a/libs/tekKonfig/tekKonfig.xml b/libs/tekKonfig/tekKonfig.xml
new file mode 100644
index 0000000..023bce7
--- /dev/null
+++ b/libs/tekKonfig/tekKonfig.xml
@@ -0,0 +1,8 @@
+<Ui xmlns='http://blizzard.com/wow/ui/'>
+	<Script file='tekKonfigCheckBox.lua'/>
+	<Script file='tekKonfigDropdown.lua'/>
+	<Script file='tekKonfigGroup.lua'/>
+	<Script file='tekKonfigHeading.lua'/>
+	<Script file='tekKonfigScroll.lua'/>
+	<Script file='tekKonfigSlider.lua'/>
+</Ui>
\ No newline at end of file
diff --git a/libs/tekKonfig/tekKonfigCheckbox.lua b/libs/tekKonfig/tekKonfigCheckbox.lua
new file mode 100644
index 0000000..d03f108
--- /dev/null
+++ b/libs/tekKonfig/tekKonfigCheckbox.lua
@@ -0,0 +1,46 @@
+
+local lib, oldminor = LibStub:NewLibrary("tekKonfig-Checkbox", 1)
+if not lib then return end
+
+
+local GameTooltip = GameTooltip
+local function HideTooltip() GameTooltip:Hide() end
+local function ShowTooltip(self)
+	if self.tiptext then
+		GameTooltip:SetOwner(self, "ANCHOR_RIGHT")
+		GameTooltip:SetText(self.tiptext, nil, nil, nil, nil, true)
+	end
+end
+local function OnClick(self) PlaySound(self:GetChecked() and "igMainMenuOptionCheckBoxOn" or "igMainMenuOptionCheckBoxOff") end
+
+
+-- Creates a checkbox.
+-- All args optional but parent is highly recommended
+function lib.new(parent, size, label, ...)
+	local check = CreateFrame("CheckButton", nil, parent)
+	check:SetWidth(size or 26)
+	check:SetHeight(size or 26)
+	if select(1, ...) then check:SetPoint(...) end
+
+	check:SetHitRectInsets(0, -100, 0, 0)
+
+	check:SetNormalTexture("Interface\\Buttons\\UI-CheckBox-Up")
+	check:SetPushedTexture("Interface\\Buttons\\UI-CheckBox-Down")
+	check:SetHighlightTexture("Interface\\Buttons\\UI-CheckBox-Highlight")
+	check:SetDisabledCheckedTexture("Interface\\Buttons\\UI-CheckBox-Check-Disabled")
+	check:SetCheckedTexture("Interface\\Buttons\\UI-CheckBox-Check")
+
+	-- Tooltip bits
+	check:SetScript("OnEnter", ShowTooltip)
+	check:SetScript("OnLeave", HideTooltip)
+
+	-- Sound
+	check:SetScript("OnClick", OnClick)
+
+	-- Label
+	local fs = check:CreateFontString(nil, "ARTWORK", "GameFontHighlight")
+	fs:SetPoint("LEFT", check, "RIGHT", 0, 1)
+	fs:SetText(label)
+
+	return check, fs
+end
diff --git a/libs/tekKonfig/tekKonfigDropdown.lua b/libs/tekKonfig/tekKonfigDropdown.lua
new file mode 100644
index 0000000..2ff43ab
--- /dev/null
+++ b/libs/tekKonfig/tekKonfigDropdown.lua
@@ -0,0 +1,86 @@
+
+local lib, oldminor = LibStub:NewLibrary("tekKonfig-Dropdown", 3)
+if not lib then return end
+oldminor = oldminor or 0
+
+
+local GameTooltip = GameTooltip
+local function HideTooltip() GameTooltip:Hide() end
+local function ShowTooltip(self)
+	if self.frame.tiptext then
+		GameTooltip:SetOwner(self, "ANCHOR_TOPRIGHT")
+		GameTooltip:SetText(self.frame.tiptext, nil, nil, nil, nil, true)
+	end
+end
+local function ShowTooltip2(self) ShowTooltip(self.container) end
+
+
+local function OnClick(self)
+	ToggleDropDownMenu(nil, nil, self:GetParent())
+	PlaySound("igMainMenuOptionCheckBoxOn")
+end
+
+local function OnHide() CloseDropDownMenus() end
+
+
+-- Create a dropdown.
+-- All args optional, parent recommended
+function lib.new(parent, label, ...)
+	local container = CreateFrame("Button", nil, parent)
+	container:SetWidth(149+13) container:SetHeight(32+24)
+	container:SetScript("OnEnter", ShowTooltip)
+	container:SetScript("OnLeave", HideTooltip)
+	if select("#", ...) > 0 then container:SetPoint(...) end
+
+	local name = "tekKonfigDropdown"..GetTime()  -- Sadly, some of these frames must be named
+	local f = CreateFrame("Frame", name, parent)
+	f:SetWidth(149) f:SetHeight(32)
+	f:SetPoint("TOPLEFT", container, -13, -24)
+	f:EnableMouse(true)
+	f:SetScript("OnHide", OnHide)
+	container.frame = f
+
+	local ltex = f:CreateTexture(name.."Left", "ARTWORK")
+	ltex:SetWidth(25) ltex:SetHeight(64)
+	ltex:SetPoint("TOPLEFT", 0, 17)
+	ltex:SetTexture("Interface\\Glues\\CharacterCreate\\CharacterCreate-LabelFrame")
+	ltex:SetTexCoord(0, 0.1953125, 0, 1)
+
+	local rtex = f:CreateTexture(nil, "ARTWORK")
+	rtex:SetWidth(25) rtex:SetHeight(64)
+	rtex:SetPoint("RIGHT")
+	rtex:SetTexture("Interface\\Glues\\CharacterCreate\\CharacterCreate-LabelFrame")
+	rtex:SetTexCoord(0.8046875, 1, 0, 1)
+
+	local mtex = f:CreateTexture(nil, "ARTWORK")
+	mtex:SetWidth(115) mtex:SetHeight(64)
+	mtex:SetPoint("LEFT", ltex, "RIGHT")
+	mtex:SetPoint("RIGHT", rtex, "LEFT")
+	mtex:SetTexture("Interface\\Glues\\CharacterCreate\\CharacterCreate-LabelFrame")
+	mtex:SetTexCoord(0.1953125, 0.8046875, 0, 1)
+
+	local text = f:CreateFontString(name.."Text", "ARTWORK", "GameFontHighlightSmall")
+	text:SetWidth(0) text:SetHeight(10)
+	text:SetPoint("RIGHT", rtex, -43, 2)
+	text:SetJustifyH("RIGHT")
+
+	local button = CreateFrame("Button", nil, f)
+	button:SetWidth(24) button:SetHeight(24)
+	button:SetPoint("TOPRIGHT", rtex, -16, -18)
+	button:SetScript("OnClick", OnClick)
+	button:SetScript("OnEnter", ShowTooltip2)
+	button.container = container
+
+	button:SetNormalTexture("Interface\\ChatFrame\\UI-ChatIcon-ScrollDown-Up")
+	button:SetPushedTexture("Interface\\ChatFrame\\UI-ChatIcon-ScrollDown-Down")
+	button:SetHighlightTexture("Interface\\Buttons\\UI-Common-MouseHilight")
+	button:SetDisabledTexture("Interface\\ChatFrame\\UI-ChatIcon-ScrollDown-Disabled")
+	button:GetHighlightTexture():SetBlendMode("ADD")
+
+	local labeltext = f:CreateFontString(nil, "BACKGROUND", "GameFontNormal")--GameFontHighlight
+	labeltext:SetPoint("BOTTOMLEFT", container, "TOPLEFT", 16-13, 3-24)
+	labeltext:SetText(label)
+
+	return f, text, container, labeltext
+end
+
diff --git a/libs/tekKonfig/tekKonfigGroup.lua b/libs/tekKonfig/tekKonfigGroup.lua
new file mode 100644
index 0000000..d406c54
--- /dev/null
+++ b/libs/tekKonfig/tekKonfigGroup.lua
@@ -0,0 +1,31 @@
+
+local lib, oldminor = LibStub:NewLibrary("tekKonfig-Group", 2)
+if not lib then return end
+
+lib.bg = {
+	bgFile = "Interface\\ChatFrame\\ChatFrameBackground",
+	edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
+	tile = true,
+	tileSize = 16,
+	edgeSize = 16,
+	insets = { left = 5, right = 5, top = 5, bottom = 5 }
+}
+
+
+-- Creates a background box to place behind widgets for visual grouping.
+-- All args optional, parent highly recommended
+function lib.new(parent, label, ...)
+	local box = CreateFrame('Frame', nil, parent)
+	box:SetBackdrop(lib.bg)
+	box:SetBackdropBorderColor(0.4, 0.4, 0.4)
+	box:SetBackdropColor(0.1, 0.1, 0.1)
+	if select('#',...) > 0 then box:SetPoint(...) end
+
+	if label then
+		local fs = box:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
+		fs:SetPoint("BOTTOMLEFT", box, "TOPLEFT", 16, 0)
+		fs:SetText(label)
+	end
+
+	return box
+end
diff --git a/libs/tekKonfig/tekKonfigHeading.lua b/libs/tekKonfig/tekKonfigHeading.lua
new file mode 100644
index 0000000..2c0dc1e
--- /dev/null
+++ b/libs/tekKonfig/tekKonfigHeading.lua
@@ -0,0 +1,24 @@
+
+local lib, oldminor = LibStub:NewLibrary("tekKonfig-Heading", 1)
+if not lib then return end
+
+
+-- Creates a heading and subheading
+-- parent is required, texts are optional
+function lib.new(parent, text, subtext)
+	local title = parent:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
+	title:SetPoint("TOPLEFT", 16, -16)
+	title:SetText(text)
+
+	local subtitle = parent:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall")
+	subtitle:SetHeight(32)
+	subtitle:SetPoint("TOPLEFT", title, "BOTTOMLEFT", 0, -8)
+	subtitle:SetPoint("RIGHT", parent, -32, 0)
+--~ 	nonSpaceWrap="true" maxLines="3"
+	subtitle:SetNonSpaceWrap(true)
+	subtitle:SetJustifyH("LEFT")
+	subtitle:SetJustifyV("TOP")
+	subtitle:SetText(subtext)
+
+	return title, subtitle
+end
diff --git a/libs/tekKonfig/tekKonfigScroll.lua b/libs/tekKonfig/tekKonfigScroll.lua
new file mode 100644
index 0000000..ff69b13
--- /dev/null
+++ b/libs/tekKonfig/tekKonfigScroll.lua
@@ -0,0 +1,80 @@
+
+local lib, oldminor = LibStub:NewLibrary("tekKonfig-Scroll", 2)
+if not lib then return end
+
+lib.bg = {
+	edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
+	tile = true,
+	tileSize = 16,
+	edgeSize = 12,
+	insets = { left = 0, right = 0, top = 5, bottom = 5 }
+}
+
+-- Creates a scrollbar
+-- Parent is required, offset and step are optional
+function lib.new(parent, offset, step)
+	local f = CreateFrame("Slider", nil, parent)
+	f:SetWidth(16)
+
+	f:SetPoint("TOPRIGHT", 0 - (offset or 0), -16 - (offset or 0))
+	f:SetPoint("BOTTOMRIGHT", 0 - (offset or 0), 16 + (offset or 0))
+
+	local up = CreateFrame("Button", nil, f)
+	up:SetPoint("BOTTOM", f, "TOP")
+	up:SetWidth(16) up:SetHeight(16)
+	up:SetNormalTexture("Interface\\Buttons\\UI-ScrollBar-ScrollUpButton-Up")
+	up:SetPushedTexture("Interface\\Buttons\\UI-ScrollBar-ScrollUpButton-Down")
+	up:SetDisabledTexture("Interface\\Buttons\\UI-ScrollBar-ScrollUpButton-Disabled")
+	up:SetHighlightTexture("Interface\\Buttons\\UI-ScrollBar-ScrollUpButton-Highlight")
+
+	up:GetNormalTexture():SetTexCoord(1/4, 3/4, 1/4, 3/4)
+	up:GetPushedTexture():SetTexCoord(1/4, 3/4, 1/4, 3/4)
+	up:GetDisabledTexture():SetTexCoord(1/4, 3/4, 1/4, 3/4)
+	up:GetHighlightTexture():SetTexCoord(1/4, 3/4, 1/4, 3/4)
+	up:GetHighlightTexture():SetBlendMode("ADD")
+
+	up:SetScript("OnClick", function(self)
+		local parent = self:GetParent()
+		parent:SetValue(parent:GetValue() - (step or parent:GetHeight()/2))
+		PlaySound("UChatScrollButton")
+	end)
+
+	local down = CreateFrame("Button", nil, f)
+	down:SetPoint("TOP", f, "BOTTOM")
+	down:SetWidth(16) down:SetHeight(16)
+	down:SetNormalTexture("Interface\\Buttons\\UI-ScrollBar-ScrollDownButton-Up")
+	down:SetPushedTexture("Interface\\Buttons\\UI-ScrollBar-ScrollDownButton-Down")
+	down:SetDisabledTexture("Interface\\Buttons\\UI-ScrollBar-ScrollDownButton-Disabled")
+	down:SetHighlightTexture("Interface\\Buttons\\UI-ScrollBar-ScrollDownButton-Highlight")
+
+	down:GetNormalTexture():SetTexCoord(1/4, 3/4, 1/4, 3/4)
+	down:GetPushedTexture():SetTexCoord(1/4, 3/4, 1/4, 3/4)
+	down:GetDisabledTexture():SetTexCoord(1/4, 3/4, 1/4, 3/4)
+	down:GetHighlightTexture():SetTexCoord(1/4, 3/4, 1/4, 3/4)
+	down:GetHighlightTexture():SetBlendMode("ADD")
+
+	down:SetScript("OnClick", function(self)
+		local parent = self:GetParent()
+		parent:SetValue(parent:GetValue() + (step or parent:GetHeight()/2))
+		PlaySound("UChatScrollButton")
+	end)
+
+	f:SetThumbTexture("Interface\\Buttons\\UI-ScrollBar-Knob")
+	local thumb = f:GetThumbTexture()
+	thumb:SetWidth(16) thumb:SetHeight(24)
+	thumb:SetTexCoord(1/4, 3/4, 1/8, 7/8)
+
+	f:SetScript("OnValueChanged", function(self, value)
+		local min, max = self:GetMinMaxValues()
+		if value == min then up:Disable() else up:Enable() end
+		if value == max then down:Disable() else down:Enable() end
+	end)
+
+	local border = CreateFrame("Frame", nil, f)
+	border:SetPoint("TOPLEFT", up, -5, 5)
+	border:SetPoint("BOTTOMRIGHT", down, 5, -3)
+	border:SetBackdrop(lib.bg)
+	border:SetBackdropBorderColor(TOOLTIP_DEFAULT_COLOR.r, TOOLTIP_DEFAULT_COLOR.g, TOOLTIP_DEFAULT_COLOR.b, 0.5)
+
+	return f, up, down, border
+end
diff --git a/libs/tekKonfig/tekKonfigSlider.lua b/libs/tekKonfig/tekKonfigSlider.lua
new file mode 100644
index 0000000..20f9ca8
--- /dev/null
+++ b/libs/tekKonfig/tekKonfigSlider.lua
@@ -0,0 +1,85 @@
+
+local lib, oldminor = LibStub:NewLibrary("tekKonfig-Slider", 3)
+if not lib then return end
+oldminor = oldminor or 0
+
+
+local GameTooltip = GameTooltip
+local function HideTooltip() GameTooltip:Hide() end
+local function ShowTooltip(self)
+	if self.tiptext then
+		GameTooltip:SetOwner(self, "ANCHOR_RIGHT")
+		GameTooltip:SetText(self.tiptext, nil, nil, nil, nil, true)
+	end
+end
+
+
+local HorizontalSliderBG = {
+	bgFile = "Interface\\Buttons\\UI-SliderBar-Background",
+	edgeFile = "Interface\\Buttons\\UI-SliderBar-Border",
+	edgeSize = 8, tile = true, tileSize = 8,
+	insets = {left = 3, right = 3, top = 6, bottom = 6}
+}
+
+
+if oldminor < 2 then
+	-- Create a slider.
+	-- All args optional, parent recommended
+	-- If lowvalue and highvalue are strings it is assumed they are % values
+	-- and the % is parsed and set as decimal values for min/max
+	function lib.new(parent, label, lowvalue, highvalue, ...)
+		local container = CreateFrame("Frame", nil, parent)
+		container:SetWidth(144)
+		container:SetHeight(17+12+10)
+		if select(1, ...) then container:SetPoint(...) end
+
+		local slider = CreateFrame("Slider", nil, container)
+		slider:SetPoint("LEFT")
+		slider:SetPoint("RIGHT")
+		slider:SetHeight(17)
+		slider:SetHitRectInsets(0, 0, -10, -10)
+		slider:SetOrientation("HORIZONTAL")
+		slider:SetThumbTexture("Interface\\Buttons\\UI-SliderBar-Button-Horizontal") -- Dim: 32x32... can't find API to set this?
+		slider:SetBackdrop(HorizontalSliderBG)
+
+		local text = slider:CreateFontString(nil, "ARTWORK", "GameFontNormal")
+		text:SetPoint("BOTTOM", slider, "TOP")
+		text:SetText(label)
+
+		local low = slider:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall")
+		low:SetPoint("TOPLEFT", slider, "BOTTOMLEFT", -4, 3)
+		low:SetText(lowvalue)
+
+		local high = slider:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall")
+		high:SetPoint("TOPRIGHT", slider, "BOTTOMRIGHT", 4, 3)
+		high:SetText(highvalue)
+
+		if type(lowvalue) == "string" then slider:SetMinMaxValues(tonumber((lowvalue:gsub("%%", "")))/100, tonumber((highvalue:gsub("%%", "")))/100)
+		else slider:SetMinMaxValues(lowvalue, highvalue) end
+
+		-- Tooltip bits
+		slider:SetScript("OnEnter", ShowTooltip)
+		slider:SetScript("OnLeave", HideTooltip)
+
+		return slider, text, container, low, high
+	end
+end
+
+
+-- Create a slider without labels.
+-- All args optional, parent recommended
+function lib.newbare(parent, ...)
+	local slider = CreateFrame("Slider", nil, parent)
+	slider:SetHeight(17)
+	slider:SetWidth(144)
+	if select(1, ...) then slider:SetPoint(...) end
+	slider:SetOrientation("HORIZONTAL")
+	slider:SetThumbTexture("Interface\\Buttons\\UI-SliderBar-Button-Horizontal") -- Dim: 32x32... can't find API to set this?
+	slider:SetBackdrop(HorizontalSliderBG)
+
+	-- Tooltip bits
+	slider:SetScript("OnEnter", ShowTooltip)
+	slider:SetScript("OnLeave", HideTooltip)
+
+	return slider
+end
diff --git a/pMinimap.toc b/pMinimap.toc
index 637a070..ab8a4c3 100644
--- a/pMinimap.toc
+++ b/pMinimap.toc
@@ -12,4 +12,6 @@ libs\LibSharedMedia-3.0.lua

 pMinimap.lua

+libs\tekKonfig\tekKonfig.xml
+
 pMinimap_Config.lua
\ No newline at end of file
diff --git a/pMinimap_Config.lua b/pMinimap_Config.lua
index afe9d2a..efff672 100644
--- a/pMinimap_Config.lua
+++ b/pMinimap_Config.lua
@@ -1 +1 @@
---[[

 Copyright (c) 2009, Adrian L Lange
 All rights reserved.

 You're allowed to use this addon, free of monetary charge,
 but you are not allowed to modify, alter, or redistribute
 this addon without express, written permission of the author.

--]]

local LSM = LibStub('LibSharedMedia-3.0')
local list = LSM:List('font')

local function AddToFontStrings()
	MiniMapMailText:SetFont(LSM:Fetch('font', pMinimapDB.smfont), pMinimapDB.fontsize, pMinimapDB.fontflag)
	MinimapZoneText:SetFont(LSM:Fetch('font', pMinimapDB.smfont), pMinimapDB.fontsize, pMinimapDB.fontflag)

	if(pMinimapDB.clock) then
		TimeManagerClockTicker:SetFont(LSM:Fetch('font', pMinimapDB.smfont), pMinimapDB.fontsize, pMinimapDB.fontflag)
	end
	if(pMinimapDB.coords) then
		pMinimap.Coord.Text:SetFont(LSM:Fetch('font', pMinimapDB.smfont), pMinimapDB.fontsize, pMinimapDB.fontflag)
	end
end

LibStub('AceConfigDialog-3.0'):AddToBlizOptions('pMinimap', 'pMinimap')
LibStub('AceConfig-3.0'):RegisterOptionsTable('pMinimap', {
	name = 'pMinimap Options',
	type = 'group',
	args = {
		mapheader = {
			name = 'Minimap options',
			type = 'header',
			order = 0,
		},
		scale = {
			type = 'range',
			order = 1,
			name = 'Minimap Scale',
			min = 0.50,
			max = 2.50,
			step = 0.01,
			get = function() return pMinimapDB.scale end,
			set = function(_, value)
				pMinimapDB.scale = value
				Minimap:SetScale(value)
			end,
		},
		lock = {
			type = 'toggle',
			order = 2,
			name = 'Unlocked',
			get = function() return pMinimapDB.unlocked end,
			set = function()
				pMinimapDB.unlocked = not pMinimapDB.unlocked

				if(pMinimapDB.unlocked) then
					Minimap:SetBackdropColor(0, 1, 0, 0.5)
				else
					Minimap:SetBackdropColor(unpack(pMinimapDB.colors))
				end
			end
		},
		level = {
			type = 'range',
			order = 3,
			name = 'Frame level',
			min = 1,
			max = 15,
			step = 1,
			get = function() return pMinimapDB.level end,
			set = function(_, value)
				pMinimapDB.level = value
				Minimap:SetFrameLevel(value)
			end
		},
		strata = {
			type = 'select',
			order = 4,
			name = 'Frame Strata',
			values = {['DIALOG'] = 'DIALOG', ['HIGH'] = 'HIGH', ['MEDIUM'] = 'MEDIUM', ['LOW'] = 'LOW', ['BACKGROUND'] = 'BACKGROUND'},
			get = function() return pMinimapDB.strata end,
			set = function(_, strata)
				pMinimapDB.strata = strata
				Minimap:SetFrameStrata(strata)
			end
		},
		mischeader = {
			name = 'Misc modules',
			type = 'header',
			order = 5,
		},
		clock = {
			type = 'toggle',
			order = 6,
			name = 'Clock',
			get = function() return pMinimapDB.clock end,
			set = function()
				pMinimapDB.clock = not pMinimapDB.clock

				if(pMinimapDB.clock) then
					if(not pMinimap.RunClock) then
						pMinimap:CreateClock()
					else
						TimeManagerClockButton:Show()
						TimeManagerClockButton:ClearAllPoints()
						TimeManagerClockButton:SetPoint(pMinimapDB.coords and 'BOTTOMLEFT' or 'BOTTOM', Minimap)
					end
					pMinimap.CALENDAR_UPDATE_PENDING_INVITES()
				else
					TimeManagerClockButton:Hide()
				end

				if(pMinimapDB.coords) then
					pMinimap.Coord:ClearAllPoints()
					pMinimap.Coord:SetPoint(pMinimapDB.clock and 'BOTTOMRIGHT' or 'BOTTOM', Minimap)
				end
			end
		},
		coords = {
			type = 'toggle',
			order = 7,
			name = 'Coords',
			get = function() return pMinimapDB.coords end,
			set = function()
				pMinimapDB.coords = not pMinimapDB.coords

				if(pMinimapDB.coords) then
					if(not pMinimap.Coord) then
						pMinimap:CreateCoords()
					else
						pMinimap.Coord:Show()
						pMinimap.Coord:ClearAllPoints()
						pMinimap.Coord:SetPoint(pMinimapDB.clock and 'BOTTOMRIGHT' or 'BOTTOM', Minimap)
					end
				else
					pMinimap.Coord:Hide()
				end

				if(pMinimapDB.clock) then
					TimeManagerClockButton:ClearAllPoints()
					TimeManagerClockButton:SetPoint(pMinimapDB.coords and 'BOTTOMLEFT' or 'BOTTOM', Minimap)
				end
			end
		},
		mail = {
			type = 'toggle',
			order = 8,
			name = 'Mail',
			get = function() return pMinimapDB.mail end,
			set = function()
				pMinimapDB.mail = not pMinimapDB.mail

				if(pMinimapDB.mail) then
					MiniMapMailIcon:Hide()
					MiniMapMailText:Show()
				else
					MiniMapMailIcon:Show()
					MiniMapMailText:Hide()
				end
			end
		},
		dura = {
			type = 'toggle',
			order = 9,
			name = 'Durability',
			get = function() return pMinimapDB.dura end,
			set = function()
				pMinimapDB.dura = not pMinimapDB.dura

				if(pMinimapDB.dura) then
					DurabilityFrame:SetAlpha(0)
					pMinimap:RegisterEvent('UPDATE_INVENTORY_ALERTS')
					pMinimap.UPDATE_INVENTORY_ALERTS()
				else
					DurabilityFrame:SetAlpha(1)
					pMinimap:UnregisterEvent('UPDATE_INVENTORY_ALERTS')
					Minimap:SetBackdropColor(unpack(pMinimapDB.colors))
				end
			end
		},
		bgheader = {
			name = 'Backdrop options',
			type = 'header',
			order = 10,
		},
		bgthick = {
			type = 'range',
			order = 11,
			name = 'Backdrop Thickness',
			min = 0,
			max = 10,
			step = 0.5,
			get = function() return pMinimapDB.offset end,
			set = function(_, value)
				pMinimapDB.offset = value
				Minimap:SetBackdrop({bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=], insets = {top = - value, left = - value, bottom = - value, right = - value}})
				Minimap:SetBackdropColor(unpack(pMinimapDB.colors))
			end
		},
		bgcolor = {
			type = 'color',
			order = 12,
			name = 'Backdrop Color',
			hasAlpha = true,
			get = function() return unpack(pMinimapDB.colors) end,
			set = function(_, r, g, b, a)
				pMinimapDB.colors = {r, g, b, a}
				Minimap:SetBackdropColor(r, g, b, a)
			end
		},
		zoneheader = {
			name = 'Zone options',
			type = 'header',
			order = 13,
		},
		zoneoffset = {
			type = 'range',
			order = 14,
			name = 'ZoneText offset',
			min = -25,
			max = 25,
			step = 0.5,
			get = function() return pMinimapDB.zoneOffset end,
			set = function(_, value)
				pMinimapDB.zoneOffset = value
				MinimapZoneTextButton:ClearAllPoints()
				MinimapZoneTextButton:SetPoint(pMinimapDB.zonePoint == 'TOP' and 'BOTTOM' or 'TOP', Minimap, pMinimapDB.zonePoint, 0, value)
			end
		},
		zone = {
			type = 'toggle',
			order = 15,
			name = 'ZoneText',
			get = function() return pMinimapDB.zone end,
			set = function()
				pMinimapDB.zone = not pMinimapDB.zone

				if(pMinimapDB.zone) then
					MinimapZoneTextButton:Show()
				else
					MinimapZoneTextButton:Hide()
				end
			end
		},
		zonepoint = {
			type = 'select',
			order = 16,
			name = 'ZoneText point',
			values = {['TOP'] = 'TOP', ['BOTTOM'] = 'BOTTOM'},
			get = function() return pMinimapDB.zonePoint end,
			set = function(_, point)
				pMinimapDB.zonePoint = point

				if(point == 'TOP') then
					MinimapZoneTextButton:ClearAllPoints()
					MinimapZoneTextButton:SetPoint('BOTTOM', Minimap, point, 0, pMinimapDB.zoneOffset)
				else
					MinimapZoneTextButton:ClearAllPoints()
					MinimapZoneTextButton:SetPoint('TOP', Minimap, point, 0, pMinimapDB.zoneOffset)
				end
			end
		},
		fontheader = {
			name = 'Font options',
			type = 'header',
			order = 17,
		},
		font = {
			type = 'select',
			order = 18,
			name = 'Font',
			values = list,
			get = function()
				for k, v in next, list do
					if(v == pMinimapDB.smfont) then
						return k
					end
				end
			end,
			set = function(_, font)
				pMinimapDB.smfont = list[font]
				AddToFontStrings()
			end
		},
		fontflag = {
			type = 'select',
			order = 19,
			name = 'Font flag',
			values = {['OUTLINE'] = 'OUTLINE', ['THICKOUTLINE'] = 'THICKOUTLINE', ['MONOCHROME'] = 'MONOCHROME', ['NONE'] = 'NONE'},
			get = function() return pMinimapDB.fontflag end,
			set = function(_, flag)
				pMinimapDB.fontflag = flag
				AddToFontStrings()
			end
		},
		fontsize = {
			type = 'range',
			order = 20,
			name = 'Font Size',
			min = 5,
			max = 18,
			step = 1,
			get = function() return pMinimapDB.fontsize end,
			set = function(_, value)
				pMinimapDB.fontsize = value
				AddToFontStrings()
			end
		},
		misc2header = {
			name = 'Misc options',
			type = 'header',
			order = 21,
		},
		coordDecimal = {
			type = 'range',
			order = 22,
			name = 'Coords decimals',
			min = 0,
			max = 3,
			step = 1,
			get = function() return pMinimapDB.coordsDecimals end,
			set = function(_, value)
				pMinimapDB.coordsDecimals = value
			end
		},
	}
})
\ No newline at end of file
+local GAP = 20

local SharedMedia = LibStub('LibSharedMedia-3.0')

local group = LibStub('tekKonfig-Group')
local slider = LibStub('tekKonfig-Slider')
local dropdown = LibStub('tekKonfig-Dropdown')
local checkbox = LibStub('tekKonfig-Checkbox')

local function updateFont()
	MiniMapMailText:SetFont(SharedMedia:Fetch('font', pMinimap.db.font), pMinimap.db.fontsize, pMinimap.db.fontflag)
	MinimapZoneText:SetFont(SharedMedia:Fetch('font', pMinimap.db.font), pMinimap.db.fontsize, pMinimap.db.fontflag)
	MinimapCoordinates:SetFont(SharedMedia:Fetch('font', pMinimap.db.font), pMinimap.db.fontsize, pMinimap.db.fontflag)
--	TimeManagerClockTicker:SetFont(SharedMedia:Fetch('font', pMinimap.db.font), pMinimap.db.fontsize, pMinimap.db.fontflag)
end

local function dropStrata()
	local info = UIDropDownMenu_CreateInfo()
	info.func = function(self)
		pMinimap.db.strata = self.value
		Minimap:SetFrameStrata(self.value)
	end

	for k, v in next, {'DIALOG', 'HIGH', 'MEDIUM', 'LOW', 'BACKGROUND'} do
		info.text = v
		info.value = v
		UIDropDownMenu_AddButton(info)
	end
end

local function dropZone()
	local info = UIDropDownMenu_CreateInfo()
	info.func = function(self)
		pMinimap.db.zonepoint = self.value

		MinimapZoneTextButton:ClearAllPoints()
		MinimapZoneTextButton:SetPoint(self.value == 'TOP' and 'BOTTOM' or 'TOP', Minimap, self.value, 0, pMinimap.db.zoneoffset)
	end

	for k, v in next, {'TOP', 'BOTTOM'} do
		info.text = v
		info.value = v
		UIDropDownMenu_AddButton(info)
	end
end

local function dropFont()
	local info = UIDropDownMenu_CreateInfo()
	info.func = function(self)
		pMinimap.db.font = SharedMedia:List('font')[self.value]
		print('|cffff8080pMinimap:|r DEBUG:', pMinimap.db.font)
		updateFont()
	end

	for k, v in next, SharedMedia:List('font') do
		info.text = k
		info.value = v
		UIDropDownMenu_AddButton(info)
	end
end

local function dropFontFlag()
	local info = UIDropDownMenu_CreateInfo()
	info.func = function(self)
		pMinimap.db.fontflag = self.value
		updateFont()
	end

	for k, k in next, {'OUTLINE', 'THICKOUTLINE', 'MONOCHROME', 'NONE'} do
		info.text = v
		info.value = v
		UIDropDownMenu_AddButton(info)
	end
end

local addon = CreateFrame('Frame', nil, InterfaceOptionsFramePanelContainer)
addon.name = 'pMinimap'
addon:Hide()
addon:SetScript('OnShow', function(self)
	local title, subtitle = LibStub('tekKonfig-Heading').new(self, 'pMinimap', 'Options for pMinimap')
	LibStub('tekKonfig-Scroll').new(self, 5)

	local group1 = group.new(self, 'Minimap', 'TOPLEFT', subtitle, 'BOTTOMLEFT')
	group1:SetHeight(120)
	group1:SetWidth(370)

	local scale = slider.new(self, 'Scale', 0.5, 2.5, 'TOPLEFT', group1, 15, -15)
	scale:SetValueStep(0.01)
	scale:SetValue(pMinimap.db.scale)
	scale:SetScript('OnValueChanged', function(self, value)
		pMinimap.db.scale = value
		Minimap:SetScale(value)
	end)

	local level = slider.new(self, 'Framelevel', 1, 15, 'TOPLEFT', scale, 'BOTTOMLEFT', 0, -GAP)
	level:SetValueStep(1)
	level:SetValue(pMinimap.db.level)
	level:SetScript('OnValueChanged', function(self, value)
		pMinimap.db.level = value
		Minimap:SetFrameLevel(value)
	end)

	local strata = dropdown.new(self, 'Framestrata (NYI)', 'LEFT', scale, 'RIGHT', GAP * 2, 0)
	UIDropDownMenu_Initialize(strata, dropStrata)

	local group2 = group.new(self, 'Modules', 'TOPLEFT', group1, 'BOTTOMLEFT', 0, -GAP)
	group2:SetHeight(105)
	group2:SetWidth(370)

	local coordinates = checkbox.new(self, 22, 'Coordinates', 'TOPLEFT', group2, 10, -10)
	coordinates:SetScript('OnClick', function(self)
		pMinimap.db.coordinates = not pMinimap.db.coordinates

		if(pMinimap.db.coordinates) then
			MinimapCoordinates:Show()
			MinimapCoordinates:ClearAllPoints()
			MinimapCoordinates:SetPoint(pMinimap.db.clock and 'BOTTOMRIGHT' or 'BOTTOM')
		else
			MinimapCoordinates:Hide()
		end

		if(pMinimap.db.clock) then
			TimeManagerClockButton:ClearAllPoints()
			TimeManagerClockButton:SetPoint(pMinimap.db.coordinates and 'BOTTOMLEFT' or 'BOTTOM', Minimap)
		end
	end)

	local coordinatesdecimals = slider.new(self, 'Coordinates Decimals', 0, 3, 'TOPRIGHT', group2, -15, -15)
	coordinatesdecimals:SetValueStep(1)
	coordinatesdecimals:SetValue(pMinimap.db.coordinatesdecimals)
	coordinatesdecimals:SetScript('OnValueChanged', function(self, value)
		pMinimap.db.coordinatesdecimals = value
	end)

	local clock = checkbox.new(self, 22, 'Clock (Disabled NYI)', 'TOPLEFT', coordinates, 'BOTTOMLEFT', 0, -GAP / 2)
	clock:Disable()
	clock:SetScript('OnClick', function(self)
		pMinimap.db.clock = not pMinimap.db.clock

		if(pMinimap.db.clock) then
			if(not pMinimap:IsEventRegistered('CALENDAR_UPDATE_PENDING_INVITES')) then
				pMinimap:Clock()
			else
				TimeManagerClockButton:Show()
				TimeManagerClockButton:ClearAllPoints()
				TimeManagerClockButton:SetPoint(pMinimap.db.coordinates and 'BOTTOMLEFT' or 'BOTTOM', Minimap)
			end

			pMinimap.CALENDAR_UPDATE_PENDING_INVITES()
		else
			TimeManagerClockButton:Hide()
		end

		if(pMinimap.coordinates) then
			MinimapCoordinates:ClearAllPoints()
			MinimapCoordinates:SetPoint(pMinimap.db.clock and 'BOTTOMRIGHT' or 'BOTTOM')
		end
	end)

	local mail = checkbox.new(self, nil, 'Mail', 'TOPLEFT', clock, 'BOTTOMLEFT', 0, -GAP / 2)
	mail:SetScript('OnClick', function(self)
		pMinimap.db.mail = not pMinimap.db.mail

		if(pMinimap.db.mail) then
			MiniMapMailIcon:Hide()
			MiniMapMailText:Show()
		else
			MiniMapMailIcon:Show()
			MiniMapMailText:Hide()
		end
	end)

	local durability = checkbox.new(self, nil, 'Durability', 'LEFT', mail, 'RIGHT', GAP * 3, 0)
	durability:SetScript('OnClick', function(self)
		pMinimap.db.durability = not pMinimap.db.durability

		if(pMinimap.db.durability) then
			DurabilityFrame:SetAlpha(0)
			pMinimap:RegisterEvent('UPDATE_INVENTORY_ALERTS')
			pMinimap.UPDATE_INVENTORY_ALERTS()
		else
			DurabilityFrame:SetAlpha(1)
			pMinimap:UnregisterEvent('UPDATE_INVENTORY_ALERTS')
			Minimap:SetBackdropColor(unpack(pMinimap.db.bordercolors))
		end
	end)

	local group3 = group.new(self, 'Background', 'TOPLEFT', group2, 'BOTTOMLEFT', 0, -GAP)
	group3:SetHeight(60)
	group3:SetWidth(370)

	local borderoffset = slider.new(self, 'Thickness', 0, 10, 'TOPLEFT', group3, 15, -15)
	borderoffset:SetValueStep(0.5)
	borderoffset:SetValue(pMinimap.db.borderoffset)
	borderoffset:SetScript('OnValueChanged', function(self, value)
		pMinimap.db.borderoffset = value
		Minimap:SetBackdrop({bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=], insets = {top = - value, bottom = - value, left = - value, right = - value}})
		Minimap:SetBackdropColor(unpack(pMinimap.db.bordercolors))
	end)

	-- bordercolor

	local group4 = group.new(self, 'Zone', 'TOPLEFT', group3, 'BOTTOMLEFT', 0, -GAP)
	group4:SetHeight(95)
	group4:SetWidth(370)

	local zone = checkbox.new(self, 22, 'Zone Toggle', 'TOPLEFT', group4, 10, -10)
	zone:SetScript('OnClick', function(self)
		pMinimap.db.zone = not pMinimap.db.zone

		if(pMinimap.db.zone) then
			MinimapZoneTextButton:Show()
		else
			MinimapZoneTextButton:Hide()
		end
	end)

	local zonepoint = dropdown.new(self, 'Zone Point', 'TOPLEFT', zone, 'BOTTOMLEFT')
	UIDropDownMenu_Initialize(zonepoint, dropZone)

	local zoneoffset = slider.new(self, 'Zone Offset', -25, 25, 'TOPRIGHT', group4, -15, -15)
	zoneoffset:SetValueStep(0.5)
	zoneoffset:SetValue(pMinimap.db.zoneoffset)
	zoneoffset:SetScript('OnValueChanged', function(self, value)
		pMinimap.db.zoneoffset = value
		MinimapZoneTextButton:ClearAllPoints()
		MinimapZoneTextButton:SetPoint(pMinimap.db.zonepoint == 'TOP' and 'BOTTOM' or 'TOP', Minimap, pMinimap.db.zonepoint, 0, value)
	end)

	local group5 = group.new(self, 'Fonts', 'TOPLEFT', group4, 'BOTTOMLEFT', 0, -GAP)
	group5:SetHeight(110)
	group5:SetWidth(370)

	local font = dropdown.new(self, 'Font', 'TOPLEFT', group5, 10, -4)
	UIDropDownMenu_Initialize(font, dropFont)

	local fontflag = dropdown.new(self, 'Font Flag', 'BOTTOMLEFT', group5, 10, 4)
	UIDropDownMenu_Initialize(fontflag, dropFontflag)

	local fontsize = slider.new(self, 'Font Size', 5, 18, 'TOPRIGHT', group5, -15, -15)
	fontsize:SetValueStep(1)
	fontsize:SetValue(pMinimap.db.fontsize)
	fontsize:SetScript('OnValueChanged', function(self, value)
		pMinimap.db.fontsize = value
		updateFont()
	end)

	self:SetScript('OnShow', nil)
end)

InterfaceOptions_AddCategory(addon)
\ No newline at end of file