comparison Devian.lua @ 5:ac644fc860cc

ResizeBounds set Min/Maximize moved into lua
author Nenue
date Fri, 18 Dec 2015 20:12:18 -0500
parents 247118593c66
children b526dc930b15
comparison
equal deleted inserted replaced
4:247118593c66 5:ac644fc860cc
17 dnd_message = "Debugging. Your messages may get eaten.", 17 dnd_message = "Debugging. Your messages may get eaten.",
18 x = 100, 18 x = 100,
19 y = -150, 19 y = -150,
20 height = 500, 20 height = 500,
21 width = 600, 21 width = 600,
22 font = [[Interface\Addons\Devian\font\SourceCodePro-Regular.ttf]],
23 fontsize = 13,
24 fontoutline = 'NONE',
22 } 25 }
23 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" 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"
24 end 27 end
25 local db = DevianDB 28 local db = DevianDB
26 29
131 --]] 134 --]]
132 f.console:SetInsertMode('BOTTOM') 135 f.console:SetInsertMode('BOTTOM')
133 f:SetPoint('CENTER', UIParent, 'CENTER', db.x, db.y) 136 f:SetPoint('CENTER', UIParent, 'CENTER', db.x, db.y)
134 f:SetSize(db.width, db.height) 137 f:SetSize(db.width, db.height)
135 f:Lower() 138 f:Lower()
136 f.console:SetFont([[Interface\Addons\Turok\Media\font\SourceCodePro-Regular.ttf]], 13, 'NONE')
137 139
138 f.console:SetFading(false) 140 f.console:SetFading(false)
139 f.console:SetTimeVisible(2147483647) 141 f.console:SetTimeVisible(2147483647)
142 f.console:SetFont(db.font, db.fontsize, db.fontoutline)
140 --f:SetJustifyH('LEFT') 143 --f:SetJustifyH('LEFT')
141 144
142 145
143 D.debug_init = true 146 D.debug_init = true
144 end 147 end
187 table.insert(buffer, var) 190 table.insert(buffer, var)
188 end 191 end
189 DEVIAN_FRAME.console:AddMessage(table.concat(buffer, ' ')) 192 DEVIAN_FRAME.console:AddMessage(table.concat(buffer, ' '))
190 table.wipe(buffer) 193 table.wipe(buffer)
191 end 194 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.sizer:ClearAllPoints()
204 DEVIAN_FRAME:SetHeight(20)
205 DEVIAN_FRAME.minimized = true
206 return DEVIAN_FRAME.console:Hide()
207 end
208 function D:Maximize()
209 DEVIAN_FRAME.sizer:ClearAllPoints()
210 DEVIAN_FRAME:SetHeight(DevianDB.height)
211 DEVIAN_FRAME.minimized = nil
212 return DEVIAN_FRAME.console:Show()
213 end
192 214
193 function D:OnEnable() 215 function D:OnEnable()
194 if db.enabled then 216 if db.enabled then
195 DEVIAN_FRAME:Hide() 217 DEVIAN_FRAME:Hide()
196 D:Print('Standard AddOn list active. Type /dvn to switch to development mode.') 218 D:Print('Standard AddOn list active. Type /dvn to switch to development mode.')
197 else 219 else
198 D:Print('Development AddOn list active. Type /dvn to revert to regular operation.') 220 D:Print('Development AddOn list active. Type /dvn to revert to regular operation.')
199 end 221 end
200 end 222 end
223
201 224
202 function D:OnInitialize() 225 function D:OnInitialize()
203 226
204 if not db[PLAYER_REALM] then 227 if not db[PLAYER_REALM] then
205 db[PLAYER_REALM] = {[STATE_LOW] = {}, [STATE_HIGH] = {} } 228 db[PLAYER_REALM] = {[STATE_LOW] = {}, [STATE_HIGH] = {} }
224 self:RegisterChatCommand("dvn", ScanAddOnList) 247 self:RegisterChatCommand("dvn", ScanAddOnList)
225 self:RegisterChatCommand("dvc", function(args) 248 self:RegisterChatCommand("dvc", function(args)
226 db.console = (db.console == false) and true or false 249 db.console = (db.console == false) and true or false
227 if db.console then 250 if db.console then
228 DEVIAN_FRAME:Show() 251 DEVIAN_FRAME:Show()
252 D:Maximize()
229 else 253 else
230 DEVIAN_FRAME:Hide() 254 DEVIAN_FRAME:Hide()
231 end 255 end
232 end) 256 end)
233 257