Quantcast

Added an option to display the skill list in a "compact" format.

pschifferer [03-06-09 - 03:33]
Added an option to display the skill list in a "compact" format.
Added an "auto-buy" option to the shopping list window (but it doesn't do anything yet!).
Filename
CauldronMain.lua
CauldronMain.xml
CauldronMainUI.lua
CauldronShoppingList.lua
CauldronShoppingList.xml
CauldronShoppingListUI.lua
Locale/Cauldron-enUS.lua
diff --git a/CauldronMain.lua b/CauldronMain.lua
index c09ba32..186e10b 100644
--- a/CauldronMain.lua
+++ b/CauldronMain.lua
@@ -111,6 +111,12 @@ function Cauldron:InitPlayer()
 		if not self.db.realm.userdata[self.vars.playername].queue then
 			self.db.realm.userdata[self.vars.playername].queue = CauldronQueue:NewQueue();
 		end
+		if not self.db.realm.userdata[self.vars.playername].options then
+			self.db.realm.userdata[self.vars.playername].options = {
+				autoBuy = false,
+				compactView = false,
+			};
+		end
 		if not self.db.realm.shopping then
 			self.db.realm.shopping = CauldronShopping:NewList();
 		end
@@ -401,7 +407,9 @@ function Cauldron:OnMerchantShow()
 	self:debug("OnMerchantShow enter");
 --@end-alpha@

---	TODO
+	if Cauldron.db.realm.userdata[Cauldron.vars.playername].options.autoBuy then
+		CauldronShopping:AutoBuyShoppingItems(Cauldron.db.realm.shopping, Cauldron.vars.playername);
+	end

 --@alpha@
 	self:debug("OnMerchantShow exit");
diff --git a/CauldronMain.xml b/CauldronMain.xml
index 01af4f9..f44000e 100644
--- a/CauldronMain.xml
+++ b/CauldronMain.xml
@@ -105,6 +105,7 @@
 				</Layers>
 				<Scripts>
 					<OnLoad>
+                        self.isCompact = false;
 						-- self.hasItem = 1;
 					</OnLoad>
 					<OnClick>
diff --git a/CauldronMainUI.lua b/CauldronMainUI.lua
index d880aef..4c6737b 100644
--- a/CauldronMainUI.lua
+++ b/CauldronMainUI.lua
@@ -91,7 +91,6 @@ function Cauldron:Frame_Update()
 --@alpha@
 	self:debug("Frame_Update numTradeSkills: ",numTradeSkills);
 --@end-alpha@
---	local skillOffset = FauxScrollFrame_GetOffset(TradeSkillListScrollFrame);
 	local name, rank, maxRank = GetTradeSkillLine();
 --@alpha@
 	self:debug("Frame_Update name: ",name,"; rank: ",rank,"; maxRank: ",maxRank);
@@ -123,8 +122,8 @@ function Cauldron:Frame_Update()

 	-- update the frame dimensions
     -- <Size x="692" y="465" />
-	CauldronFrame:SetHeight(465);
-	CauldronFrame:SetWidth(692);
+--	CauldronFrame:SetHeight(465);
+--	CauldronFrame:SetWidth(692);

 	-- display skill name, level/progress
 --@alpha@
@@ -240,7 +239,7 @@ function Cauldron:UpdateSkillList()
 --@end-alpha@

 		local skillFrame = _G["CauldronSkillItem"..i];
-
+
 		-- check if we have a frame for this position
 		if not skillFrame then
 			-- create a new frame for the skill information
@@ -249,6 +248,36 @@ function Cauldron:UpdateSkillList()
 									 CauldronSkillListFrameScrollFrameScrollChild,
 									 "CauldronSkillItemFrameTemplate");
 		end
+
+		if self.db.realm.userdata[self.vars.playername].options.compactView then
+		    -- set the height of frame
+		    skillFrame:SetHeight(25);
+		    _G["CauldronSkillItem"..i.."SkillCooldown"]:SetHeight(25);
+
+		    -- rescale the icon frame
+		    _G["CauldronSkillItem"..i.."SkillIcon"]:SetWidth(18);
+		    _G["CauldronSkillItem"..i.."SkillIcon"]:SetHeight(18);
+
+		    -- reposition the name
+		    _G["CauldronSkillItem"..i.."SkillName"]:SetPoint("TOPLEFT", 43, -4);
+
+		    -- hide the category info
+		    _G["CauldronSkillItem"..i.."SkillCategory"]:Hide();
+		else
+		    -- set the height of frame
+		    skillFrame:SetHeight(50);
+		    _G["CauldronSkillItem"..i.."SkillCooldown"]:SetHeight(50);
+
+		    -- rescale the icon frame
+		    _G["CauldronSkillItem"..i.."SkillIcon"]:SetWidth(37);
+		    _G["CauldronSkillItem"..i.."SkillIcon"]:SetHeight(37);
+
+		    -- reposition the name
+		    _G["CauldronSkillItem"..i.."SkillName"]:SetPoint("TOPLEFT", 62, -4);
+
+		    -- show the category info
+		    _G["CauldronSkillItem"..i.."SkillCategory"]:Show();
+		end

 		skillFrame:SetID(i);
 		skillFrame.skillIndex = skillInfo.index;
@@ -1074,7 +1103,8 @@ function Cauldron:OnCauldronUpdate()
 --@alpha@
 	self:debug("OnCauldronUpdate enter");
 --@end-alpha@
-
+
+	--[[
 --	self:Search();
  	local selectionIndex
  	if self.vars.selectionIndex == 0 then
@@ -1082,6 +1112,7 @@ function Cauldron:OnCauldronUpdate()
  	else
  		selectionIndex = self.vars.selectionIndex;
  	end
+ 	--]]

 --@alpha@
 	self:debug("OnCauldronUpdate exit");
@@ -1185,6 +1216,46 @@ function Cauldron:FilterDropDown_Initialize(level)
 		notClickable = true,
 	});

+	if not IsTradeSkillLinked() then
+		local miscTitle = {
+			text = L["View"],
+			isTitle = true,
+			tooltipTitle = "",
+			tooltipText = "",
+		};
+		UIDropDownMenu_AddButton(miscTitle);
+
+		-- favorites
+		local compact = {
+			text = L["Compact"],
+			checked = Cauldron.db.realm.userdata[Cauldron.vars.playername].options.compactView,
+			tooltipTitle = L["Compact"],
+			tooltipText = L["Display a compacted view of the skill list"],
+			func = function(arg1, arg2) Cauldron.db.realm.userdata[Cauldron.vars.playername].options.compactView = not Cauldron.db.realm.userdata[Cauldron.vars.playername].options.compactView; Cauldron:UpdateSkillList(); end,
+			arg1 = "compact",
+			arg2 = "",
+		};
+		UIDropDownMenu_AddButton(compact);
+
+		-- favorites
+		local faves = {
+			text = L["Favorites"],
+			checked = Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[skillName].window.filter.favorites,
+			tooltipTitle = L["Favorites"],
+			tooltipText = L["Display only favorite skills"],
+			func = function(arg1, arg2) Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[skillName].window.filter.favorites = not Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[skillName].window.filter.favorites; Cauldron:UpdateSkillList(); end,
+			arg1 = "favorite",
+			arg2 = "",
+		};
+		UIDropDownMenu_AddButton(faves);
+
+		-- spacer
+		UIDropDownMenu_AddButton({
+			text = "",
+			notClickable = true,
+		});
+	end
+
 	-- sorting

 	local sortingTitle = {
@@ -1323,34 +1394,6 @@ function Cauldron:FilterDropDown_Initialize(level)
 		notClickable = true,
 	});

-	if not IsTradeSkillLinked() then
-		local miscTitle = {
-			text = L["Miscellaneous"],
-			isTitle = true,
-			tooltipTitle = "",
-			tooltipText = "",
-		};
-		UIDropDownMenu_AddButton(miscTitle);
-
-		-- favorites
-		local faves = {
-			text = L["Favorites"],
-			checked = Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[skillName].window.filter.favorites,
-			tooltipTitle = L["Favorites"],
-			tooltipText = L["Display only favorite skills"],
-			func = function(arg1, arg2) Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[skillName].window.filter.favorites = not Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[skillName].window.filter.favorites; Cauldron:UpdateSkillList(); end,
-			arg1 = "favorite",
-			arg2 = "",
-		};
-		UIDropDownMenu_AddButton(faves);
-
-		-- spacer
-		UIDropDownMenu_AddButton({
-			text = "",
-			notClickable = true,
-		});
-	end
-
 	-- reagents availability

 	local reagentsTitle = {
diff --git a/CauldronShoppingList.lua b/CauldronShoppingList.lua
index 153c79d..89882d1 100644
--- a/CauldronShoppingList.lua
+++ b/CauldronShoppingList.lua
@@ -143,3 +143,6 @@ function CauldronShopping:EmptyShoppingList(list, requestor)
 	end

 end
+
+function CauldronShopping:AutoBuyShoppingItems(list, requestor)
+end
diff --git a/CauldronShoppingList.xml b/CauldronShoppingList.xml
index e17dc5f..8a270db 100644
--- a/CauldronShoppingList.xml
+++ b/CauldronShoppingList.xml
@@ -190,6 +190,49 @@
 				</Scripts>
 				<NormalTexture file="Interface\AddOns\Cauldron\Artwork\resize"/>
 			</Button>
+			<CheckButton name="$parentAutoBuyButton" hidden="false" inherits="UICheckButtonTemplate" text="">
+                <Size x="18" y="18" />
+				<Anchors>
+					<Anchor point="BOTTOMLEFT">
+						<Offset x="0" y="0"/>
+					</Anchor>
+				</Anchors>
+                <Layers>
+                    <Layer level="OVERLAY">
+                        <FontString name="$parentText" inherits="GameFontNormal" text="">
+                            <Anchors>
+                                <Anchor point="RIGHT">
+                                    <Offset>
+                                        <AbsDimension x="2" y="0"/>
+                                    </Offset>
+                                </Anchor>
+                            </Anchors>
+                        </FontString>
+                    </Layer>
+                </Layers>
+				<Scripts>
+					<OnLoad>
+						-- self:SetScale(0.625);
+						getglobal(self:GetName().."Text"):SetText(Cauldron:LocaleString("Auto-buy?"));
+						-- self:SetChecked(Cauldron.db.realm.userdata[Cauldron.vars.playername].options.autoBuy);
+					</OnLoad>
+                	<OnEnter>
+						GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
+						GameTooltip:ClearLines();
+						GameTooltip:AddLine(Cauldron:LocaleString("If this option is checked, then any item that is in the list will be automatically purchased when a vendor window is opened, if that vendor has the items."), 1, 1, 1, 1);
+						GameTooltip:Show();
+						CursorUpdate(self);
+                	</OnEnter>
+                	<OnLeave>
+                		GameTooltip:Hide();
+                		ResetCursor();
+                	</OnLeave>
+					<OnClick>
+						PlaySound("igMainMenuOptionCheckBoxOn");
+						Cauldron:AutoBuyShoppingList_OnClick(self);
+					</OnClick>
+				</Scripts>
+			</CheckButton>
 		</Frames>

 		<Scripts>
diff --git a/CauldronShoppingListUI.lua b/CauldronShoppingListUI.lua
index 8e327aa..97eb169 100644
--- a/CauldronShoppingListUI.lua
+++ b/CauldronShoppingListUI.lua
@@ -179,3 +179,9 @@ function Cauldron:UpdateShoppingList()
 	end

 end
+
+function Cauldron:AutoBuyShoppingList_OnClick(button)
+	local checked = button:GetChecked();
+	Cauldron.db.realm.userdata[Cauldron.vars.playername].options.autoBuy = checked;
+end
+
diff --git a/Locale/Cauldron-enUS.lua b/Locale/Cauldron-enUS.lua
index be19c91..2ffdca0 100644
--- a/Locale/Cauldron-enUS.lua
+++ b/Locale/Cauldron-enUS.lua
@@ -20,6 +20,8 @@ L["Shopping list"] = true
 L["Open shopping list window"] = true
 L["Reset"] = true
 L["Resets Cauldron to a fresh state"] = true
+L["Auto-buy?"] = true
+L["If this option is checked, then any item that is in the list will be automatically purchased when a vendor window is opened, if that vendor has the items."] = true

 L["Player known"] = true
 L["Player can learn"] = true
@@ -52,6 +54,9 @@ L["Set the sorting method to use on the skills list"] = true

 L["Reset filters"] = true
 L["Reset all filters on the skills list"] = true
+L["View"] = true
+L["Compact"] = true
+L["Display a compacted view of the skill list"] = true
 L["Filters"] = true
 L["Difficulty"] = true
 L["Optimal"] = true