Quantcast

Add unlocking option

Adrian L Lange [08-07-09 - 20:10]
Add unlocking option
Filename
Config.lua
pMinimap.lua
diff --git a/Config.lua b/Config.lua
index 2d95d45..66c6735 100644
--- a/Config.lua
+++ b/Config.lua
@@ -88,7 +88,7 @@ addon:SetScript('OnShow', function(self)
 		Minimap:SetScale(value)
 	end)

-	local level, leveltext = slider.new(self, 'Framelevel: '..pMinimap.db.level, 1, 15, 'TOPLEFT', scale, 'BOTTOMLEFT', 0, -20)
+	local level, leveltext = slider.new(self, 'Framelevel: '..pMinimap.db.level, 1, 15, 'TOPLEFT', scale, 'BOTTOMLEFT', 0, -30)
 	level:SetValueStep(1)
 	level:SetValue(pMinimap.db.level)
 	level:SetScript('OnValueChanged', function(self, value)
@@ -102,6 +102,18 @@ addon:SetScript('OnShow', function(self)
 	strata.text:SetText(pMinimap.db.strata)
 	UIDropDownMenu_Initialize(strata, dropStrata)

+	local lock = checkbox.new(self, 22, 'Locked', 'LEFT', level, 'RIGHT', 45, 0)
+	lock:SetChecked(not pMinimap.unlocked)
+	lock:SetScript('OnClick', function()
+		pMinimap.unlocked = not pMinimap.unlocked
+
+		if(pMinimap.unlocked) then
+			Minimap:SetBackdropColor(0, 1, 0, 0.5)
+		else
+			Minimap:SetBackdropColor(unpack(pMinimap.db.bordercolors))
+		end
+	end)
+
 	local group2 = group.new(self, 'Modules', 'TOPLEFT', group1, 'BOTTOMLEFT', 0, -20)
 	group2:SetHeight(105)
 	group2:SetWidth(370)
diff --git a/pMinimap.lua b/pMinimap.lua
index 2092b7b..b4dd655 100644
--- a/pMinimap.lua
+++ b/pMinimap.lua
@@ -229,6 +229,7 @@ function addon:ADDON_LOADED(event, name)
 	SLASH_pMinimap2 = '/pminimap'
 	SlashCmdList[name] = self.Command

+	self.unlocked = false
 	self.db = setmetatable(pMinimapDB or {}, {__index = defaults})
 	self:UnregisterEvent(event)
 	self:RegisterEvent('ZONE_CHANGED_NEW_AREA')