Mercurial > wow > reaction
comparison modules/ConfigUI.lua @ 182:55c2fc0c8d55
Collect options in one file
clean up ReAction.lua a bit
remove AceConsole-3.0
| author | Flick <flickerstreak@gmail.com> |
|---|---|
| date | Thu, 21 Oct 2010 22:07:11 +0000 |
| parents | df68b5a40490 |
| children | 1ee86bbb05a0 |
comparison
equal
deleted
inserted
replaced
| 181:c8777ae7d460 | 182:55c2fc0c8d55 |
|---|---|
| 33 ) | 33 ) |
| 34 | 34 |
| 35 self:RegisterEvent("PLAYER_REGEN_DISABLED") | 35 self:RegisterEvent("PLAYER_REGEN_DISABLED") |
| 36 ReAction.RegisterCallback(self,"OnOptionsRegistered","OnOptionsRefreshed") | 36 ReAction.RegisterCallback(self,"OnOptionsRegistered","OnOptionsRefreshed") |
| 37 ReAction.RegisterCallback(self,"OnOptionsRefreshed") | 37 ReAction.RegisterCallback(self,"OnOptionsRefreshed") |
| 38 self:InitializeOptions() | |
| 39 end | 38 end |
| 40 | 39 |
| 41 function module:OnOptionsRefreshed(evt) | 40 function module:OnOptionsRefreshed(evt) |
| 42 AceConfigReg:NotifyChange(configName) | |
| 43 if self.editor then self.editor:Refresh() end | 41 if self.editor then self.editor:Refresh() end |
| 44 end | 42 end |
| 45 | 43 |
| 46 function module:PLAYER_REGEN_DISABLED() | 44 function module:PLAYER_REGEN_DISABLED() |
| 47 if self.editor then | 45 if self.editor then |
| 48 self.editor:Hide() | 46 self.editor:Hide() |
| 49 end | 47 end |
| 50 end | 48 end |
| 51 | 49 |
| 52 function module:OpenConfig() | 50 function module:OptionShowEditor() |
| 53 InterfaceOptionsFrame_OpenToCategory(configName) | 51 self:LaunchBarEditor() |
| 54 end | 52 -- you can't close a dialog in response to an options click, because the end of the |
| 55 | 53 -- handler for all the button events calls lib:Open() |
| 56 function module:InitializeOptions() | 54 -- So, schedule a close on the next OnUpdate |
| 57 ReAction:RegisterOptions(self, { | 55 if self.db.profile.closeOnLaunch then |
| 58 _launchEditor = { | 56 self.editor.closePending = true |
| 59 type = "execute", | 57 end |
| 60 handler = self, | 58 end |
| 61 name = L["Edit Bars..."], | 59 |
| 62 desc = L["Show the ReAction Bar Editor dialogue"], | 60 function module:OptionGetCloseThis() |
| 63 func = function() | 61 return self.db.profile.closeOnLaunch |
| 64 self:LaunchBarEditor() | 62 end |
| 65 -- you can't close a dialog in response to an options click, because the end of the | 63 |
| 66 -- handler for all the button events calls lib:Open() | 64 function module:OptionSetCloseThis(info,val) |
| 67 -- So, schedule a close on the next OnUpdate | 65 self.db.profile.closeOnLaunch = val |
| 68 if self.db.profile.closeOnLaunch then | 66 end |
| 69 self.editor.closePending = true | 67 |
| 70 end | |
| 71 end, | |
| 72 order = 2, | |
| 73 }, | |
| 74 _closeThis = { | |
| 75 type = "toggle", | |
| 76 name = L["Close on Launch"], | |
| 77 desc = L["Close the Interface Options window when launching the ReAction Bar Editor"], | |
| 78 get = function() return self.db.profile.closeOnLaunch end, | |
| 79 set = function(info, val) self.db.profile.closeOnLaunch = val end, | |
| 80 order = 3, | |
| 81 }, | |
| 82 _keybind = { | |
| 83 type = "execute", | |
| 84 handler = self, | |
| 85 name = L["Key Bindings"], | |
| 86 desc = L["Show the keybinding dialogue"], | |
| 87 func = function() | |
| 88 ReAction:SetKeybindMode(true) | |
| 89 end, | |
| 90 order = 4, | |
| 91 }, | |
| 92 }, true) -- global | |
| 93 | |
| 94 AceConfigReg:RegisterOptionsTable(configName,ReAction.options) | |
| 95 self.frame = AceConfigDialog:AddToBlizOptions(configName, configName) | |
| 96 self.frame.obj:SetCallback("default", | |
| 97 function() | |
| 98 ReAction.db:ResetProfile() | |
| 99 ReAction:RefreshOptions() | |
| 100 end ) | |
| 101 end | |
| 102 | 68 |
| 103 | 69 |
| 104 | 70 |
| 105 | 71 |
| 106 -- Bar Editor -- | 72 -- Bar Editor -- |
| 166 launchConfig = { | 132 launchConfig = { |
| 167 type = "execute", | 133 type = "execute", |
| 168 name = L["Global Config"], | 134 name = L["Global Config"], |
| 169 desc = L["Opens ReAction global configuration settings panel"], | 135 desc = L["Opens ReAction global configuration settings panel"], |
| 170 func = function() | 136 func = function() |
| 171 module:OpenConfig() | 137 ReAction:ShowOptions() |
| 172 -- you can't close a dialog in response to an options click, because the end of the | 138 -- you can't close a dialog in response to an options click, because the end of the |
| 173 -- handler for all the button events calls lib:Open() | 139 -- handler for all the button events calls lib:Open() |
| 174 -- So, schedule a close on the next OnUpdate | 140 -- So, schedule a close on the next OnUpdate |
| 175 if module.db.profile.editorCloseOnLaunch then | 141 if module.db.profile.editorCloseOnLaunch then |
| 176 editor.selfClosePending = true | 142 editor.selfClosePending = true |
