Quantcast

Fixed a ton of bugs

Safturento [12-15-11 - 15:47]
Fixed a ton of bugs
Filename
SaftUI/SaftUI.toc
SaftUI/config/config.lua
SaftUI/core/move.lua
SaftUI/frames/moveframes.lua
SaftUI/modules/chat.lua
diff --git a/SaftUI/SaftUI.toc b/SaftUI/SaftUI.toc
index 3e2b76c..32a2718 100644
--- a/SaftUI/SaftUI.toc
+++ b/SaftUI/SaftUI.toc
@@ -1,6 +1,6 @@
 ## Interface: 40300
 ## Author: Safturento
-## Version: @project-version@
+## Version: 0.1
 ## Title: |cff00aaffSaftUI|r
 ## Notes: Saft's custom edit of Tukui
 ## RequiredDeps: Tukui
diff --git a/SaftUI/config/config.lua b/SaftUI/config/config.lua
index f66180b..bafb8ad 100644
--- a/SaftUI/config/config.lua
+++ b/SaftUI/config/config.lua
@@ -45,4 +45,6 @@ do
 	C.unitframes.gridonly = true
 end

-C.chat.rightLoot = true
\ No newline at end of file
+do
+	C.chat.rightLoot = false
+end
\ No newline at end of file
diff --git a/SaftUI/core/move.lua b/SaftUI/core/move.lua
index e50b6e0..c768f29 100644
--- a/SaftUI/core/move.lua
+++ b/SaftUI/core/move.lua
@@ -26,6 +26,7 @@ local function MoveUI()
 			end
 			bar:SetTemplate()
 			bar:SetBackdropBorderColor(1, 0, 0)
+			if not bar.moveText then bar:AddText("moveText", "", "CENTER") end
 			bar.moveText:SetText(bar:GetName())
 		else
 			for _,button in pairs(T.GetActionButtons()) do
diff --git a/SaftUI/frames/moveframes.lua b/SaftUI/frames/moveframes.lua
index 511d0c2..2720b06 100644
--- a/SaftUI/frames/moveframes.lua
+++ b/SaftUI/frames/moveframes.lua
@@ -5,6 +5,7 @@ local frames = {
 	["TukuiInfoLeft"] = {"TOPLEFT", UIParent, "TOPLEFT", 6, -6},
 	["TukuiInfoRight"] = {"LEFT", TukuiInfoLeft, "RIGHT", 0, 0},
 	["TukuiTooltipAnchor"] = {"BOTTOMRIGHT", UIParent, "BOTTOMRIGHT", 0, 0},
+	["TukuiBags"] = {"BOTTOMRIGHT", UIParent, "BOTTOMRIGHT", -6, 6},
 }

 local function FixVehicleButton()
@@ -29,12 +30,13 @@ OnLoad:SetScript("OnEvent", function()
 	FixVehicleButton()
 end)

+
 hooksecurefunc(Stuffing, "CreateBagFrame", function(self, w)
 	local f
-	print("Tukui"  .. w)
+	self:ClearAllPoints()
 	if w == "Bank" then
 		f = TukuiBank
-		f:SetPoint("BOTTOMRIGHT", TukuiBags, "BOTTOMLEFT", -6, 0)
+		f:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", 6, 6)
 	else
 		f = TukuiBags
 		f:SetPoint("BOTTOMRIGHT", UIParent, "BOTTOMRIGHT", -6, 6)
diff --git a/SaftUI/modules/chat.lua b/SaftUI/modules/chat.lua
index 287ce57..f2d55f4 100644
--- a/SaftUI/modules/chat.lua
+++ b/SaftUI/modules/chat.lua
@@ -1,9 +1,10 @@
 local T, C, L = unpack(Tukui)

-local leftBG = TukuiChatBackgroundLeft
+local leftBG = TukuiChatBackgroundLeft or CreateFrame("Frame", "TukuiChatBackgroundLeft", UIParent)
 local leftTabs = TukuiTabsLeftBackground
-local rightBG = TukuiChatBackgroundRight
+local rightBG = TukuiChatBackgroundRight or CreateFrame("Frame", "TukuiChatBackgroundLeft", UIParent)
 local rightTabs = TukuiTabsRightBackground
+if not C.chat.lootRight and C.chat.background then rightBG:SetBackdrop(nil); rightBG.SetBackdrop = T.dummy end

 local function UpdateChatSizes()
 	rightBG:SetSize(C.chat.rightWidth, C.chat.rightHeight)
@@ -15,44 +16,52 @@ local function SetupBackgrounds()
 		leftBG:ClearAllPoints()
 		leftBG:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", 6, 6)
 	end
-	leftTabs:ClearAllPoints()
-	leftTabs:SetPoint("TOPLEFT", leftBG, "TOPLEFT", 6, -6)
-	leftTabs:SetPoint("TOPRIGHT", TukuiButtonCF1, "TOPLEFT", -4, 0)
-	leftTabs:SetHeight(16)
-	leftTabs:SetTemplate("Transparent")
-	leftTabs:ThickBorder()
+	if leftTabs then
+		leftTabs:ClearAllPoints()
+		leftTabs:SetPoint("TOPLEFT", leftBG, "TOPLEFT", 6, -6)
+		leftTabs:SetPoint("TOPRIGHT", TukuiButtonCF1, "TOPLEFT", -4, 0)
+		leftTabs:SetHeight(16)
+		leftTabs:SetTemplate("Transparent")
+		leftTabs:ThickBorder()
+	end

+	leftBG:SetMovable(true)
 	tinsert(T.AllowFrameMoving, leftBG)
-	if C.chat.rightLoot then
+
+	if C.chat.rightLoot then
+		rightBG:SetMovable(true)
 		tinsert(T.AllowFrameMoving, rightBG)
 		if not rightBG:IsUserPlaced() then
 			rightBG:ClearAllPoints()
 			rightBG:SetPoint("BOTTOMRIGHT", UIParent, "BOTTOMRIGHT", -6, 6)
 		end
-		rightTabs:ClearAllPoints()
-		rightTabs:SetPoint("TOPLEFT", rightBG, "TOPLEFT", 6, -6)
-		rightTabs:SetPoint("TOPRIGHT", TukuiButtonCF4, "TOPLEFT", -4, 0)
-		rightTabs:SetHeight(16)
-	else
-		rightBG:Kill()
-		rightTabs:Kill()
+		if C.chat.background then
+			rightTabs:ClearAllPoints()
+			rightTabs:SetPoint("TOPLEFT", rightBG, "TOPLEFT", 6, -6)
+			rightTabs:SetPoint("TOPRIGHT", TukuiButtonCF4, "TOPLEFT", -4, 0)
+			rightTabs:SetHeight(16)
+		else
+			if rightTabs then rightTabs:Kill() end
+		end
 	end

-	leftBG:SetMovable(true)
-	rightBG:SetMovable(true)

 	if C.chat.background == true then
-		for _, frame in pairs({leftBG, rightBG, leftTabs, rightTabs}) do
-			if frame then
-				frame:SetTemplate("Transparent")
-				frame:ThickBorder()
-			end
+		leftBG:SetTemplate("Transparent")
+		leftBG:ThickBorder()
+		leftTabs:SetTemplate("Transparent")
+		leftTabs:ThickBorder()
+
+		if C.chat.rightLoot then
+			rightBG:SetTemplate("Transparent")
+			rightBG:ThickBorder()
+			rightTabs:SetTemplate("Transparent")
+			rightTabs:ThickBorder()
 		end
 	else
-		rightTabs:Kill()
-		leftTabs:Kill()
+		if leftTabs then leftTabs:Kill() end
 		leftBG:SetBackdrop(nil)
-		rightBG:SetBackdrop(nil)
+		if C.chat.rightLoot then rightBG:SetBackdrop(nil) end
 	end
 end

@@ -72,8 +81,8 @@ local function PositionChatWindows()
 			editbox:SetTemplate()
 			editbox:ThickBorder()
 		else
-			editbox:SetPoint("TOPLEFT", frame, "BOTTOMLEFT", 0, -2)
-			editbox:SetPoint("TOPRIGHT", frame, "BOTTOMRIGHT", 0, -2)
+			editbox:SetPoint("BOTTOMLEFT", frame, "TOPLEFT", 0, 28)
+			editbox:SetPoint("BOTTOMRIGHT", frame, "TOPRIGHT", 0, 28)
 		end
 		TukuiChatchatEditBoxBackground:Kill()

@@ -88,8 +97,8 @@ local function PositionChatWindows()
 			copyButton:SetPoint("TOPRIGHT", frame, "TOPRIGHT", -6, -6)
 		end

-		copyButton:SetHeight(leftTabs:GetHeight())
-		copyButton:SetWidth(leftTabs:GetHeight())
+		copyButton:SetHeight(leftTabs and leftTabs:GetHeight() or 16)
+		copyButton:SetWidth(leftTabs and leftTabs:GetHeight() or 16)
 		copyButton:SetParent(frame)
 		copyButton:SetAlpha(C.chat.background and 1 or 0)
 		copyButton:SetScript("OnEnter", function(self)
@@ -108,12 +117,15 @@ local function PositionChatWindows()
 		end)

 		local anchor = leftBG
-		if i==4 and C.chat.rightLoot then
-			anchor = rightBG
-			FCF_UnDockFrame(frame)
-			frame:SetJustifyH("RIGHT")
-		else
-			frame:SetJustifyH("LEFT")
+		if i==4 then
+			if C.chat.rightLoot then
+				anchor = rightBG
+				FCF_UnDockFrame(frame)
+				frame:SetJustifyH("RIGHT")
+			else
+				FCF_DockFrame(frame)
+				frame:SetJustifyH("LEFT")
+			end
 		end
 		frame:ClearAllPoints()
 		frame:SetPoint("BOTTOMLEFT", anchor, "BOTTOMLEFT", 6, 6)
@@ -198,20 +210,21 @@ local function LoadConfig()
 			leftBG:SetFrameStrata("MEDIUM")
 			leftBG:EnableMouse(true)
 			leftConfig:Show()
-
-			rightBG:SetTemplate("Transparent")
-			rightBG:SetBackdropBorderColor(1, 0, 0)
-			rightBG.moveText:SetText(rightBG:GetName())
-			rightBG:SetFrameStrata("MEDIUM")
-			rightBG:EnableMouse(true)
-			rightConfig:Show()
+			if C.chat.rightLoot then
+				rightBG:SetTemplate("Transparent")
+				rightBG:SetBackdropBorderColor(1, 0, 0)
+				rightBG.moveText:SetText(rightBG:GetName())
+				rightBG:SetFrameStrata("MEDIUM")
+				rightBG:EnableMouse(true)
+				rightConfig:Show()
+			end
 		else
 			if C.chat.background then
 				leftBG:SetTemplate("Transparent")
-				rightBG:SetTemplate("Transparent")
+				if rightBG then rightBG:SetTemplate("Transparent") end
 			else
 				leftBG:SetBackdrop(nil)
-				rightBG:SetBackdrop(nil)
+				if rightBG then rightBG:SetBackdrop(nil) end
 			end
 			leftBG.moveText:SetText("")
 			leftBG:SetFrameStrata("BACKGROUND")
@@ -221,7 +234,7 @@ local function LoadConfig()
 			rightBG.moveText:SetText("")
 			rightBG:SetFrameStrata("BACKGROUND")
 			rightBG:EnableMouse(false)
-			rightConfig:Hide()
+			if rightConfig then rightConfig:Hide() end
 		end


@@ -232,13 +245,17 @@ end
 local function RestoreSavedVariables()
 	if SaftUISaved and SaftUISaved.Chat then
 		chatSaved = SaftUISaved.Chat
-		C.chat.rightWidth = chatSaved.rightWidth or rightBG:GetWidth()
-		C.chat.rightHeight = chatSaved.rightHeight or rightBG:GetHeight()
+		if rightBG then
+			C.chat.rightWidth = chatSaved.rightWidth or rightBG:GetWidth()
+			C.chat.rightHeight = chatSaved.rightHeight or rightBG:GetHeight()
+		end
 		C.chat.leftWidth = chatSaved.leftWidth or leftBG:GetWidth()
 		C.chat.leftHeight = chatSaved.leftHeight or leftBG:GetHeight()
 	else
-		C.chat.rightWidth = rightBG:GetWidth()
-		C.chat.rightHeight = rightBG:GetHeight()
+		if rightBG then
+			C.chat.rightWidth = rightBG:GetWidth()
+			C.chat.rightHeight = rightBG:GetHeight()
+		end
 		C.chat.leftWidth = leftBG:GetWidth()
 		C.chat.leftHeight = leftBG:GetHeight()
 	end