comparison LibFarmbuyer.lua @ 16:5ee4edd24c13

- new blizz methods for editboxes in dialog popups - initial code for dropdowns in history (not active yet) - hovering and shift-clicking to link out of history - proper confirmations for history rewriting - options checkboxes more grid-like - saved texts get a scrollbar instead of expanding indefinitely (duh) - rearranged savedvars a bit (and added transition code) - stores raider join/leave times and "demographic" info, all for MLEQDKP - minor bugfixes and tweaks
author Farmbuyer of US-Kilrogg <farmbuyer@gmail.com>
date Thu, 25 Aug 2011 00:45:31 +0000
parents df3e27edbd60
children f560cf82e7d3
comparison
equal deleted inserted replaced
15:d8fee518ce5d 16:5ee4edd24c13
51 51
52 - new(...), del(t), copy(t), clear() 52 - new(...), del(t), copy(t), clear()
53 Ditto for table recycling. 53 Ditto for table recycling.
54 ]] 54 ]]
55 55
56 local MAJOR, MINOR = "LibFarmbuyer", 9 56 local MAJOR, MINOR = "LibFarmbuyer", 11
57 assert(LibStub,MAJOR.." requires LibStub") 57 assert(LibStub,MAJOR.." requires LibStub")
58 local lib = LibStub:NewLibrary(MAJOR, MINOR) 58 local lib = LibStub:NewLibrary(MAJOR, MINOR)
59 if not lib then return end 59 if not lib then return end
60 60
61 _G[MAJOR] = lib 61 _G[MAJOR] = lib
155 StaticPopupDialogs[dialog.which].OnAccept (dialog, dialog.data, dialog.data2) 155 StaticPopupDialogs[dialog.which].OnAccept (dialog, dialog.data, dialog.data2)
156 dialog:Hide() 156 dialog:Hide()
157 end 157 end
158 local function OnShow_witheditbox (dialog, data) 158 local function OnShow_witheditbox (dialog, data)
159 local info = StaticPopupDialogs[dialog.which] 159 local info = StaticPopupDialogs[dialog.which]
160 dialog[info.hasWideEditBox and "wideEditBox" or "editBox"]:SetFocus() 160 --dialog[info.hasWideEditBox and "wideEditBox" or "editBox"]:SetFocus()
161 dialog.editBox:SetFocus()
161 if info.farm_OnShow then 162 if info.farm_OnShow then
162 return info.farm_OnShow (dialog, data) 163 return info.farm_OnShow (dialog, data)
163 end 164 end
164 end 165 end
165 local function OnAccept_witheditbox (dialog, data, data2) 166 local function OnAccept_witheditbox (dialog, data, data2)
166 local info = StaticPopupDialogs[dialog.which] 167 local info = StaticPopupDialogs[dialog.which]
167 dialog.usertext = dialog[info.hasWideEditBox and "wideEditBox" or "editBox"]:GetText():trim() 168 --dialog.usertext = dialog[info.hasWideEditBox and "wideEditBox" or "editBox"]:GetText():trim()
169 dialog.usertext = dialog.editBox:GetText():trim()
168 if info.farm_OnAccept then 170 if info.farm_OnAccept then
169 return info.farm_OnAccept (dialog, data, data2) 171 return info.farm_OnAccept (dialog, data, data2)
170 end 172 end
173 end
174 local function OnHide_cleanup (dialog)
175 dialog.data = nil
176 dialog.data2 = nil
171 end 177 end
172 178
173 --[[ 179 --[[
174 StaticPopup 180 StaticPopup
175 ]] 181 ]]
187 t.OnAccept = OnAccept_witheditbox 193 t.OnAccept = OnAccept_witheditbox
188 -- this calls OnCancel with "clicked", unless noCancelOnEscape is set 194 -- this calls OnCancel with "clicked", unless noCancelOnEscape is set
189 t.EditBoxOnEscapePressed = StaticPopup_EscapePressed 195 t.EditBoxOnEscapePressed = StaticPopup_EscapePressed
190 end 196 end
191 197
198 if not t.OnHide then
199 t.OnHide = OnHide_cleanup
200 end
201
192 t.timeout = 0 202 t.timeout = 0
193 t.whileDead = true 203 t.whileDead = true
194 t.hideOnEscape = true 204 t.hideOnEscape = true
195 t.enterClicksFirstButton = true 205 t.enterClicksFirstButton = true
196 206
206 216
207 if ({ 217 if ({
208 ["Bandwagon"] = true, ["Kilvin"] = true, ["Waterfaucet"] = true, 218 ["Bandwagon"] = true, ["Kilvin"] = true, ["Waterfaucet"] = true,
209 ["Farmbuyer"] = true, ["Oxdeadbeef"] = true, ["Pointystick"] = true, 219 ["Farmbuyer"] = true, ["Oxdeadbeef"] = true, ["Pointystick"] = true,
210 ["Angryhobbit"] = true, ["Malrubius"] = true, ["Hemogoblin"] = true, 220 ["Angryhobbit"] = true, ["Malrubius"] = true, ["Hemogoblin"] = true,
221 ["Ossipago"] = true,
211 })[UnitName("player")] then 222 })[UnitName("player")] then
212 lib.author_debug = true 223 lib.author_debug = true
213 _G.safeprint = lib.safeprint 224 _G.safeprint = lib.safeprint
214 _G.safeiprint = lib.safeiprint 225 _G.safeiprint = lib.safeiprint
215 function lib.tabledump(t) 226 function lib.tabledump(t)