Quantcast

* Fixed the issues with scrolling on enable/disable window

James Whitehead II [02-08-09 - 12:52]
* Fixed the issues with scrolling on enable/disable window
Filename
NinjaLogo.tga
NinjaPanel.lua
diff --git a/NinjaLogo.tga b/NinjaLogo.tga
new file mode 100644
index 0000000..ea21497
Binary files /dev/null and b/NinjaLogo.tga differ
diff --git a/NinjaPanel.lua b/NinjaPanel.lua
index b83eb9a..7ba1ccb 100644
--- a/NinjaPanel.lua
+++ b/NinjaPanel.lua
@@ -684,9 +684,10 @@ frame:SetScript("OnShow", function(frame)
 	local EDGEGAP, ROWHEIGHT, ROWGAP, GAP = 16, 20, 2, 4

 	local function OnEnter(self)
+		local type = NinjaPanel.plugins[self.name].object.type or "Unknown"
 		GameTooltip:SetOwner(self, "ANCHOR_TOPLEFT")
-		GameTooltip:AddLine("Title", nil, nil, nil, true)
-		GameTooltip:AddLine("Info", 1, 1, 1, true)
+		GameTooltip:AddLine(self.name, nil, nil, nil, true)
+		GameTooltip:AddLine(type, 1, 1, 1, true)
 		GameTooltip:Show()
 	end
 	local function OnLeave() GameTooltip:Hide() end
@@ -700,6 +701,8 @@ frame:SetScript("OnShow", function(frame)
 		PlaySound(enabled and "igMainMenuOptionCheckBoxOff" or "igMainMenuOptionCheckBoxOn")
 		Refresh()
 	end
+
+	-- Create rows for each option
 	for i=1,math.floor((305-22)/(ROWHEIGHT + ROWGAP)) do
 		local row = CreateFrame("Button", nil, frame)
 		if not anchor then row:SetPoint("TOP", subtitle, "BOTTOM", 0, -16)
@@ -749,6 +752,7 @@ frame:SetScript("OnShow", function(frame)

 		for i,row in ipairs(rows) do
 			if (i + offset) <= #NinjaPanel.pluginNames then
+				print(offset, NinjaPanel.pluginNames[i], NinjaPanel.pluginNames[i+offset])
 				local name = NinjaPanel.pluginNames[i]
 				local entry = NinjaPanel.plugins[name]
 				local opts = NinjaPanelDB.plugins[name]
@@ -777,7 +781,7 @@ frame:SetScript("OnShow", function(frame)
 	scrollbar:SetPoint("TOP", rows[1], 0, -16)
 	scrollbar:SetPoint("BOTTOM", rows[#rows], 0, 16)
 	scrollbar:SetPoint("RIGHT", -16, 0)
-	scrollbar:SetMinMaxValues(0, math.max(0, #NinjaPanel.pluginNames))
+	scrollbar:SetMinMaxValues(0, math.max(0, #NinjaPanel.pluginNames - #rows))
 	scrollbar:SetValue(0)

 	local f = scrollbar:GetScript("OnValueChanged")
@@ -793,12 +797,22 @@ frame:SetScript("OnShow", function(frame)
 	local enableall = MakeButton()
 	enableall:SetPoint("BOTTOMLEFT", 16, 16)
 	enableall:SetText("Enable All")
-	enableall:SetScript("OnClick", EnableAllAddOns)
+	enableall:SetScript("OnClick", function(button)
+		for idx,name in ipairs(NinjaPanel.pluginNames) do
+			NinjaPanelDB.plugins[name].disabled = nil
+		end
+		Refresh()
+	end)

 	local disableall = MakeButton()
 	disableall:SetPoint("LEFT", enableall, "RIGHT", 4, 0)
 	disableall:SetText("Disable All")
-	disableall:SetScript("OnClick", DisableAllAddOns)
+	disableall:SetScript("OnClick", function(button)
+		for idx,name in ipairs(NinjaPanel.pluginNames) do
+			NinjaPanelDB.plugins[name].disabled = true
+		end
+		Refresh()
+	end)

 	local reload = MakeButton()
 	reload:SetPoint("BOTTOMRIGHT", -16, 16)
@@ -813,9 +827,10 @@ LibStub("tekKonfig-AboutPanel").new("NinjaPanel", "NinjaPanel")
 --      Quicklaunch registration      --
 ----------------------------------------

+-- Icon provided by NinjaKiller (http://ninjakiller.deviantart.com/art/Ninja-Icon-Package-01-56129382)
 local dataobj = LibStub:GetLibrary("LibDataBroker-1.1"):NewDataObject("NinjaPanel-Launcher", {
 	type = "launcher",
-	icon = "Interface\\Icons\\Spell_Nature_StormReach",
+	icon = "Interface\\AddOns\\NinjaPanel\\NinjaLogo",
 	OnClick = function() InterfaceOptionsFrame_OpenToCategory(frame) end,
 })