comparison UI.lua @ 68:1687ae1c6162

fixed :ToFront not remembering the current channel
author Nenue
date Sat, 12 Mar 2016 02:31:55 -0500
parents 516ceb31703d
children e89244da507b
comparison
equal deleted inserted replaced
67:137b8c55a593 68:1687ae1c6162
89 89
90 --- Brings the console to the front. 90 --- Brings the console to the front.
91 -- Frame method used to bring a console frame to the front of the display stack. 91 -- Frame method used to bring a console frame to the front of the display stack.
92 local function Console_ToFront(c) 92 local function Console_ToFront(c)
93 local db = D.db 93 local db = D.db
94 local profile = D.currentProfile
94 c:Raise() 95 c:Raise()
95 c:SetAlpha(db.frontalpha) 96 c:SetAlpha(db.frontalpha)
96 c.out.backdrop:SetTexture(unpack(db.frontdrop)) 97 c.out.backdrop:SetTexture(unpack(db.frontdrop))
97 c.out.backdrop:SetGradientAlpha(unpack(db.frontgrad)) 98 c.out.backdrop:SetGradientAlpha(unpack(db.frontgrad))
98 c.out.backdrop:SetBlendMode(db.frontblend) 99 c.out.backdrop:SetBlendMode(db.frontblend)
99 c.dropmenu.icon:SetVertexColor(unpack(db.frontheader)) 100 c.dropmenu.icon:SetVertexColor(unpack(db.frontheader))
100 c.title:SetTextColor(unpack(db.frontborder)) 101 c.title:SetTextColor(unpack(db.frontborder))
101 102
102 --oldprint('changing current toplevel from', db.current_channel, 'to', c.index) 103 --oldprint('changing current toplevel from', db.current_channel, 'to', c.index)
103 db.current_channel = c.index 104 profile.current_channel = c.index
104 105
105 --oldprint('toplevel is now', db.current_channel) 106 --oldprint('toplevel is now', db.current_channel)
106 c:Save() 107 c:Save()
107 108
108 109
245 if vars.minimized then 246 if vars.minimized then
246 f:Minimize() 247 f:Minimize()
247 else 248 else
248 f:Maximize() 249 f:Maximize()
249 end 250 end
250 if db.enabled and f.enabled then 251 if db.enabled then
252 f.enabled = true
251 f:Show() 253 f:Show()
252 end 254 end
253 255
254 return f 256 return f
255 end 257 end
266 function D:SetChannel(cinfo, key) 268 function D:SetChannel(cinfo, key)
267 local profile = D.currentProfile 269 local profile = D.currentProfile
268 local t_info = {} 270 local t_info = {}
269 local channel, isNew, id, sig, t_id 271 local channel, isNew, id, sig, t_id
270 --@debug@ 272 --@debug@
271 print('setchan(0) cinfo, key', cinfo, key)--@end-debug@ 273 --print('setchan(0) cinfo, key', cinfo, key)--@end-debug@
272 -- obtain source data 274 -- obtain source data
273 if tonumber(key) ~= nil and D.channels[key] then 275 if tonumber(key) ~= nil and D.channels[key] then
274 id = tonumber(key) 276 id = tonumber(key)
275 elseif D.sigID[tostring(key)] then 277 elseif D.sigID[tostring(key)] then
276 id = D.sigID[tostring(key)] 278 id = D.sigID[tostring(key)]
280 end 282 end
281 local dbvars = D.channels[id] 283 local dbvars = D.channels[id]
282 t_id = id -- overridden later if new 284 t_id = id -- overridden later if new
283 t_info.index = t_id -- 285 t_info.index = t_id --
284 --@debug@ 286 --@debug@
285 print('setchan(1) cinfo, key, id=', cinfo, key, id)--@end-debug@ 287 --print('setchan(1) cinfo, key, id=', cinfo, key, id)--@end-debug@
286 288
287 289
288 -- obtain config info 290 -- obtain config info
289 if type(cinfo) == 'string' then 291 if type(cinfo) == 'string' then
290 sig = cinfo 292 sig = cinfo
298 else -- old sig 300 else -- old sig
299 sig = D.channels[id].signature 301 sig = D.channels[id].signature
300 end 302 end
301 t_info.signature = sig 303 t_info.signature = sig
302 --@debug@ 304 --@debug@
303 print('setchan(2) sig,id,isNew=', sig, id, isNew)--@end-debug@ 305 --print('setchan(2) sig,id,isNew=', sig, id, isNew)--@end-debug@
304 306
305 for k,v in pairs(cinfo) do -- allow all cinfo to pass 307 for k,v in pairs(cinfo) do -- allow all cinfo to pass
306 t_info[k] = v 308 t_info[k] = v
307 end 309 end
308 310
326 t_info.signature = result 328 t_info.signature = result
327 end 329 end
328 t_id = self.max_channel + 1 330 t_id = self.max_channel + 1
329 t_info.index = t_id 331 t_info.index = t_id
330 --@debug@ 332 --@debug@
331 print('setchan(3a) t_id, isNew, sig, t_info.signature=', t_id, isNew, sig, t_info.signature)--@end-debug@ 333 --print('setchan(3a) t_id, isNew, sig, t_info.signature=', t_id, isNew, sig, t_info.signature)--@end-debug@
332 else 334 else
333 --@debug@ 335 --@debug@
334 print('setchan(3b) t_id, isNew, sig, t_info.signature=', t_id, isNew, sig, t_info.signature)--@end-debug@ 336 --print('setchan(3b) t_id, isNew, sig, t_info.signature=', t_id, isNew, sig, t_info.signature)--@end-debug@
335 end 337 end
336 338
337 local channel 339 local channel
338 if not self.console[t_id] then -- create a frame 340 if not self.console[t_id] then -- create a frame
339 if isNew then -- position the channel frame 341 if isNew then -- position the channel frame
340 profile.max_channel = t_id 342 profile.max_channel = t_id
341 t_info.x = t_info.x + 20 343 t_info.x = t_info.x + 20
342 t_info.y = t_info.y - 20 344 t_info.y = t_info.y - 20
343 profile.channels[t_id] = t_info 345 profile.channels[t_id] = t_info
344 --@debug@ 346 --@debug@
345 print('setchan(4a)', 't_id, x, y=', t_id, t_info.x, t_info.y)--@end-debug@ 347 --print('setchan(4a)', 't_id, x, y=', t_id, t_info.x, t_info.y)--@end-debug@
346 end 348 end
347 channel = CreateConsole(t_id, t_info) 349 channel = CreateConsole(t_id, t_info)
348 self.console[t_id] = channel 350 self.console[t_id] = channel
349 self.sig[t_info.signature] = channel 351 self.sig[t_info.signature] = channel
350 self.sigID[t_info.signature] = t_id 352 self.sigID[t_info.signature] = t_id
356 else 358 else
357 channel:Maximize() 359 channel:Maximize()
358 end 360 end
359 361
360 if channel.enabled then -- hide or show last since Min/Max mess with visibility 362 if channel.enabled then -- hide or show last since Min/Max mess with visibility
361 print('setchan(5a) enable') 363 --print('setchan(5a) enable')
362 channel:Show() 364 channel:Show()
363 --channel:ToFront() 365 --channel:ToFront()
364 else 366 else
365 print('setchan(5a) disable') 367 --print('setchan(5a) disable')
366 channel:Hide() 368 channel:Hide()
367 end 369 end
368 --@debug@ 370 --@debug@
369 print('setchan(end); c:IsVisible(), c.enabled, db.enabled=', channel:IsVisible(), channel.enabled, profile.enabled)--@end-debug@ 371 --print('setchan(end); c:IsVisible(), c.enabled, db.enabled=', channel:IsVisible(), channel.enabled, profile.enabled)--@end-debug@
370 return channel 372 return channel
371 end 373 end
372 374
373 --- Console frame toggler 375 --- Console frame toggler
374 -- @paramsig [...] 376 -- @paramsig [...]
404 profile.enabled = nil 406 profile.enabled = nil
405 end 407 end
406 end 408 end
407 409
408 for i, id in pairs(search) do 410 for i, id in pairs(search) do
409 --oldprint(i, id) 411 oldprint(i, id)
410 local c = self.console[id] 412 local c = self.console[id]
411 if setAll then 413 if setAll then
412 c.enabled = profile.enabled and profile.enabled or nil 414 c.enabled = profile.enabled and profile.enabled or nil
413 else 415 else
414 416
415 profile.enabled = true 417 profile.enabled = true
416 c.enabled = (not c.enabled) and true or nil 418 c.enabled = (not c.enabled) and true or nil
417 if force == 0 then 419 if force == 0 then
418 c.enabled = nil 420 c.enabled = nil
419 end 421 end
420 --oldprint(id, ' ', force, c.enabled, db.enabled) 422 oldprint(id, ' ', force, c.enabled, profile.enabled)
421 end 423 end
422 424
423 if c.enabled or (setAll and profile.enabled) then 425 if c.enabled or (setAll and profile.enabled) then
424 c:Show() 426 c:Show()
425 elseif not (c.enabled and profile.enabled) then 427 elseif not (c.enabled and profile.enabled) then