Mercurial > wow > devian
comparison Devian.lua @ 100:790dca545f1d v3.0
- Configuration structure overheal; clearing 'Devian.lua' from SaveVariables will be necessary
- Removed dependence on embedded libraries.
- Console/dock frames are now implemented as XML mixin structures
- Console dropdown menu option to 'Pin' frames
- Hold SHIFT while clicking dock buttons will cause all but that tab to be closed
| author | Nenue |
|---|---|
| date | Tue, 17 Jan 2017 14:25:18 -0500 |
| parents | 7d94df3804a7 |
| children | 8dc0c1917890 |
comparison
equal
deleted
inserted
replaced
| 99:7d94df3804a7 | 100:790dca545f1d |
|---|---|
| 3 -- @project-revision@ @project-hash@ | 3 -- @project-revision@ @project-hash@ |
| 4 -- @file-revision@ @file-hash@ | 4 -- @file-revision@ @file-hash@ |
| 5 | 5 |
| 6 --GLOBALS: Devian, DevianLoadMessage, DEVIAN_WORKSPACE, DEVIAN_PNAME, DEVIAN_PID | 6 --GLOBALS: Devian, DevianLoadMessage, DEVIAN_WORKSPACE, DEVIAN_PNAME, DEVIAN_PID |
| 7 | 7 |
| 8 SLASH_RL1 = "/rl" | |
| 9 SlashCmdList.RL = function() ReloadUI() end | |
| 8 DEVIAN_WORKSPACE = false | 10 DEVIAN_WORKSPACE = false |
| 9 DEVIAN_PNAME = 'Dvn' | 11 DEVIAN_PNAME = 'Dvn' |
| 10 DEVIAN_PID = 0 | 12 DEVIAN_PID = 0 |
| 11 | 13 |
| 12 local ADDON, D = ... | 14 local ADDON, D = ... |
| 20 local playerName = UnitName("player") | 22 local playerName = UnitName("player") |
| 21 local playerRealm = playerName .. '-' .. GetRealmName() | 23 local playerRealm = playerName .. '-' .. GetRealmName() |
| 22 local num_dock_tabs = 0 | 24 local num_dock_tabs = 0 |
| 23 local charStates ={} | 25 local charStates ={} |
| 24 | 26 |
| 27 local channels_report = {} | |
| 25 local registeredTags = {} | 28 local registeredTags = {} |
| 26 | 29 |
| 27 | 30 |
| 28 DevianCore = {} | 31 DevianCore = {} |
| 29 | 32 |
| 712 for id, channel in pairs(sendq) do | 715 for id, channel in pairs(sendq) do |
| 713 if channel.width < 250 then | 716 if channel.width < 250 then |
| 714 prefix = sub(prefix, 0,2) | 717 prefix = sub(prefix, 0,2) |
| 715 end | 718 end |
| 716 channel.out:AddMessage('|cFF'.. pcolor..prefix ..'|r ' .. message, 0.8, 0.8, 0.8) | 719 channel.out:AddMessage('|cFF'.. pcolor..prefix ..'|r ' .. message, 0.8, 0.8, 0.8) |
| 717 if channel.Dock and not channel.Dock.newMessage then | 720 if not channel.newMessage then |
| 718 channel.Dock.newMessage = true | 721 channel.newMessage = true |
| 719 channel.Dock.caption.pulse:Play() | 722 if channel.Dock then |
| 720 channel.Dock:Update() | 723 channel.Dock:Update() |
| 724 end | |
| 721 end | 725 end |
| 722 end | 726 end |
| 723 wipe(buffer) | 727 wipe(buffer) |
| 724 end | 728 end |
| 725 | 729 |
| 763 D:Print('Tag color cache cleared.') | 767 D:Print('Tag color cache cleared.') |
| 764 end | 768 end |
| 765 | 769 |
| 766 | 770 |
| 767 function D.ConsoleCommand (cmd) | 771 function D.ConsoleCommand (cmd) |
| 768 D:Console_Toggle(cmd) | 772 DevianDock:ToggleAll() |
| 769 end | 773 end |
| 770 | 774 |
| 771 | 775 |
| 772 function DevianCore:Initialize() | 776 function DevianCore:Initialize() |
| 773 L = D.L | 777 L = D.L |
| 811 end | 815 end |
| 812 end | 816 end |
| 813 | 817 |
| 814 --- initialize the current profile | 818 --- initialize the current profile |
| 815 local id, name = D.Profile(db.current_profile or 1) | 819 local id, name = D.Profile(db.current_profile or 1) |
| 816 D:Print('Using profile |cFFFFFF00'.. id ..'|r: |cFF00FF00'..currentProfile.name..'|r') | |
| 817 if currentProfile.workspace then | 820 if currentProfile.workspace then |
| 818 D:Print('Workspace: '.. (#currentProfile.channels) .. ' channels, ' .. #currentProfile.tags .. ' tags.') | 821 tinsert(channels_report, 'Profile |cFFFFFF00'.. id ..'|r: |cFF00FF00'..currentProfile.name.. '|r') |
| 819 if D.channels[currentProfile.default_channel] then | 822 if D.channels[currentProfile.default_channel] then |
| 820 D:Print('Default channel: |cFFFFFF00'..currentProfile.default_channel..'|r: |cFF00FFFF'.. D.channels[currentProfile.default_channel].signature..'|r') | 823 tinsert(channels_report, 'Primary: |cFFFFFF00#'..currentProfile.default_channel..'|r |cFF00FFFF'.. D.channels[currentProfile.default_channel].signature..'|r') |
| 821 end | 824 end |
| 822 end | 825 end |
| 823 | 826 |
| 824 | 827 |
| 825 | 828 |
| 829 D.primary_channel = index | 832 D.primary_channel = index |
| 830 end | 833 end |
| 831 D:GetOrCreateChannel(index) | 834 D:GetOrCreateChannel(index) |
| 832 D.num_channels = #D.channels | 835 D.num_channels = #D.channels |
| 833 end | 836 end |
| 837 if #channels_report >= 1 then | |
| 838 D:Print(concat(channels_report, ', ')) | |
| 839 end | |
| 840 | |
| 834 D.primary_channel = D.primary_channel or 1 | 841 D.primary_channel = D.primary_channel or 1 |
| 835 D.max_channel = max(D.max_channel, currentProfile.max_channel) | 842 D.max_channel = max(D.max_channel, currentProfile.max_channel) |
| 836 if currentProfile.max_channel < D.max_channel then | 843 if currentProfile.max_channel < D.max_channel then |
| 837 for i = currentProfile.max_channel, D.max_channel do | 844 for i = currentProfile.max_channel, D.max_channel do |
| 838 D.console[i]:Hide() | 845 D.console[i]:Hide() |
| 847 D.console[currentProfile.current_channel]:ToFront() | 854 D.console[currentProfile.current_channel]:ToFront() |
| 848 -- bring the current channel to the front | 855 -- bring the current channel to the front |
| 849 end | 856 end |
| 850 DevianDock:Update() | 857 DevianDock:Update() |
| 851 end | 858 end |
| 852 | |
| 853 print('devian') | |
| 854 end | 859 end |
| 855 | 860 |
| 856 function D:Print (...) | 861 function D:Print (...) |
| 857 local msg = '|cFF00FF44Devian|r:' | 862 local msg = '|cFF00FF44Devian|r:' |
| 858 for i = 1, select('#', ...) do | 863 for i = 1, select('#', ...) do |
| 891 end | 896 end |
| 892 end | 897 end |
| 893 end | 898 end |
| 894 | 899 |
| 895 local frame = D.console[id] | 900 local frame = D.console[id] |
| 901 | |
| 896 if not frame then | 902 if not frame then |
| 897 | 903 |
| 898 if DEVIAN_WORKSPACE then | 904 if DEVIAN_WORKSPACE then |
| 899 D:Print('Adding '.. (info.index) .. ':' .. (info.signature) .. ' (|cFF00FFFF'.. concat(info.tags, '|r; |cFF00FFFF')..'|r)') | 905 tinsert(channels_report, (info.index) .. ':' .. (info.signature) .. ' (|cFF00FFFF'.. concat(info.tags, '|r; |cFF00FFFF')..'|r)') |
| 900 end | 906 end |
| 901 frame = CreateFrame('Frame', 'DevianConsole'..id, Devian, 'DevianConsoleTemplate') | 907 frame = CreateFrame('Frame', 'DevianConsole'..id, Devian, 'DevianConsoleTemplate') |
| 902 frame:SetID(id) | 908 frame:SetID(id) |
| 903 D.console[id] = frame | 909 D.console[id] = frame |
| 904 D.sigID[info.signature] = id | 910 D.sigID[info.signature] = id |
