comparison Modules/Config.lua @ 205:0ea991d9093c

Config and Summary windows are now toggled rather than always shown.
author Zerotorescue
date Sat, 05 Feb 2011 19:36:35 +0100
parents 90e5911a2ff1
children 1959e2b3dfe1
comparison
equal deleted inserted replaced
204:4f5e114fe15f 205:0ea991d9093c
1304 -- Object functions 1304 -- Object functions
1305 1305
1306 function mod:OnEnable() 1306 function mod:OnEnable()
1307 -- Register our config slash command 1307 -- Register our config slash command
1308 -- /im config 1308 -- /im config
1309 addon:RegisterSlash(function(this) 1309 addon:RegisterSlash(function()
1310 -- We don't want any other windows open at this time. 1310 if mod:IsFrameOpen() then
1311 for name, module in this:IterateModules() do 1311 mod:CloseFrame();
1312 if module.CloseFrame then 1312 else
1313 module:CloseFrame(); 1313 mod:Show();
1314 end
1315 end 1314 end
1316
1317 this:GetModule("Config"):Show();
1318 end, { "c", "config", "conf", "option", "options", "opt", "setting", "settings" }, "|Hfunction:InventoriumCommandHandler:config|h|cff00fff7/im config|r|h (or /im c) - Open the config window to change the settings and manage groups."); 1315 end, { "c", "config", "conf", "option", "options", "opt", "setting", "settings" }, "|Hfunction:InventoriumCommandHandler:config|h|cff00fff7/im config|r|h (or /im c) - Open the config window to change the settings and manage groups.");
1319 1316
1320 self:Load(false); 1317 self:Load(false);
1321 1318
1322 -- Whenever the profile is changed, update the groups | args: (object for the functionName, eventName, functionName) 1319 -- Whenever the profile is changed, update the groups | args: (object for the functionName, eventName, functionName)
1326 1323
1327 -- Register our custom widgets 1324 -- Register our custom widgets
1328 local Widgets = addon:GetModule("Widgets"); 1325 local Widgets = addon:GetModule("Widgets");
1329 Widgets:ItemLinkButton(); 1326 Widgets:ItemLinkButton();
1330 Widgets:ConfigItemLinkButton(); 1327 Widgets:ConfigItemLinkButton();
1328 end
1329
1330 function mod:Show()
1331 -- We don't want any other windows open at this time.
1332 for name, module in addon:IterateModules() do
1333 if module.CloseFrame then
1334 module:CloseFrame();
1335 end
1336 end
1337
1338 self:Load(true);
1339
1340 AceConfigDialog:Open("Inventorium");
1341 end
1342
1343 function mod:IsFrameOpen()
1344 return (AceConfigDialog.OpenFrames["Inventorium"] ~= nil);
1345 end
1346
1347 function mod:CloseFrame()
1348 LibStub("AceConfigDialog-3.0"):Close("Inventorium");
1331 end 1349 end
1332 1350
1333 function mod:ExportGroup(groupName) 1351 function mod:ExportGroup(groupName)
1334 -- We want to include the group name, so we copy the table then set another value 1352 -- We want to include the group name, so we copy the table then set another value
1335 local temp = CopyTable(addon.db.profile.groups[groupName]); 1353 local temp = CopyTable(addon.db.profile.groups[groupName]);
1374 end 1392 end
1375 1393
1376 -- Add to the blizzard addons options thing 1394 -- Add to the blizzard addons options thing
1377 AceConfigDialog:AddToBlizOptions("Inventorium", "Inventorium"); 1395 AceConfigDialog:AddToBlizOptions("Inventorium", "Inventorium");
1378 end 1396 end
1379 end
1380
1381 function mod:Show()
1382 self:Load(true);
1383
1384 AceConfigDialog:Open("Inventorium");
1385 end 1397 end
1386 1398
1387 function mod:FillOptions() 1399 function mod:FillOptions()
1388 options = { 1400 options = {
1389 type = "group", 1401 type = "group",