- All the changes required for the Chart Viewer 2.0.

- Fixed the options panel open bug.
This commit is contained in:
Tercio
2015-02-06 20:34:21 -02:00
parent 43996cf0d7
commit ad76abfd00
6 changed files with 119 additions and 51 deletions
+5 -5
View File
File diff suppressed because one or more lines are too long
+82 -42
View File
@@ -16,6 +16,8 @@ local cleanfunction = function() end
local PanelMetaFunctions = {}
local APIFrameFunctions
simple_panel_counter = 1
------------------------------------------------------------------------------------------------------------
--> metatables
@@ -1223,6 +1225,49 @@ function gump:IconPick (callback, close_when_select)
end
function gump:CreateSimplePanel (parent, w, h, title, name)
if (not name) then
name = "DetailsSimplePanel" .. simple_panel_counter
simple_panel_counter = simple_panel_counter + 1
end
if (not parent) then
parent = UIParent
end
local f = CreateFrame ("frame", name, UIParent)
f:SetSize (w or 400, h or 250)
f:SetPoint ("center", UIParent, "center", 0, 0)
f:SetFrameStrata ("FULLSCREEN")
f:EnableMouse()
f:SetMovable (true)
tinsert (UISpecialFrames, name)
f:SetScript ("OnMouseDown", simple_panel_mouse_down)
f:SetScript ("OnMouseUp", simple_panel_mouse_up)
local bg = f:CreateTexture (nil, "background")
bg:SetAllPoints (f)
bg:SetTexture ([[Interface\AddOns\Details\images\welcome]])
local close = CreateFrame ("button", name .. "Close", f, "UIPanelCloseButton")
close:SetSize (32, 32)
close:SetPoint ("topright", f, "topright", 0, -12)
f.title = gump:CreateLabel (f, title or "", 12, nil, "GameFontNormal")
f.title:SetPoint ("top", f, "top", 0, -22)
f.SetTitle = simple_panel_settitle
simple_panel_counter = simple_panel_counter + 1
return f
end
------------------------------------------------------------------------------------------------------------------------------------------------
--> chart panel
local chart_panel_backdrop = {bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16,
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", edgeSize = 32, insets = {left = 5, right = 5, top = 5, bottom = 5}}
@@ -1383,13 +1428,13 @@ local create_box = function (self, next_box)
local thisbox = {}
self.BoxLabels [next_box] = thisbox
local box = gump:NewImage (self, nil, 16, 16, "border")
local text = gump:CreateLabel (self, nil, nil, nil, "GameFontNormal")
local box = gump:NewImage (self.Graphic, nil, 16, 16, "border")
local text = gump:CreateLabel (self.Graphic, nil, nil, nil, "GameFontNormal")
local border = gump:NewImage (self, [[Interface\DialogFrame\UI-DialogBox-Gold-Corner]], 30, 30, "artwork")
local border = gump:NewImage (self.Graphic, [[Interface\DialogFrame\UI-DialogBox-Gold-Corner]], 30, 30, "artwork")
border:SetPoint ("center", box, "center", -3, -4)
local checktexture = gump:NewImage (self, [[Interface\Buttons\UI-CheckBox-Check]], 18, 18, "overlay")
local checktexture = gump:NewImage (self.Graphic, [[Interface\Buttons\UI-CheckBox-Check]], 18, 18, "overlay")
checktexture:SetPoint ("center", box, "center", -1, -1)
thisbox.box = box
@@ -1398,7 +1443,7 @@ local create_box = function (self, next_box)
thisbox.check = checktexture
thisbox.enabled = true
local button = gump:CreateButton (self, chart_panel_enable_line, 20, 20, "", self, thisbox)
local button = gump:CreateButton (self.Graphic, chart_panel_enable_line, 20, 20, "", self, thisbox)
button:SetPoint ("center", box, "center")
thisbox.button = button
@@ -1415,6 +1460,36 @@ local create_box = function (self, next_box)
end
local realign_labels = function (self)
local width = self:GetWidth() - 108
local first_box = self.BoxLabels [1]
first_box.text:SetPoint ("topright", self, "topright", -35, -16)
local line_width = first_box.text:GetStringWidth() + 26
for i = 2, #self.BoxLabels do
local box = self.BoxLabels [i]
if (box.box:IsShown()) then
line_width = line_width + box.text:GetStringWidth() + 26
if (line_width > width) then
line_width = box.text:GetStringWidth() + 26
box.text:SetPoint ("topright", self, "topright", -35, -40)
else
box.text:SetPoint ("right", self.BoxLabels [i-1].box, "left", -7, 0)
end
else
break
end
end
end
local chart_panel_add_label = function (self, color, name, type, number)
local next_box = self.BoxLabelsAmount
@@ -1441,6 +1516,8 @@ local chart_panel_add_label = function (self, color, name, type, number)
thisbox.showing = true
thisbox.enabled = true
realign_labels (self)
end
local line_default_color = {1, 1, 1}
@@ -1883,40 +1960,3 @@ local simple_panel_settitle = function (self, title)
self.title:SetText (title)
end
function gump:CreateSimplePanel (parent, w, h, title, name)
if (not name) then
name = "DetailsSimplePanel" .. simple_panel_counter
end
if (not parent) then
parent = UIParent
end
local f = CreateFrame ("frame", name, UIParent)
f:SetSize (w or 400, h or 250)
f:SetPoint ("center", UIParent, "center", 0, 0)
f:SetFrameStrata ("FULLSCREEN")
f:EnableMouse()
f:SetMovable (true)
tinsert (UISpecialFrames, name)
f:SetScript ("OnMouseDown", simple_panel_mouse_down)
f:SetScript ("OnMouseUp", simple_panel_mouse_up)
local bg = f:CreateTexture (nil, "background")
bg:SetAllPoints (f)
bg:SetTexture ([[Interface\AddOns\Details\images\welcome]])
local close = CreateFrame ("button", name .. "Close", f, "UIPanelCloseButton")
close:SetSize (32, 32)
close:SetPoint ("topright", f, "topright", 0, -12)
f.title = gump:CreateLabel (f, title or "", 12, nil, "GameFontNormal")
f.title:SetPoint ("top", f, "top", 0, -22)
f.SetTitle = simple_panel_settitle
simple_panel_counter = simple_panel_counter + 1
return f
end
+10 -1
View File
@@ -15,6 +15,8 @@ local cleanfunction = function() end
local APITextEntryFunctions = false
local TextEntryMetaFunctions = {}
gump.TextEntryCounter = 1
------------------------------------------------------------------------------------------------------------
--> metatables
@@ -470,13 +472,20 @@ local TextEntryMetaFunctions = {}
------------------------------------------------------------------------------------------------------------
--> object constructor
function gump:CreateTextEntry (parent, func, w, h, member, name)
return gump:NewTextEntry (parent, parent, name, member, w, h, func)
end
function gump:NewTextEntry (parent, container, name, member, w, h, func, param1, param2, space)
if (not name) then
return nil
name = "DetailsTextEntryNumber" .. gump.TextEntryCounter
gump.TextEntryCounter = gump.TextEntryCounter + 1
elseif (not parent) then
return nil
end
if (not container) then
container = parent
end
+4
View File
@@ -37,6 +37,8 @@
["COMBAT_BOSS_FOUND"] = {},
["COMBAT_INVALID"] = {},
["COMBAT_PREPOTION_UPDATED"] = {},
["COMBAT_CHARTTABLES_CREATING"] = {},
["COMBAT_CHARTTABLES_CREATED"] = {},
--> area
["ZONE_TYPE_CHANGED"] = {},
@@ -84,6 +86,8 @@ local common_events = {
["COMBAT_BOSS_FOUND"] = true,
["COMBAT_INVALID"] = true,
["COMBAT_PREPOTION_UPDATED"] = true,
["COMBAT_CHARTTABLES_CREATING"] = true,
["COMBAT_CHARTTABLES_CREATED"] = true,
["GROUP_ONENTER"] = true,
["GROUP_ONLEAVE"] = true,
["ZONE_TYPE_CHANGED"] = true,
+14
View File
@@ -177,6 +177,8 @@
local exec = {}
_detalhes.timeContainer.Exec = exec
_detalhes:SendEvent ("COMBAT_CHARTTABLES_CREATING")
--> build the exec table
for index, t in ipairs (_detalhes.savedTimeCaptures) do
if (t [INDEX_ENABLED]) then
@@ -197,6 +199,8 @@
end
end
_detalhes:SendEvent ("COMBAT_CHARTTABLES_CREATED")
tick_time = 0
@@ -477,4 +481,14 @@
function _detalhes:BrokerTick()
_detalhes.databroker.text = parse_broker_text()
end
function _detalhes:SetDataBrokerText (text)
if (type (text) == "string") then
_detalhes.data_broker_text = text
_detalhes:BrokerTick()
elseif (text == nil or (type (text) == "boolean" and not text)) then
_detalhes.data_broker_text = ""
_detalhes:BrokerTick()
end
end
+4 -3
View File
@@ -1,6 +1,8 @@
--[[ options panel file --]]
--[[
search for "~number" without the quotes to quick access the page:
1 - general
2 - combat
3 - skin
@@ -1658,8 +1660,7 @@ function window:CreateFrame19()
broker_entry.text = _detalhes.data_broker_text
broker_entry:SetHook ("OnTextChanged", function (self, byUser)
_detalhes.data_broker_text = broker_entry.text
_detalhes:BrokerTick()
_detalhes:SetDataBrokerText (broker_entry.text)
_detalhes:SendOptionsModifiedEvent (DetailsOptionsWindow.instance)
end)
@@ -9966,7 +9967,7 @@ end --> if not window
_G.DetailsOptionsWindow3SkinDropdown.MyObject:SetFixedParameter (editing_instance)
_G.DetailsOptionsWindow3SkinDropdown.MyObject:Select (skin)
local skin_object = _detalhes:GetSkin (skin)
local skin_object = editing_instance:GetSkin()
local skin_name_formated = skin:gsub (" ", "")
--> hide all