Mercurial > wow > devian
comparison Devian.lua @ 7:d0cd0e68213e v1.2-r7
Frame anchor set in a way that doesn't disjoint the other pieces when it's changed.
Corrected arithmetic in SavePos; should be using y = GetTop - GetScreenHeight
Height parameter only saved when maximized
author | Nenue |
---|---|
date | Fri, 18 Dec 2015 20:49:58 -0500 |
parents | b526dc930b15 |
children | 12d814c10962 |
comparison
equal
deleted
inserted
replaced
6:b526dc930b15 | 7:d0cd0e68213e |
---|---|
7 local D = _G.Devian | 7 local D = _G.Devian |
8 local STATE_LOW, STATE_HIGH = 1, 2 | 8 local STATE_LOW, STATE_HIGH = 1, 2 |
9 local PLAYER_REALM = UnitName("player") .. '-' .. GetRealmName() | 9 local PLAYER_REALM = UnitName("player") .. '-' .. GetRealmName() |
10 local DEVIAN_FRAME = DevianConsole | 10 local DEVIAN_FRAME = DevianConsole |
11 local cherry = false | 11 local cherry = false |
12 local print = function(...) | |
13 _G.print('DVN', ...) | |
14 end | |
12 if not DevianDB then | 15 if not DevianDB then |
13 DevianDB = { | 16 DevianDB = { |
14 ['global'] = {[STATE_LOW] = {}, [STATE_HIGH] = {}}, | 17 ['global'] = {[STATE_LOW] = {}, [STATE_HIGH] = {}}, |
15 console = true, | 18 console = true, |
16 dnd_status = true, | 19 dnd_status = true, |
17 dnd_message = "Debugging. Your messages may get eaten.", | 20 dnd_message = "Debugging. Your messages may get eaten.", |
18 x = 100, | 21 x = 100, |
19 y = -150, | 22 y = 800, |
20 height = 500, | 23 height = 500, |
21 width = 600, | 24 width = 600, |
22 font = [[Interface\Addons\Devian\font\SourceCodePro-Regular.ttf]], | 25 font = [[Interface\Addons\Devian\font\SourceCodePro-Regular.ttf]], |
23 fontsize = 13, | 26 fontsize = 13, |
24 fontoutline = 'NONE', | 27 fontoutline = 'NONE', |
26 cherry = "This is probably the first time, so:\n /dvn 2 to save your regular addon list\n /dvn 1 to save your development addon list\n /dvn to switch between the two\n /dvc to toggle print() frame" | 29 cherry = "This is probably the first time, so:\n /dvn 2 to save your regular addon list\n /dvn 1 to save your development addon list\n /dvn to switch between the two\n /dvc to toggle print() frame" |
27 end | 30 end |
28 local db = DevianDB | 31 local db = DevianDB |
29 | 32 |
30 function D:SavePos(x,y) | 33 function D:SavePos(x,y) |
31 db.y = DEVIAN_FRAME:GetTop() | 34 db.y = (DEVIAN_FRAME:GetTop() - GetScreenHeight()) |
32 db.x = DEVIAN_FRAME:GetLeft() | 35 db.x = DEVIAN_FRAME:GetLeft() |
33 db.width = DEVIAN_FRAME:GetWidth() | 36 db.width = DEVIAN_FRAME:GetWidth() |
34 db.height = DEVIAN_FRAME:GetHeight() | 37 if not DEVIAN_FRAME.minimized then |
38 db.height = DEVIAN_FRAME:GetHeight() | |
39 end | |
40 | |
41 print(db.y) | |
42 DEVIAN_FRAME:SetPoint('TOPLEFT', UIParent, 'TOPLEFT', db.x, db.y) | |
35 end | 43 end |
36 | 44 |
37 local ScanAddOnList = function(args) | 45 local ScanAddOnList = function(args) |
38 local list_state | 46 local list_state |
39 | 47 |
131 | 139 |
132 f:ScrollToBottom() | 140 f:ScrollToBottom() |
133 f:SetMaxLines(500) | 141 f:SetMaxLines(500) |
134 --]] | 142 --]] |
135 f.console:SetInsertMode('BOTTOM') | 143 f.console:SetInsertMode('BOTTOM') |
136 f:SetPoint('CENTER', UIParent, 'CENTER', db.x, db.y) | 144 f:SetPoint('TOPLEFT', UIParent, 'TOPLEFT', db.x, db.y) |
137 f:SetSize(db.width, db.height) | 145 f:SetSize(db.width, db.height) |
138 f:Lower() | 146 f:Lower() |
139 | 147 |
140 f.console:SetFading(false) | 148 f.console:SetFading(false) |
141 f.console:SetTimeVisible(2147483647) | 149 f.console:SetTimeVisible(2147483647) |
142 f.console:SetFont(db.font, db.fontsize, db.fontoutline) | 150 f.console:SetFont(db.font, db.fontsize, db.fontoutline) |
143 --f:SetJustifyH('LEFT') | 151 --f:SetJustifyH('LEFT') |
144 | 152 |
145 | 153 |
146 D.debug_init = true | 154 D.debug_init = true |
155 end | |
156 function D:ToggleMinMax() | |
157 if DEVIAN_FRAME.minimized then | |
158 self:Maximize() | |
159 else | |
160 self:Minimize() | |
161 end | |
162 end | |
163 function D:Minimize() | |
164 DEVIAN_FRAME:SetHeight(20) | |
165 DEVIAN_FRAME.minimized = true | |
166 DEVIAN_FRAME:SetMaxResize(GetScreenWidth(),20) | |
167 return DEVIAN_FRAME.console:Hide() | |
168 end | |
169 function D:Maximize() | |
170 DEVIAN_FRAME:SetHeight(db.height) | |
171 DEVIAN_FRAME.minimized = nil | |
172 DEVIAN_FRAME:SetMaxResize(GetScreenWidth(),GetScreenHeight()) | |
173 return DEVIAN_FRAME.console:Show() | |
147 end | 174 end |
148 | 175 |
149 local prefix_cache = {} | 176 local prefix_cache = {} |
150 local function Message(prefix, ...) | 177 local function Message(prefix, ...) |
151 if prefix == nil then | 178 if prefix == nil then |
190 table.insert(buffer, var) | 217 table.insert(buffer, var) |
191 end | 218 end |
192 DEVIAN_FRAME.console:AddMessage(table.concat(buffer, ' ')) | 219 DEVIAN_FRAME.console:AddMessage(table.concat(buffer, ' ')) |
193 table.wipe(buffer) | 220 table.wipe(buffer) |
194 end | 221 end |
195 function D:ToggleMinMax() | |
196 if DEVIAN_FRAME.minimized then | |
197 self:Maximize() | |
198 else | |
199 self:Minimize() | |
200 end | |
201 end | |
202 function D:Minimize() | |
203 DEVIAN_FRAME:SetHeight(20) | |
204 DEVIAN_FRAME.minimized = true | |
205 return DEVIAN_FRAME.console:Hide() | |
206 end | |
207 function D:Maximize() | |
208 DEVIAN_FRAME:SetHeight(DevianDB.height) | |
209 DEVIAN_FRAME.minimized = nil | |
210 return DEVIAN_FRAME.console:Show() | |
211 end | |
212 | 222 |
213 function D:OnEnable() | 223 function D:OnEnable() |
214 if db.enabled then | 224 if db.enabled then |
215 DEVIAN_FRAME:Hide() | 225 DEVIAN_FRAME:Hide() |
216 D:Print('Standard AddOn list active. Type /dvn to switch to development mode.') | 226 D:Print('Standard AddOn list active. Type /dvn to switch to development mode.') |