comparison Core.lua @ 91:0a8e4a93316d

Extremely small irrelevant cleaning up changes I made while looking through the code.
author Zerotorescue
date Sat, 18 Sep 2010 15:37:27 +0200
parents c15dbeb84ddc
children d62eaa354443
comparison
equal deleted inserted replaced
90:b8902f09e382 91:0a8e4a93316d
169 check:SetHeight(26); 169 check:SetHeight(26);
170 check:SetWidth(26); 170 check:SetWidth(26);
171 check:SetPoint("TOPLEFT", MailFrame, "TOPLEFT", 68, -13); 171 check:SetPoint("TOPLEFT", MailFrame, "TOPLEFT", 68, -13);
172 check:SetChecked(true); 172 check:SetChecked(true);
173 check:SetHitRectInsets(0, -80, 0, 0); 173 check:SetHitRectInsets(0, -80, 0, 0);
174 check:SetScript("OnClick", function(self) 174 check:SetScript("OnClick", function(cbSelf)
175 if IsShiftKeyDown() then 175 if IsShiftKeyDown() then
176 -- Shift key = toggle addon on or off, since addon is already on there's only one option 176 -- Shift key = toggle addon on or off, since addon is already on there's only one option
177 177
178 if not MailOpener:IsEnabled() then 178 if not self:IsEnabled() then
179 MailOpener:Print(L["Shift key was held down, so |cff00ff00enabling|r the entire addon as well as automatic opening of mail."]); 179 self:Print(L["Shift key was held down, so |cff00ff00enabling|r the entire addon as well as automatic opening of mail."]);
180 180
181 MailOpener:Enable(); 181 self:Enable();
182 182
183 -- The above calls MAIL_SHOW which changes AutoOpenMail, so we can't remember the old setting 183 -- The above calls MAIL_SHOW which changes AutoOpenMail, so we can't remember the old setting
184 AutoOpenMail = true; 184 AutoOpenMail = true;
185 185
186 self:SetChecked(true); 186 cbSelf:SetChecked(true);
187 else 187 else
188 MailOpener:Print(L["Shift key was held down, so |cffff0000disabling|r the entire addon."]); 188 self:Print(L["Shift key was held down, so |cffff0000disabling|r the entire addon."]);
189 189
190 MailOpener:Disable(); 190 self:Disable();
191 191
192 self:SetChecked(false); 192 cbSelf:SetChecked(false);
193 end 193 end
194 else 194 else
195 -- Normal click 195 -- Normal click
196 196
197 if self:GetChecked() then 197 if cbSelf:GetChecked() then
198 MailOpener:Print(L["|cff00ff00Enabling|r automatic opening of mail."]); 198 self:Print(L["|cff00ff00Enabling|r automatic opening of mail."]);
199 199
200 AutoOpenMail = true; 200 AutoOpenMail = true;
201 MailOpener:ScheduleOpen(false); 201 self:ScheduleOpen(false);
202 else 202 else
203 MailOpener:Print(L["|cffff0000Disabling|r automatic opening of mail."]); 203 self:Print(L["|cffff0000Disabling|r automatic opening of mail."]);
204 204
205 AutoOpenMail = false; 205 AutoOpenMail = false;
206 end 206 end
207 end 207 end
208 end); 208 end);
209 check.tooltipTitle = L["Mail Opener status"]; 209 check.tooltipTitle = L["Mail Opener status"];
210 check.tooltip = L["Toggle automatic mail opening |cff00ff00on|r or |cffff0000off|r (you can also enforce this by holding shift when opening the mailbox).\n\nYou can toggle this addon |cff00ff00on|r or |cffff0000off|r by |cfffed000shift-clicking|r this checkbox."]; 210 check.tooltip = L["Toggle automatic mail opening |cff00ff00on|r or |cffff0000off|r (you can also enforce this by holding shift when opening the mailbox).\n\nYou can toggle this addon |cff00ff00on|r or |cffff0000off|r by |cfffed000shift-clicking|r this checkbox."];
211 check:SetScript("OnEnter", function(self) 211 check:SetScript("OnEnter", function(cbSelf)
212 if MailOpener.db.profile.general.showHelpTooltips then 212 if self.db.profile.general.showHelpTooltips then
213 GameTooltip:SetOwner(self, "ANCHOR_BOTTOM") 213 GameTooltip:SetOwner(cbSelf, "ANCHOR_BOTTOM")
214 GameTooltip:SetPoint("BOTTOM", self, "BOTTOM") 214 GameTooltip:SetPoint("BOTTOM", cbSelf, "BOTTOM")
215 GameTooltip:SetText(self.tooltipTitle, 1, .82, 0, 1) 215 GameTooltip:SetText(cbSelf.tooltipTitle, 1, .82, 0, 1)
216 216
217 if type(self.tooltip) == "string" then 217 if type(cbSelf.tooltip) == "string" then
218 GameTooltip:AddLine(self.tooltip, 1, 1, 1, 1); 218 GameTooltip:AddLine(cbSelf.tooltip, 1, 1, 1, 1);
219 end 219 end
220 220
221 GameTooltip:Show(); 221 GameTooltip:Show();
222 end 222 end
223 end); 223 end);
224 check:SetScript("OnLeave", function(self) 224 check:SetScript("OnLeave", function(cbSelf)
225 GameTooltip:Hide(); 225 GameTooltip:Hide();
226 end); 226 end);
227 227
228 -- Get reference to the text field 228 -- Get reference to the text field
229 local checkboxText = _G[check:GetName() .. "Text"]; 229 local checkboxText = _G[check:GetName() .. "Text"];
251 --BETA: MailOpener:ShowBetaPopup(); 251 --BETA: MailOpener:ShowBetaPopup();
252 --BETA:end 252 --BETA:end
253 end); 253 end);
254 button.tooltipTitle = L["Mail Opener Config"]; 254 button.tooltipTitle = L["Mail Opener Config"];
255 button.tooltip = L["Click to open the configuration window for Mail Opener."]; 255 button.tooltip = L["Click to open the configuration window for Mail Opener."];
256 button:SetScript("OnEnter", function(self) 256 button:SetScript("OnEnter", function(btnSelf)
257 if MailOpener.db.profile.general.showHelpTooltips then 257 if self.db.profile.general.showHelpTooltips then
258 GameTooltip:SetOwner(self, "ANCHOR_BOTTOM") 258 GameTooltip:SetOwner(btnSelf, "ANCHOR_BOTTOM")
259 GameTooltip:SetPoint("BOTTOM", self, "TOP") 259 GameTooltip:SetPoint("BOTTOM", btnSelf, "TOP")
260 GameTooltip:SetText(self.tooltipTitle, 1, .82, 0, 1) 260 GameTooltip:SetText(btnSelf.tooltipTitle, 1, .82, 0, 1)
261 261
262 if type(self.tooltip) == "string" then 262 if type(btnSelf.tooltip) == "string" then
263 GameTooltip:AddLine(self.tooltip, 1, 1, 1, 1); 263 GameTooltip:AddLine(btnSelf.tooltip, 1, 1, 1, 1);
264 end 264 end
265 265
266 GameTooltip:Show(); 266 GameTooltip:Show();
267 end 267 end
268 end); 268 end);
269 button:SetScript("OnLeave", function(self) 269 button:SetScript("OnLeave", function(btnSelf)
270 GameTooltip:Hide(); 270 GameTooltip:Hide();
271 end); 271 end);
272 272
273 self.btnConfig = button; 273 self.btnConfig = button;
274 274
375 MailOpener.cbOpenAll:SetChecked(true); 375 MailOpener.cbOpenAll:SetChecked(true);
376 376
377 AutoOpenMail = true; 377 AutoOpenMail = true;
378 MailOpener:ScheduleOpen(false); 378 MailOpener:ScheduleOpen(false);
379 end, 379 end,
380 OnCancel = function (_,reason) 380 OnCancel = function ()
381 MailOpener:Print(L["You can always change the default status in the General config (|cff00ffff/mo c|r)."]); 381 MailOpener:Print(L["You can always change the default status in the General config (|cff00ffff/mo c|r)."]);
382 end, 382 end,
383 timeout = 0, 383 timeout = 0,
384 whileDead = 1, 384 whileDead = 1,
385 hideOnEscape = 1, 385 hideOnEscape = 1,