Quantcast

* Too many changes to list

James Whitehead II [12-21-06 - 03:20]
* Too many changes to list
Filename
PerfectRaid.lua
PerfectRaid.toc
PerfectRaid.xml
PerfectRaidOptions.lua
diff --git a/PerfectRaid.lua b/PerfectRaid.lua
index 0a8461a..28d6a2f 100644
--- a/PerfectRaid.lua
+++ b/PerfectRaid.lua
@@ -40,8 +40,8 @@ PerfectRaid.frames = frames
 function PerfectRaid:Initialize()
 	self.defaults = {
 		profile = {
-			headers = {
-			},
+			headers = {},
+			buffs = {},
 		},
 	}

@@ -74,17 +74,25 @@ function PerfectRaid:CreateRaidHeaders()
 	local list = self.db.profile.headers
 	self.headers = self.headers or {}

+	local inraid = GetNumRaidMembers() > 0
+
 	for i=1,#list do
 		local entry = list[i]
 		local name = "PRHeader"..i
 		local filters = strjoin(",", unpack(entry.filters))

 		if self.headers[i] then
-			self:ChangeRaidFrame(name, entry.name, filters)
+			self:ChangeRaidFrame(name, entry.name, filters, entry.strict)
 		else
-			self.headers[i] = self:CreateRaidFrame(name, entry.name, filters)
+			self.headers[i] = self:CreateRaidFrame(name, entry.name, filters, entry.strict)
 			self:RestorePosition("PRHeader"..i)
 		end
+
+		if not inraid then
+			self.headers[i]:Hide()
+		else
+			self.headers[i]:Show()
+		end
 	end
 end

@@ -120,10 +128,11 @@ function PerfectRaid:RestorePosition(name)
 	f:SetPoint("TOPLEFT", UIParent, "BOTTOMLEFT", x, y)
 end

-function PerfectRaid:ChangeRaidFrame(name, title, filter)
+function PerfectRaid:ChangeRaidFrame(name, title, filter, strict)
 	local frame = getglobal(name)
 	frame.title:SetText(title or "")
 	frame:SetAttribute("groupFilter", filter)
+	frame:SetAttribute("strictFiltering", strict)
 	frame:Hide()
 	frame:Show()
 end
@@ -139,7 +148,7 @@ local function OnDragStop(frame)
 	PerfectRaid:SavePosition(parent:GetName())
 end

-function PerfectRaid:CreateRaidFrame(name, title, filter)
+function PerfectRaid:CreateRaidFrame(name, title, filter, strict)
 	local frame = CreateFrame("Frame", name, UIParent, "SecureRaidGroupHeaderTemplate")
 	frame.title = frame:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
 	frame.title:SetPoint("BOTTOM", frame, "TOP", 0, 5)
@@ -150,6 +159,7 @@ function PerfectRaid:CreateRaidFrame(name, title, filter)
 	frame:SetAttribute("templateType", "Button")
 	frame:SetAttribute("yOffset", -2)
 	frame:SetAttribute("sortMethod", "NAME")
+	frame:SetAttribute("strictFiltering", strict)
 	frame.initialConfigFunction = PerfectRaid.ConfigureButton
 	frame:SetMovable(true)
 	frame:SetClampedToScreen(true)
@@ -285,8 +295,8 @@ local function OnShow(frame)
 	frame.name:SetText(self:GetColoredName(unit))
 --	frame.name:SetText(UnitName(unit))

-	local class = select(2, UnitClass(unit))
-	frame.class = class
+	local class = select(2, UnitClass(unit)) or "WARRIOR"
+	frame.class = class
 	frame.classcolor = RAID_CLASS_COLORS[class]
 	frame.manacolor = ManaBarColor[UnitPowerType(unit)]

diff --git a/PerfectRaid.toc b/PerfectRaid.toc
index 2b12022..619f186 100644
--- a/PerfectRaid.toc
+++ b/PerfectRaid.toc
@@ -6,6 +6,7 @@
 ## OptionalDeps: Dongle

 Dongle.lua
+PerfectRaid.xml
 PerfectRaid.lua
 PerfectRaidOptions.lua
 Localization.en.lua
diff --git a/PerfectRaid.xml b/PerfectRaid.xml
new file mode 100644
index 0000000..46d2d3a
--- /dev/null
+++ b/PerfectRaid.xml
@@ -0,0 +1,43 @@
+<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
+..\FrameXML\UI.xsd">
+      <CheckButton name="PRaidIconTemplate" virtual="true">
+                <Size>
+                        <AbsDimension x="36" y="36"/>
+                </Size>
+                <Layers>
+                        <Layer level="BACKGROUND">
+                                <Texture file="Interface\Buttons\UI-EmptySlot-Disabled">
+                                        <Size>
+                                                <AbsDimension x="64" y="64"/>
+                                        </Size>
+                                        <Anchors>
+                                                <Anchor point="CENTER">
+                                                        <Offset>
+                                                                <AbsDimension x="0" y="-1"/>
+                                                        </Offset>
+                                                </Anchor>
+                                        </Anchors>
+                                </Texture>
+                        </Layer>
+                </Layers>
+                <NormalTexture name="$parentIcon">
+                        <Size>
+                                <AbsDimension x="36" y="36"/>
+                        </Size>
+                        <Anchors>
+                                <Anchor point="CENTER">
+                                        <Offset>
+                                                <AbsDimension x="0" y="-1"/>
+                                        </Offset>
+                                </Anchor>
+                        </Anchors>
+                </NormalTexture>
+                <HighlightTexture alphaMode="ADD" file="Interface\Buttons\ButtonHilight-Square"/>
+                <CheckedTexture alphaMode="ADD" file="Interface\Buttons\CheckButtonHilight"/>
+        <Scripts>
+            <OnClick>
+                PerfectRaid:SelectBuffIcon()
+            </OnClick>
+        </Scripts>
+        </CheckButton>
+</Ui>
\ No newline at end of file
diff --git a/PerfectRaidOptions.lua b/PerfectRaidOptions.lua
index 3ba3b3b..01a4a69 100644
--- a/PerfectRaidOptions.lua
+++ b/PerfectRaidOptions.lua
@@ -120,7 +120,7 @@ end

 function PerfectRaid:SkinButton(button)
 	button:SetHeight(24)
-	button:SetWidth(80)
+	button:SetWidth(75)
 	button:SetNormalTexture("Interface\\AddOns\\PerfectRaid\\images\\theme\\ButtonNormal")
 	button:SetHighlightTexture("Interface\\AddOns\\PerfectRaid\\images\\theme\\ButtonHighlight")
 	button.text = button:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall")
@@ -136,6 +136,7 @@ function PerfectRaid:CreateOptions()
 	self:SkinFrame(frame)
 	frame.title:SetText("PerfectRaid Configuration")

+	self.editMode = "Frames"
 	frame:SetScript("OnHide", function() PREditRaid:Hide() end)

 	local function MakeEntry(name, parent)
@@ -190,34 +191,25 @@ function PerfectRaid:CreateOptions()
 	local entries = {entry1, entry2, entry3, entry4, entry5, entry6}
 	local selected = nil

-	local postclick = function(frame)
-		for idx,entry in pairs(entries) do
-			if entry == frame then
-				entry:SetChecked(true)
-				selected = entry
-			else
-				entry:SetChecked(false)
-			end
-		end
-	end
-	for idx,frame in pairs(entries) do
-		frame:SetScript("PostClick", postclick)
-	end
-
 	local button1 = CreateFrame("Button", "PRButtonAdd", frame)
 	self:SkinButton(button1)
-	button1.text:SetText("Add Frame")
+	button1.text:SetText("Add")
 	button1:SetPoint("BOTTOMLEFT", 10, 10)

 	local button2 = CreateFrame("Button", "PRButtonEdit", frame)
 	self:SkinButton(button2)
-	button2.text:SetText("Edit Frame")
-	button2:SetPoint("LEFT", button1, "RIGHT", 10, 0)
+	button2.text:SetText("Edit")
+	button2:SetPoint("LEFT", button1, "RIGHT", 8, 0)

 	local button5 = CreateFrame("Button", "PRButtonDelete", frame)
 	self:SkinButton(button5)
-	button5.text:SetText("Delete Frame")
-	button5:SetPoint("LEFT", button2, "RIGHT", 10, 0)
+	button5.text:SetText("Delete")
+	button5:SetPoint("LEFT", button2, "RIGHT", 8, 0)
+
+	local button6 = CreateFrame("Button", "PRButtonMode", frame)
+	self:SkinButton(button6)
+	button6.text:SetText("Edit Buffs")
+	button6:SetPoint("LEFT", button5, "RIGHT", 8, 0)

 	local scrollframe = CreateFrame("ScrollFrame", "PRScrollFrame", frame, "FauxScrollFrameTemplate")
 	scrollframe:SetPoint("TOPLEFT", entry1, "TOPLEFT", 0, 0)
@@ -236,7 +228,12 @@ function PerfectRaid:CreateOptions()
 	texture:SetGradientAlpha("HORIZONTAL", 0.15, 0.15, 0.15, 0.15, 1, 0.5, 0.25, 0.05, 0)

 	local update = function()
-		local list = self.db.profile.headers
+		local list
+		if self.editMode == "Frames" then
+			list = self.db.profile.headers
+		elseif self.editMode == "Buffs" then
+			list = self.db.profile.buffs
+		end

 		local idx,button
 		local offset = FauxScrollFrame_GetOffset(scrollframe)
@@ -245,13 +242,50 @@ function PerfectRaid:CreateOptions()
 			idx = offset + i
 			button = entries[i]
 			if idx <= #list then
-				button.line1:SetText(list[idx].name)
-				button.line2:SetText(list[idx].desc)
+				local entry = list[idx]
+				button.line1:SetText(entry.name)
+				button.line2:SetText(entry.desc)
 				button:Show()
+				if selected == button then
+					button:SetChecked(true)
+				else
+					button:SetChecked(false)
+				end
 			else
 				button:Hide()
 			end
 		end
+
+		if selected then
+			PRButtonEdit:Enable()
+			PRButtonEdit.text:SetText(PRButtonEdit.oldText)
+			PRButtonDelete:Enable()
+			PRButtonDelete.text:SetText(PRButtonDelete.oldText)
+		else
+			PRButtonEdit:Disable()
+			local text = PRButtonEdit.text:GetText()
+			PRButtonEdit.oldText = PRButtonEdit.oldText or text
+			PRButtonEdit.text:SetText("|cFF444444" .. text .. "|r")
+			PRButtonDelete:Disable()
+			local text = PRButtonDelete.text:GetText()
+			PRButtonDelete.oldText = PRButtonDelete.oldText or text
+			PRButtonDelete.text:SetText("|cFF444444" .. text .. "|r")
+		end
+	end
+
+	local postclick = function(frame)
+		for idx,entry in pairs(entries) do
+			if entry == frame then
+				entry:SetChecked(true)
+				selected = entry
+			else
+				entry:SetChecked(false)
+			end
+		end
+		update()
+	end
+	for idx,frame in pairs(entries) do
+		frame:SetScript("PostClick", postclick)
 	end

 	scrollframe.update = update
@@ -276,7 +310,11 @@ function PerfectRaid:CreateOptions()
 	frame:SetScript("OnHide", function() PRButtonRaidCancel:Click() end)

 	button1:SetScript("OnClick", function()
-		frame:Show()
+		if self.editMode == "Frames" then
+			PREditRaid:Show()
+		elseif self.editMode == "Buffs" then
+			PREditBuff:Show()
+		end
 	end)

 	local edit1 = CreateFrame("EditBox", nil, frame, "InputBoxTemplate")
@@ -403,6 +441,7 @@ function PerfectRaid:CreateOptions()
 			end
 		end

+		entry.strict = Check18:GetChecked()
 		entry.desc = strjoin(", ", unpack(work))
 		entry.filters = filters
 		if not edit then
@@ -423,7 +462,6 @@ function PerfectRaid:CreateOptions()
 	end)

 	button2:SetScript("OnClick", function()
-		if not selected then return end
 		local idx = selected.idx
 		local offset = FauxScrollFrame_GetOffset(scrollframe)
 		local entry = self.db.profile.headers[offset + idx]
@@ -442,15 +480,32 @@ function PerfectRaid:CreateOptions()
 	end)

 	button5:SetScript("OnClick", function()
-		if not selected then return end
 		local idx = selected.idx
 		local offset = FauxScrollFrame_GetOffset(scrollframe)

+		local header = self.headers[offset + idx]
 		table.remove(self.db.profile.headers, offset + idx)
+		header:Hide()
+		header:SetAttribute("groupFilter", nil)
+		header:SetAttribute("nameList", nil)
+		self:CreateRaidHeaders()
 		selected = nil
 		scrollframe.update()
 	end)

+	button6:SetScript("OnClick", function()
+		if self.editMode == "Frames" then
+			self.editMode = "Buffs"
+			button6.text:SetText("Edit Frames")
+			selected = nil
+		elseif self.editMode == "Buffs" then
+			self.editMode = "Frames"
+			button6.text:SetText("Edit Buffs")
+			selected = nil
+		end
+		scrollframe.update()
+	end)
+
 	self:CreateBuffEditWindow()
 end

@@ -464,7 +519,7 @@ function PerfectRaid:CreateBuffEditWindow()
 	frame.title:SetText("Edit Buff Notification")
 	frame:Hide()

-	local buffname = CreateFrame("EditBox", nil, frame, "InputBoxTemplate")
+	local buffname = CreateFrame("EditBox", "PREditBuffName", frame, "InputBoxTemplate")
 	buffname:SetPoint("TOPLEFT", 95, -35)
 	buffname:SetWidth(200)
 	buffname:SetHeight(25)
@@ -474,7 +529,7 @@ function PerfectRaid:CreateBuffEditWindow()
 	buffname.label:SetJustifyH("RIGHT")
 	buffname.label:SetText("Buff Name:")

-	local groupbuff = CreateFrame("EditBox", nil, frame, "InputBoxTemplate")
+	local groupbuff = CreateFrame("EditBox", "PREditGroupName", frame, "InputBoxTemplate")
 	groupbuff:SetPoint("TOPLEFT", buffname, "BOTTOMLEFT", 0, -5)
 	groupbuff:SetWidth(200)
 	groupbuff:SetHeight(25)
@@ -483,8 +538,9 @@ function PerfectRaid:CreateBuffEditWindow()
 	groupbuff.label:SetPoint("RIGHT", groupbuff, "LEFT", -10, 0)
 	groupbuff.label:SetJustifyH("RIGHT")
 	groupbuff.label:SetText("Group Name:")
+	groupbuff:SetFrameStrata("DIALOG")

-	local disptext = CreateFrame("EditBox", nil, frame, "InputBoxTemplate")
+	local disptext = CreateFrame("EditBox", "PREditDispText", frame, "InputBoxTemplate")
 	disptext:SetPoint("TOPLEFT", groupbuff, "BOTTOMLEFT", 0, -5)
 	disptext:SetWidth(200)
 	disptext:SetHeight(25)
@@ -494,6 +550,32 @@ function PerfectRaid:CreateBuffEditWindow()
 	disptext.label:SetJustifyH("RIGHT")
 	disptext.label:SetText("Display Text:")

+	-- Button for icon selection
+
+	local iconbutton = CreateFrame("Button", "PRIconButton", frame)
+	iconbutton.icon = iconbutton:CreateTexture(nil)
+	iconbutton.icon:SetAllPoints()
+	iconbutton.icon:SetTexture("Interface\\Icons\\INV_Misc_QuestionMark")
+	iconbutton:SetHighlightTexture("Interface\\Buttons\\ButtonHilight-Square")
+	iconbutton:GetHighlightTexture():SetBlendMode("ADD")
+	iconbutton:SetHeight(20)
+	iconbutton:SetWidth(20)
+	iconbutton:SetPoint("TOPLEFT", disptext, "BOTTOMLEFT", 0, -5)
+	iconbutton.label = iconbutton:CreateFontString(nil, nil, "GameFontHighlightSmall")
+	iconbutton.label:SetPoint("RIGHT", iconbutton, "LEFT", -10, 0)
+	iconbutton.label:SetJustifyH("RIGHT")
+	iconbutton.label:SetText("or icon:")
+
+    local OnEnter = function()
+        GameTooltip:SetOwner(button, "ANCHOR_TOPLEFT")
+		GameTooltip:SetText("Click here to set icon")
+        GameTooltip:Show()
+    end
+
+    iconbutton:SetScript("OnEnter", OnEnter)
+    iconbutton:SetScript("OnLeave", function() GameTooltip:Hide() end)
+	iconbutton:SetScript("OnClick", function() PRIconSelectFrame:Show() end)
+
 	buffname:SetScript("OnTabPressed", function() groupbuff:SetFocus() end)
 	groupbuff:SetScript("OnTabPressed", function() disptext:SetFocus() end)
 	disptext:SetScript("OnTabPressed", function() buffname:SetFocus() end)
@@ -510,7 +592,7 @@ function PerfectRaid:CreateBuffEditWindow()
 	-- Create buff condition checkboxes.
 	local boxes = {}
 	boxes[1] = makecheck("Warrior", self.conditions.Warrior)
-	boxes[1]:SetPoint("TOPLEFT", disptext, "BOTTOMLEFT", -85, -5)
+	boxes[1]:SetPoint("TOPLEFT", iconbutton, "BOTTOMLEFT", -85, -5)
 	boxes[2] = makecheck("Rogue", self.conditions.Rogue)
 	boxes[2]:SetPoint("LEFT", boxes[1], "RIGHT", 80, 0)
 	boxes[3] = makecheck("Paladin", self.conditions.Paladin)
@@ -536,6 +618,204 @@ function PerfectRaid:CreateBuffEditWindow()
 	boxes[11]:SetPoint("LEFT", boxes[10], "RIGHT", 80, 0)
 	boxes[12] = makecheck("Range", self.conditions.Range)
 	boxes[12]:SetPoint("LEFT", boxes[11], "RIGHT", 80, 0)
+
+	local missing = makecheck("Only display if the given buff is missing")
+	missing:SetPoint("TOPLEFT", boxes[10], "BOTTOMLEFT", 0, -5)
+
+	local saveicon = CreateFrame("Button", "PRButtonBuffSave", frame)
+	self:SkinButton(saveicon)
+	saveicon.text:SetText("Save")
+	saveicon:SetPoint("CENTER", frame, "BOTTOM", -40, 25)
+
+	local cancelicon = CreateFrame("Button", "PRButtonBuffCancel", frame)
+	self:SkinButton(cancelicon)
+	cancelicon.text:SetText("Cancel")
+	cancelicon:SetPoint("CENTER", frame, "BOTTOM", 40, 25)
+
+	-- Macro Frame
+	-- Create the macro icon frame
+
+	local macroframe = CreateFrame("Frame", "PRIconSelectFrame", frame)
+	macroframe:SetWidth(296)
+	macroframe:SetHeight(265)
+	macroframe:SetPoint("CENTER",0,0)
+	self:SkinFrame(macroframe)
+	macroframe:SetFrameStrata("DIALOG")
+	macroframe.title:SetText("Select an icon")
+	macroframe:Hide()
+
+	CreateFrame("CheckButton", "PRIcon1", macroframe, "PRaidIconTemplate")
+	PRIcon1:SetID(1)
+	PRIcon1:SetPoint("TOPLEFT", 25, -35)
+
+	CreateFrame("CheckButton", "PRIcon2", macroframe, "PRaidIconTemplate")
+	PRIcon2:SetID(2)
+	PRIcon2:SetPoint("LEFT", PRIcon1, "RIGHT", 10, 0)
+
+	CreateFrame("CheckButton", "PRIcon3", macroframe, "PRaidIconTemplate")
+	PRIcon3:SetID(3)
+	PRIcon3:SetPoint("LEFT", PRIcon2, "RIGHT", 10, 0)
+
+	CreateFrame("CheckButton", "PRIcon4", macroframe, "PRaidIconTemplate")
+	PRIcon4:SetID(4)
+	PRIcon4:SetPoint("LEFT", PRIcon3, "RIGHT", 10, 0)
+
+	CreateFrame("CheckButton", "PRIcon5", macroframe, "PRaidIconTemplate")
+	PRIcon5:SetID(5)
+	PRIcon5:SetPoint("LEFT", PRIcon4, "RIGHT", 10, 0)
+
+	CreateFrame("CheckButton", "PRIcon6", macroframe, "PRaidIconTemplate")
+	PRIcon6:SetID(6)
+	PRIcon6:SetPoint("TOPLEFT", PRIcon1, "BOTTOMLEFT", 0, -10)
+
+	CreateFrame("CheckButton", "PRIcon7", macroframe, "PRaidIconTemplate")
+	PRIcon7:SetID(7)
+	PRIcon7:SetPoint("LEFT", PRIcon6, "RIGHT", 10, 0)
+
+	CreateFrame("CheckButton", "PRIcon8", macroframe, "PRaidIconTemplate")
+	PRIcon8:SetID(8)
+	PRIcon8:SetPoint("LEFT", PRIcon7, "RIGHT", 10, 0)
+
+	CreateFrame("CheckButton", "PRIcon9", macroframe, "PRaidIconTemplate")
+	PRIcon9:SetID(9)
+	PRIcon9:SetPoint("LEFT", PRIcon8, "RIGHT", 10, 0)
+
+	CreateFrame("CheckButton", "PRIcon10", macroframe, "PRaidIconTemplate")
+	PRIcon10:SetID(10)
+	PRIcon10:SetPoint("LEFT", PRIcon9, "RIGHT", 10, 0)
+
+	CreateFrame("CheckButton", "PRIcon11", macroframe, "PRaidIconTemplate")
+	PRIcon11:SetID(11)
+	PRIcon11:SetPoint("TOPLEFT", PRIcon6, "BOTTOMLEFT", 0, -10)
+
+	CreateFrame("CheckButton", "PRIcon12", macroframe, "PRaidIconTemplate")
+	PRIcon12:SetID(12)
+	PRIcon12:SetPoint("LEFT", PRIcon11, "RIGHT", 10, 0)
+
+	CreateFrame("CheckButton", "PRIcon13", macroframe, "PRaidIconTemplate")
+	PRIcon13:SetID(13)
+	PRIcon13:SetPoint("LEFT", PRIcon12, "RIGHT", 10, 0)
+
+	CreateFrame("CheckButton", "PRIcon14", macroframe, "PRaidIconTemplate")
+	PRIcon14:SetID(14)
+	PRIcon14:SetPoint("LEFT", PRIcon13, "RIGHT", 10, 0)
+
+	CreateFrame("CheckButton", "PRIcon15", macroframe, "PRaidIconTemplate")
+	PRIcon15:SetID(15)
+	PRIcon15:SetPoint("LEFT", PRIcon14, "RIGHT", 10, 0)
+
+	CreateFrame("CheckButton", "PRIcon16", macroframe, "PRaidIconTemplate")
+	PRIcon16:SetID(16)
+	PRIcon16:SetPoint("TOPLEFT", PRIcon11, "BOTTOMLEFT", 0, -10)
+
+	CreateFrame("CheckButton", "PRIcon17", macroframe, "PRaidIconTemplate")
+	PRIcon17:SetID(17)
+	PRIcon17:SetPoint("LEFT", PRIcon16, "RIGHT", 10, 0)
+
+	CreateFrame("CheckButton", "PRIcon18", macroframe, "PRaidIconTemplate")
+	PRIcon18:SetID(18)
+	PRIcon18:SetPoint("LEFT", PRIcon17, "RIGHT", 10, 0)
+
+	CreateFrame("CheckButton", "PRIcon19", macroframe, "PRaidIconTemplate")
+	PRIcon19:SetID(19)
+	PRIcon19:SetPoint("LEFT", PRIcon18, "RIGHT", 10, 0)
+
+	CreateFrame("CheckButton", "PRIcon20", macroframe, "PRaidIconTemplate")
+	PRIcon20:SetID(20)
+	PRIcon20:SetPoint("LEFT", PRIcon19, "RIGHT", 10, 0)
+
+	local scrollframe = CreateFrame("ScrollFrame", "PRIconScrollFrame", macroframe, "FauxScrollFrameTemplate")
+	scrollframe:SetPoint("TOPLEFT", PRIcon1, "TOPLEFT", 0, 0)
+	scrollframe:SetPoint("BOTTOMRIGHT", PRIcon20, "BOTTOMRIGHT", 10, 0)
+
+	local texture = scrollframe:CreateTexture(nil, "BACKGROUND")
+	texture:SetTexture("Interface\\ChatFrame\\ChatFrameBackground")
+	texture:SetPoint("TOPLEFT", scrollframe, "TOPRIGHT", 14, 0)
+	texture:SetPoint("BOTTOMRIGHT", 23, 0)
+	texture:SetVertexColor(0.3, 0.3, 0.3)
+
+	local texture = scrollframe:CreateTexture(nil, "BACKGROUND")
+	texture:SetTexture("Interface\\ChatFrame\\ChatFrameBackground")
+	texture:SetPoint("TOPLEFT", scrollframe, "TOPRIGHT", 4, 0)
+	texture:SetPoint("BOTTOMRIGHT", 14,0)
+	texture:SetVertexColor(0.3, 0.3, 0.3)
+
+	scrollframe:SetScript("OnVerticalScroll", function()
+		local MACRO_ICON_ROW_HEIGHT = 36
+		FauxScrollFrame_OnVerticalScroll(MACRO_ICON_ROW_HEIGHT, function() self:UpdateIconFrame() end)
+	end)
+
+	macroframe:SetScript("OnShow", function() self:UpdateIconFrame() end)
+
+	local saveicon = CreateFrame("Button", "PRButtonIconSave", macroframe)
+	self:SkinButton(saveicon)
+	saveicon.text:SetText("Save")
+	saveicon:SetPoint("CENTER", macroframe, "BOTTOM", -40, 25)
+
+	local cancelicon = CreateFrame("Button", "PRButtonIconCancel", macroframe)
+	self:SkinButton(cancelicon)
+	cancelicon.text:SetText("Cancel")
+	cancelicon:SetPoint("CENTER", macroframe, "BOTTOM", 40, 25)
+
+	PRButtonBuffSave:SetScript("OnClick", function()
+		local list = self.db.profile.buffs
+		local entry = {}
+
+		entry.name = buffname:GetText()
+		entry.desc = disptext:GetText() or iconbutton.icon:GetTexture()
+		table.insert(list, entry)
+		PRButtonBuffCancel:Click()
+	end)
+
+	PRButtonBuffCancel:SetScript("OnClick", function()
+		PREditBuff:Hide()
+		for k,v in ipairs(boxes) do
+			v:SetChecked(nil)
+			buffname:SetText("")
+			groupbuff:SetText("")
+			disptext:SetText("")
+			iconbutton.icon:SetTexture("Interface\\Icons\\INV_Misc_QuestionMark")
+		end
+		missing:SetChecked(false)
+	end)
+end
+
+function PerfectRaid:SelectBuffIcon()
+	local texture = this.icon:GetTexture()
+	PRIconButton.icon:SetTexture(texture)
+	PRIconSelectFrame:Hide()
+end
+
+function PerfectRaid:UpdateIconFrame()
+    local MAX_MACROS = 18;
+    local NUM_MACRO_ICONS_SHOWN = 20;
+    local NUM_ICONS_PER_ROW = 5;
+    local NUM_ICON_ROWS = 4;
+    local MACRO_ICON_ROW_HEIGHT = 36;
+    local macroPopupOffset = FauxScrollFrame_GetOffset(PRIconScrollFrame);
+    local numMacroIcons = GetNumMacroIcons();
+
+    -- Icon list
+    for i=1, NUM_MACRO_ICONS_SHOWN do
+        macroPopupIcon = getglobal("PRIcon"..i.."Icon");
+        macroPopupButton = getglobal("PRIcon"..i);
+
+        if not macroPopupButton.icon then
+            macroPopupButton.icon = macroPopupIcon
+        end
+
+        index = (macroPopupOffset * NUM_ICONS_PER_ROW) + i;
+        if ( index <= numMacroIcons ) then
+            macroPopupIcon:SetTexture(GetMacroIconInfo(index));
+            macroPopupButton:Show();
+        else
+            macroPopupIcon:SetTexture("");
+            macroPopupButton:Hide();
+        end
+        macroPopupButton:SetChecked(nil);
+    end
+
+    FauxScrollFrame_Update(PRIconScrollFrame, ceil(numMacroIcons / NUM_ICONS_PER_ROW) , NUM_ICON_ROWS, MACRO_ICON_ROW_HEIGHT );
 end

 PerfectRaid.conditions = {
@@ -586,4 +866,4 @@ PerfectRaid.conditions = {
 		local _,class = UnitClass(u)
 		return class == "PRIEST" or class == "WARLOCK" or class == "DRUID" or class == "MAGE" or class == "HUNTER" or class == "SHAMAN"
 	end,
-}
\ No newline at end of file
+}