comparison Modules/Scanner.lua @ 142:56f33abee1e3

Always making sure the mover window is not there and making the frame when all data is ready, rather than before checking if the confirmation should even appear.
author Zerotorescue
date Tue, 18 Jan 2011 23:00:18 +0100
parents 20d7d3d19f97
children 12a8ea5af671
comparison
equal deleted inserted replaced
141:5ed50feddeb0 142:56f33abee1e3
10 10
11 local function OnMoveAccept() 11 local function OnMoveAccept()
12 mod:Pause(); 12 mod:Pause();
13 Mover:BeginMove(currentLocation, mod.Unpause); 13 Mover:BeginMove(currentLocation, mod.Unpause);
14 14
15 InventoriumItemMover:Hide(); 15 if InventoriumItemMover then
16 InventoriumItemMover:Hide();
17 end
16 end 18 end
17 19
18 local function OnMoveCancel() 20 local function OnMoveCancel()
19 Mover:ResetQueue(); 21 Mover:ResetQueue();
20 currentLocation = nil; 22 currentLocation = nil;
21 23
22 InventoriumItemMover:Hide(); 24 if InventoriumItemMover then
25 InventoriumItemMover:Hide();
26 end
23 end 27 end
24 28
25 local function GetSmallCoinTextureString(coins) 29 local function GetSmallCoinTextureString(coins)
26 if coins >= 10000000 then 30 if coins >= 10000000 then
27 -- When we have1000g, hide silver and copper 31 -- When we have1000g, hide silver and copper
34 return GetCoinTextureString(coins); 38 return GetCoinTextureString(coins);
35 end 39 end
36 40
37 -- Refill moves window: refill form storage such as the bank, guild bank and mailbox 41 -- Refill moves window: refill form storage such as the bank, guild bank and mailbox
38 local function UseStorageRefillST() 42 local function UseStorageRefillST()
43 if not InventoriumItemMover then
44 addon:CreateMoverFrame();
45 end
46
39 local frame = InventoriumItemMover; -- both for speed as code-consistency 47 local frame = InventoriumItemMover; -- both for speed as code-consistency
40 48
41 -- Scrolling table with a list of items to be moved 49 -- Scrolling table with a list of items to be moved
42 local scrollTableWidth = ( frame.frmMeasureDummy:GetWidth() - 30 ); -- adjust width by the scrollbar size 50 local scrollTableWidth = ( frame.frmMeasureDummy:GetWidth() - 30 ); -- adjust width by the scrollbar size
43 local headers = { 51 local headers = {
108 addon:SetMoverFrameSettings("Inventorium Storage Refill", "The items listed below can be refilled from this location, do you wish to move them to your bags?", proceedButton, cancelButton, headers); 116 addon:SetMoverFrameSettings("Inventorium Storage Refill", "The items listed below can be refilled from this location, do you wish to move them to your bags?", proceedButton, cancelButton, headers);
109 end 117 end
110 118
111 -- Merchant restock window: restock from a merchant by buying items needed 119 -- Merchant restock window: restock from a merchant by buying items needed
112 local function UseMerchantRestockST(totalCost) 120 local function UseMerchantRestockST(totalCost)
121 if not InventoriumItemMover then
122 addon:CreateMoverFrame();
123 end
124
113 local frame = InventoriumItemMover; -- both for speed as code-consistency 125 local frame = InventoriumItemMover; -- both for speed as code-consistency
114 126
115 -- Scrolling table with a list of items to be moved 127 -- Scrolling table with a list of items to be moved
116 local scrollTableWidth = ( frame.frmMeasureDummy:GetWidth() - 30 ); -- adjust width by the scrollbar size 128 local scrollTableWidth = ( frame.frmMeasureDummy:GetWidth() - 30 ); -- adjust width by the scrollbar size
117 local headers = { 129 local headers = {
401 if addon.db.profile.defaults.autoRefillSkipConfirm then 413 if addon.db.profile.defaults.autoRefillSkipConfirm then
402 OnMoveAccept(); 414 OnMoveAccept();
403 else 415 else
404 local moves = Mover:GetMoves(); 416 local moves = Mover:GetMoves();
405 417
406 if not InventoriumItemMover then
407 addon:CreateMoverFrame();
408 end
409
410 -- This table is never copied, just referenced. It is the same for every row. 418 -- This table is never copied, just referenced. It is the same for every row.
411 local columns; 419 local columns;
412 420
413 if isRestock then 421 if isRestock then
414 local totalCost = 0; 422 local totalCost = 0;