Added an unread indicator to the book reader.

Jayden Platell [04-29-14 - 22:39]
Added an unread indicator to the book reader.
Filename
Librarian.lua
LibrarianSettings.lua
diff --git a/Librarian.lua b/Librarian.lua
index 4d3eb36..f0605cd 100644
--- a/Librarian.lua
+++ b/Librarian.lua
@@ -96,8 +96,14 @@ function Librarian:AddLoreReaderUnreadToggle()
             name = function()
             	local book = self:FindBook(LORE_READER.titleText)
             	if book.unread then
+            		if self.settings.showUnreadIndicatorInReader then
+            			self.unreadIndicator:SetHidden(false)
+            		else
+            			self.unreadIndicator:SetHidden(true)
+            		end
             		return GetString(SI_LIBRARIAN_MARK_READ)
             	else
+            		self.unreadIndicator:SetHidden(true)
             		return GetString(SI_LIBRARIAN_MARK_UNREAD)
             	end
             end,
@@ -111,6 +117,12 @@ function Librarian:AddLoreReaderUnreadToggle()
         }
         table.insert(LORE_READER.keybindStripDescriptor, toggleKeybind)
     end
+
+    self.unreadIndicator = WINDOW_MANAGER:CreateControl("LibrarianUnreadIndicator", ZO_LoreReaderBookContainer, CT_TEXTURE)
+    self.unreadIndicator:SetAnchor(TOPLEFT, ZO_LoreReaderBookContainerFirstPage, TOPLEFT, -32, 3)
+    self.unreadIndicator:SetDimensions(32, 32)
+    self.unreadIndicator:SetHidden(true)
+    self.unreadIndicator:SetTexture([[EsoUI/Art/Inventory/newitem_icon.dds]])
 end

 function Librarian:UpdateSavedVariables()
diff --git a/LibrarianSettings.lua b/LibrarianSettings.lua
index 913e24e..f629875 100644
--- a/LibrarianSettings.lua
+++ b/LibrarianSettings.lua
@@ -55,6 +55,10 @@ function LibrarianSettings:Initialise(settings)
 		self.settings.alertEnabled = true
 	end

+	if self.settings.showUnreadIndicatorInReader == nil then
+		self.settings.showUnreadIndicatorInReader = true
+	end
+
 	local LAM = LibStub("LibAddonMenu-1.0")
 	local optionsPanel = LAM:CreateControlPanel("LibrarianOptions", "Librarian")

@@ -85,4 +89,11 @@ function LibrarianSettings:Initialise(settings)
 			self.settings.chatEnabled = setting.chat
 			self.settings.alertEnabled = setting.alert
 		end)
+
+	LAM:AddCheckbox(optionsPanel,
+		"LibrarianOptionsUnreadIndicator",
+		"Unread Indicator",
+		"Show unread indicator in book reader",
+		function() return self.settings.showUnreadIndicatorInReader end,
+		function(value) self.settings.showUnreadIndicatorInReader = value end)
 end
\ No newline at end of file