Mercurial > wow > devian
comparison Devian.lua @ 60:59e047d6c5de v2.1.60
- Frame fading on movement re-implemented.
- Fixed front console losing focus between reloads.
author | Nenue |
---|---|
date | Tue, 26 Jan 2016 16:43:03 -0500 |
parents | 0a9a6740ea5d |
children | 516ceb31703d |
comparison
equal
deleted
inserted
replaced
59:5b1c570b1cfd | 60:59e047d6c5de |
---|---|
83 dock_button_fade_in = 0.075, | 83 dock_button_fade_in = 0.075, |
84 dock_button_fade_out = 0.075, | 84 dock_button_fade_out = 0.075, |
85 | 85 |
86 movement_fade = true, | 86 movement_fade = true, |
87 movement_fade_time = 0.15, | 87 movement_fade_time = 0.15, |
88 movement_fade_from = 1, | |
89 movement_fade_to = 0, | |
90 movement_translation_x = 25, | |
91 movement_translation_y = 25, | |
88 } | 92 } |
89 | 93 |
90 local function ScanAddOnList(cmd, ...) | 94 local function ScanAddOnList(cmd, ...) |
91 local list_state | 95 local list_state |
92 | 96 |
311 var = var and 'true' or 'false' | 315 var = var and 'true' or 'false' |
312 elseif type(var) == 'function' then | 316 elseif type(var) == 'function' then |
313 var = '<funcref>' | 317 var = '<funcref>' |
314 elseif type(var) == 'nil' then | 318 elseif type(var) == 'nil' then |
315 var = 'nil' | 319 var = 'nil' |
320 else | |
321 var = tostring(var) | |
316 end | 322 end |
317 | 323 |
318 insert(buffer, var) | 324 insert(buffer, var) |
319 end | 325 end |
320 local message = concat(buffer, ' ') | 326 local message = concat(buffer, ' ') |
341 | 347 |
342 D:Print("|cFFFFFF00/resetdvn|r", "- Resets all but profile data SavedVariables.") | 348 D:Print("|cFFFFFF00/resetdvn|r", "- Resets all but profile data SavedVariables.") |
343 D:Print("|cFFFFFF00/cleandvn|r", "- Fully resets SavedVariables, profiles and all.") | 349 D:Print("|cFFFFFF00/cleandvn|r", "- Fully resets SavedVariables, profiles and all.") |
344 end | 350 end |
345 | 351 |
352 local dot1, dot2 = CreateFrame('Frame', nil, UIParent), CreateFrame('Frame', nil, UIParent) | |
353 dot1:SetSize(5,5) | |
354 dot1:SetFrameStrata('TOOLTIP') | |
355 local a = dot1:CreateTexture('fill', nil) | |
356 a:SetAllPoints(dot1) | |
357 a:SetTexture(1,0,0,1) | |
358 dot2:SetSize(5,5) | |
359 dot2:SetFrameStrata('TOOLTIP') | |
360 a = dot2:CreateTexture('fill', nil) | |
361 a:SetAllPoints(dot2) | |
362 a:SetTexture(0,1,0,1) | |
363 | |
364 local OnStartedMoving = function() | |
365 for k, v in pairs(D.console) do | |
366 if v.enabled then | |
367 v.moveFade:Stop() | |
368 local F1 = v.moveFade.alphaOut | |
369 F1:SetFromAlpha(db.movement_fade_from) | |
370 F1:SetToAlpha(db.movement_fade_to) | |
371 F1:SetDuration(db.movement_fade_time) | |
372 v.moveFade:Play() | |
373 v:EnableMouse(false) | |
374 end | |
375 end | |
376 end | |
377 | |
378 local OnStoppedMoving = function() | |
379 for k, v in pairs(D.console) do | |
380 if v.enabled then | |
381 v.moveFade:Stop() | |
382 local F1 = v.moveFade.alphaOut | |
383 F1:SetToAlpha(db.movement_fade_from) | |
384 F1:SetFromAlpha(db.movement_fade_to) | |
385 F1:SetDuration(db.movement_fade_time) | |
386 v.moveFade:Play() | |
387 v:EnableMouse(true) | |
388 end | |
389 end | |
390 end | |
346 | 391 |
347 | 392 |
348 function D:OnEnable() | 393 function D:OnEnable() |
349 | 394 |
350 if db.unlisted and #db.unlisted > 0 then | 395 if db.unlisted and #db.unlisted > 0 then |
356 D:Print(L('Devian loaded on standby',MAJOR, MINOR)) | 401 D:Print(L('Devian loaded on standby',MAJOR, MINOR)) |
357 else | 402 else |
358 D:Print(L('Devian loaded in workspace', MAJOR, MINOR, db.workspace)) | 403 D:Print(L('Devian loaded in workspace', MAJOR, MINOR, db.workspace)) |
359 -- movement fading | 404 -- movement fading |
360 if db.movement_fade then | 405 if db.movement_fade then |
361 self:RegisterEvent('PLAYER_STARTED_MOVING', function() | 406 |
362 for k, v in pairs(self.console) do | 407 self:RegisterEvent('PLAYER_STARTED_MOVING', OnStartedMoving) |
363 if v.enabled then | 408 self:RegisterEvent('PLAYER_STOPPED_MOVING', OnStoppedMoving) |
364 v.preAlpha = v:GetAlpha() | |
365 v:SetAlpha(0) | |
366 v:EnableMouse(false) | |
367 end | |
368 end | |
369 end) | |
370 self:RegisterEvent('PLAYER_STOPPED_MOVING', function() | |
371 for k, v in pairs(self.console) do | |
372 if v.enabled then | |
373 v:SetAlpha(v.preAlpha) | |
374 v:EnableMouse(true) | |
375 end | |
376 end | |
377 end) | |
378 end | 409 end |
379 end | 410 end |
380 | 411 |
381 --@debug@ | 412 --@debug@ |
382 self:RegisterChatCommand("dvg", function(input) | 413 self:RegisterChatCommand("dvg", function(input) |
397 DevianDB = { | 428 DevianDB = { |
398 load_message = "All SavedVars wiped." | 429 load_message = "All SavedVars wiped." |
399 } | 430 } |
400 ReloadUI() | 431 ReloadUI() |
401 end) | 432 end) |
402 local blocked = {global = true, [PLAYER_REALM] = true} | 433 local blocked = {global = true, channels = true, tags = true, [PLAYER_REALM] = true} |
403 self:RegisterChatCommand("resetdvn", function(args) | 434 self:RegisterChatCommand("resetdvn", function(args) |
404 for k,v in pairs(DevianDB) do | 435 for k,v in pairs(DevianDB) do |
405 if not blocked[k] then | 436 if not blocked[k] then |
406 DevianDB[k] = nil | 437 DevianDB[k] = nil |
407 end | 438 end |
469 self.max_channel = max(i, self.max_channel) | 500 self.max_channel = max(i, self.max_channel) |
470 self.num_channels = self.num_channels + 1 | 501 self.num_channels = self.num_channels + 1 |
471 end | 502 end |
472 | 503 |
473 if self.console[db.current_channel] then | 504 if self.console[db.current_channel] then |
505 print('bringing', self.console[db.current_channel].signature, 'to the front') | |
474 self.console[db.current_channel]:ToFront() | 506 self.console[db.current_channel]:ToFront() |
475 -- bring the current channel to the front | 507 -- bring the current channel to the front |
476 end | 508 end |
477 DevianDock:Show() | 509 DevianDock:Show() |
478 self:UpdateDock() | 510 self:UpdateDock() |
534 --oldprint(id, ' ', force, c.enabled, db.enabled) | 566 --oldprint(id, ' ', force, c.enabled, db.enabled) |
535 end | 567 end |
536 | 568 |
537 if c.enabled or (setAll and db.enabled) then | 569 if c.enabled or (setAll and db.enabled) then |
538 c:Show() | 570 c:Show() |
539 if db.current_channel == c.index then | |
540 c:ToFront() | |
541 end | |
542 elseif not (c.enabled and db.enabled) then | 571 elseif not (c.enabled and db.enabled) then |
543 c:Hide() | 572 c:Hide() |
544 end | 573 end |
545 c:Save() | 574 c:Save() |
546 end | 575 end |
547 | 576 |
548 if setAll then | 577 if setAll then |
549 if db.enabled then | 578 if db.enabled then |
550 self:Print('toggled all consoles ON') | 579 self:Print('toggled all consoles ON') |
580 if D.console[db.current_channel] then | |
581 oldprint('push', D.console[db.current_channel].signature, 'to the front') | |
582 D.console[db.current_channel]:ToFront() | |
583 end | |
551 else | 584 else |
552 self:Print('toggled all consoles OFF') | 585 self:Print('toggled all consoles OFF') |
553 end | 586 end |
554 else | 587 else |
555 local result = {} | 588 local result = {} |