comparison Dock.lua @ 33:e6650821a2c0

Debugging pass on console code.
author Nenue
date Sun, 27 Dec 2015 02:30:46 -0500
parents c6a2c2df4790
children dcc57a7cabc9
comparison
equal deleted inserted replaced
32:c6a2c2df4790 33:e6650821a2c0
7 7
8 local D = LibStub("AceAddon-3.0"):GetAddon("Devian") 8 local D = LibStub("AceAddon-3.0"):GetAddon("Devian")
9 local _G = _G 9 local _G = _G
10 local db = DevianDB 10 local db = DevianDB
11 11
12 local function Dock_MenuClick() end
12 13
13 local function Dock_MouseDown(self, button, up) 14 local function Dock_MouseDown(self, button, up)
14 local parent = self.dockedTo and D.console[self.dockedTo] or self
15 local docked = parent.docked
16 if docked == nil then
17 docked = {}
18 end
19 local worklist = {}
20 for _, i in pairs(docked) do
21 table.insert(worklist, D.console[i])
22 end
23
24 if not up then
25 if button ~= 'RightButton' then
26 if parent.titlebar:IsMouseOver() or not parent.isDocked then
27 parent:ToFront()
28 else
29 parent.out:Hide()
30 end
31
32 if parent.out.grip:IsMouseOver() then
33 parent:StartSizing()
34 else
35 parent:StartMoving()
36 end
37 else
38 parent:MinMax()
39 end
40
41 else
42 if button ~= 'RightButton' then
43 if parent.titlebar:IsMouseOver() then
44 parent.out:Show()
45 end
46 parent:StopMovingOrSizing()
47 end
48 end
49
50 local fixparent = true
51 for _, frame in pairs(worklist) do
52 if not up then
53 if button ~= 'RightButton' then
54 if frame.titlebar:IsMouseOver() then
55 frame:ToFront()
56 fixparent = nil
57 else
58 frame.out:Hide()
59 end
60 if parent.out.grip:IsMouseOver() then
61 frame:StartSizing()
62 else
63 frame:StartMoving()
64 end
65 end
66 else
67 if button ~= 'RightButton' then
68 frame:StopMovingOrSizing()
69 frame:SetPoint('TOPLEFT', parent, 'TOPLEFT')
70 frame:SetPoint('BOTTOMRIGHT', parent, 'BOTTOMRIGHT')
71 frame.x = nil
72 frame.y = nil
73 frame.width = nil
74 frame.height = nil
75 frame:Save()
76
77 end
78 end
79 end
80
81 if fixparent then
82 parent.out:Show()
83 end
84 end 15 end
85 local function Dock_MouseUp (self, button) 16 local function Dock_MouseUp (self, button)
86 Dock_MouseDown(self, button, true) 17 Dock_MouseDown(self, button, true)
87 end 18 end
88 19
128 frame:SetSize(target:GetWidth(), target:GetHeight()) 59 frame:SetSize(target:GetWidth(), target:GetHeight())
129 frame.x = nil 60 frame.x = nil
130 frame.y = nil 61 frame.y = nil
131 frame.width = nil 62 frame.width = nil
132 frame.height = nil 63 frame.height = nil
133 frame.oldscript = frame:GetScript('OnMousedown') 64 frame.scriptsMD = frame:GetScript('OnMouseDown')
65 frame.scriptsMU = frame:GetScript('OnMouseUp')
134 frame:SetScript('OnMouseDown', nil) 66 frame:SetScript('OnMouseDown', nil)
135 frame:SetScript('OnMouseUp', nil) 67 frame:SetScript('OnMouseUp', nil)
136 frame:Save() 68 frame:Save()
137 end 69 end
138 end 70 end