From b33629146ae4595fc3c5ec87a03c231c692a7605 Mon Sep 17 00:00:00 2001 From: Tekkub Stoutwrithe Date: Tue, 7 Aug 2007 19:47:30 +0000 Subject: [PATCH] TourGuide - Starting GUI for guide selection git-svn-id: https://tekkub-wow.googlecode.com/svn/trunk/TourGuide@466 86fe6d9a-1522-0410-a387-bf9db416f0a0 --- A66_67_BladesEdge.lua | 2 +- OHFrame.lua | 17 +----------- OHGuides.lua | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++ StatusFrame.lua | 2 +- TourGuide.lua | 9 ++++++ TourGuide.toc | 1 + 6 files changed, 89 insertions(+), 18 deletions(-) create mode 100644 OHGuides.lua diff --git a/A66_67_BladesEdge.lua b/A66_67_BladesEdge.lua index 751c391..fcba812 100644 --- a/A66_67_BladesEdge.lua +++ b/A66_67_BladesEdge.lua @@ -1,5 +1,5 @@ -TourGuide:RegisterGuide("Blade's Edge Mountains", nil, function() +TourGuide:RegisterGuide("Blade's Edge Mountains (66-68)", nil, function() return [[F Orebor Harborage A No Time for Curiosity A Killing the Crawlers |N|Up the stairs outside the cave| diff --git a/OHFrame.lua b/OHFrame.lua index 0daa1df..b5e7c0c 100644 --- a/OHFrame.lua +++ b/OHFrame.lua @@ -1,9 +1,7 @@ local TourGuide = TourGuide -local OptionHouse = DongleStub("OptionHouse-1.0") local ww = WidgetWarlock -WidgetWarlock = nil local ROWHEIGHT = 26 @@ -13,12 +11,6 @@ local NUMROWS = math.floor(305/(ROWHEIGHT+4)) local offset = 0 -local L = { - Accepted = "Accepted", - Complete = "|cffF07902Complete", - Finished = "|cff00ff00Finished", -} - local function OnShow() offset = TourGuide.current - NUMROWS/2 - 1 @@ -28,9 +20,7 @@ local function OnShow() end -function TourGuide:CreateOHPanel() - local self = TourGuide - +function TourGuide:CreateObjectivePanel() local frame = ww.SummonOptionHouseBaseFrame() frame.rows = {} @@ -52,7 +42,6 @@ function TourGuide:CreateOHPanel() row.text = text row.detail = detail - row.status = status row.check = check row.icon = icon frame.rows[i] = row @@ -88,8 +77,4 @@ function TourGuide:UpdateOHPanel() end -local _, title = GetAddOnInfo("TourGuide") -local author, version = GetAddOnMetadata("TourGuide", "Author"), GetAddOnMetadata("TourGuide", "Version") -local oh = OptionHouse:RegisterAddOn("Tour Guide", title, author, version) -oh:RegisterCategory("Eversong Woods", TourGuide.CreateOHPanel) diff --git a/OHGuides.lua b/OHGuides.lua new file mode 100644 index 0000000..df65fa8 --- /dev/null +++ b/OHGuides.lua @@ -0,0 +1,76 @@ + + +local TourGuide = TourGuide +local OptionHouse = DongleStub("OptionHouse-1.0") +local ww = WidgetWarlock +WidgetWarlock = nil + + +local ROWHEIGHT = 26 +local ROWOFFSET = 4 +local NUMROWS = math.floor(305/(ROWHEIGHT+4)) + + +local offset = 0 + + + +local function OnShow() +--~ offset = TourGuide.current - NUMROWS/2 - 1 +--~ if offset < 0 then offset = 0 +--~ elseif (offset + NUMROWS) > #TourGuide.actions then offset = #TourGuide.actions - NUMROWS end + TourGuide:UpdateGuidesPanel() +end + + +function TourGuide:CreateGuidesPanel() + local frame = ww.SummonOptionHouseBaseFrame() + local w = frame:GetWidth() + + frame.rows = {} + for i=1,NUMROWS do + local row = CreateFrame("Button", nil, frame) + row:SetPoint("TOPLEFT", i == 1 and frame or frame.rows[i-1], i == 1 and "TOPLEFT" or "BOTTOMLEFT", 0, -ROWOFFSET) + row:SetWidth(w/2) + row:SetHeight(ROWHEIGHT) + + local check = ww.SummonCheckBox(ROWHEIGHT, row, "TOPLEFT", ROWOFFSET, 0) + local text = ww.SummonFontString(row, nil, nil, "GameFontNormal", nil, "LEFT", check, "RIGHT", ROWOFFSET, 0) + +--~ check:SetScript("OnClick", function(f) self:SetTurnedIn(row.i, f:GetChecked()) end) + + row.text = text +--~ row.detail = detail + row.check = check +--~ row.icon = icon + frame.rows[i] = row + end + +--~ frame:EnableMouseWheel() +--~ frame:SetScript("OnMouseWheel", function(f, val) +--~ offset = offset - val +--~ if offset < 0 then offset = 0 +--~ elseif (offset + NUMROWS) > #self.actions then offset = #self.actions - NUMROWS end +--~ self:UpdateOHPanel() +--~ end) + + self.OHGuidesFrame = frame + frame:SetScript("OnShow", OnShow) + OnShow() +--~ self:UpdateGuidesPanel() + return frame +end + + +function TourGuide:UpdateGuidesPanel() + if not self.OHGuidesFrame or not self.OHGuidesFrame:IsVisible() then return end + for i,row in ipairs(self.OHGuidesFrame.rows) do +--~ row.i = i + offset + + local name = self.guidelist[i] + + row.text:SetText(name) + row.check:SetChecked(self.db.char.currentguide == name) + end +end + diff --git a/StatusFrame.lua b/StatusFrame.lua index 36e9233..47dd9e1 100644 --- a/StatusFrame.lua +++ b/StatusFrame.lua @@ -150,7 +150,7 @@ end f:SetScript("OnClick", function(self, btn) if btn == "RightButton" then - OptionHouse:Open("Tour Guide", "Eversong Woods") + OptionHouse:Open("Tour Guide", "Objectives") else local i = TourGuide:GetQuestLogIndexByName() if not i then return end diff --git a/TourGuide.lua b/TourGuide.lua index 131d697..8f830fe 100644 --- a/TourGuide.lua +++ b/TourGuide.lua @@ -1,4 +1,7 @@ +local OptionHouse = DongleStub("OptionHouse-1.0") + + TourGuide = DongleStub("Dongle-1.0"):New("TourGuide") TourGuide.guides = {} TourGuide.guidelist = {} @@ -54,6 +57,12 @@ end function TourGuide:Enable() + local _, title = GetAddOnInfo("TourGuide") + local author, version = GetAddOnMetadata("TourGuide", "Author"), GetAddOnMetadata("TourGuide", "Version") + local oh = OptionHouse:RegisterAddOn("Tour Guide", title, author, version) + oh:RegisterCategory("Guides", TourGuide, "CreateGuidesPanel") + oh:RegisterCategory("Objectives", TourGuide, "CreateObjectivePanel") + for _,event in pairs(self.TrackEvents) do self:RegisterEvent(event) end self.TrackEvents = nil self:UpdateStatusFrame() diff --git a/TourGuide.toc b/TourGuide.toc index c149a77..f388503 100644 --- a/TourGuide.toc +++ b/TourGuide.toc @@ -17,6 +17,7 @@ WidgetWarlock.lua TourGuide.lua StatusFrame.lua OHFrame.lua +OHGuides.lua UnlistedQuest.lua QuestTracking.lua -- 2.11.4.GIT