vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 function tradeDispenserSettings_OnUpdate()
2 tradeDispenserVerbose(2, "Updated Settings-Frame")
3 if (tradeDispenserSettingsChannelDDframe) then tradeDispenserSettingsChannelDDframe:Hide(); end
4 if (tradeDispenserSettingsOSDscale and tradeDispenserSettingsSwatch and tD_CharDatas.OSD) then
5 if ( tD_CharDatas.OSD.isEnabled ) then
6 tradeDispenserSettingsOSDCheck:SetChecked(1);
7 tradeDispenserSettingsOSDLock:Show();
8 tradeDispenserSettingsOSDscale:Show();
9 tradeDispenserSettingsSwatch:Show();
10 tradeDispenserSettingsOSDborder:Show();
11 tradeDispenserSettingsOSDhoriz:Show();
12 else
13 tradeDispenserSettingsOSDCheck:SetChecked(0);
14 tradeDispenserSettingsOSDLock:Hide();
15 tradeDispenserSettingsOSDscale:Hide();
16 tradeDispenserSettingsSwatch:Hide();
17 tradeDispenserSettingsOSDborder:Hide();
18 tradeDispenserSettingsOSDhoriz:Hide();
19 end
20 tradeDispenserSettingsOSDLock:SetChecked(tD_CharDatas.OSD.locked);
21 end
22  
23 if (tD_CharDatas.ChannelID) then tradeDispenser_ChannelUpdate() end
24  
25 if (tD_CharDatas.broadcastSlice and tradeDispenserSettingsBroadcastTimerLbl) then
26 tradeDispenserSettingsBroadcastTimerLbl:SetText(floor(tD_CharDatas.broadcastSlice/60).." min")
27 end
28  
29 if (tradeDispenserSettingsBroadcastCheck) then
30 if (tD_CharDatas.AutoBroadcast and tradeDispenserSettingsBroadcastTimer) then
31 tradeDispenserSettingsBroadcastCheck:SetChecked(1);
32 tradeDispenserSettingsBroadcastTimer:Show();
33 tradeDispenserSettingsBroadcastTimer:SetValue(math.floor(tD_CharDatas.broadcastSlice/60));
34 else
35 tradeDispenserSettingsBroadcastCheck:SetChecked(0);
36 tradeDispenserSettingsBroadcastTimer:Hide();
37 tD_CharDatas.AutoBroadcast=false;
38 end
39 end
40  
41 if (tradeDispenserSettingsTimelimitCheck) then
42 if (tD_CharDatas.TimelimitCheck) then
43 tradeDispenserSettingsTimelimitCheck:SetChecked(1);
44 tradeDispenserSettingsTimelimitSlider:Show();
45 tradeDispenserSettingsTimelimitSlider:SetValue(tD_CharDatas.Timelimit);
46 tradeDispenserSettingsTimelimitSliderLbl:SetText(tD_CharDatas.Timelimit.." sec");
47 else
48 tradeDispenserSettingsTimelimitCheck:SetChecked(0);
49 tradeDispenserSettingsTimelimitSlider:Hide();
50 end
51 end
52 end
53  
54  
55 function tradeDispenser_EditBoxUpdate()
56 tradeDispenserVerbose(2,"EditBox updated")
57 local temp = 480;
58 if (not tradeDispenserTradeControl or not tradeDispenserSettingsText) then return end;
59  
60 if (tradeDispenserTradeControl:IsShown()) then temp=temp+184 end
61  
62 tradeDispenserSettingsText:SetWidth( temp );
63 tradeDispenserSettingsText:SetHeight( 24*tD_CharDatas.Random + 6);
64  
65 local i;
66 for i=1,8 do
67 local obj = getglobal("tradeDispenserSettingsTextBroadcastText"..i);
68 obj:SetWidth( temp-130 );
69 getglobal("tradeDispenserSettingsTextBroadcastText"..i.."Middle"):SetWidth( temp-130 );
70  
71 if (i<=tD_CharDatas.Random) then obj:Show() else obj:Hide() end
72 if (tD_CharDatas.RndText and tD_CharDatas.RndText[i]) then
73 obj:SetText(tD_CharDatas.RndText[i]);
74 else
75 obj:SetText("empty");
76 end
77 end
78 end
79  
80  
81 function tradeDispenser_ChannelUpdate()
82 tradeDispenserSettingsChannelDDTitleLbL:SetText(tradeDispenserChannelColors[tD_CharDatas.ChannelID].text);
83 local col = tradeDispenserChannelColors[tD_CharDatas.ChannelID];
84 tradeDispenserSettingsChannelDDTitleLbL:SetTextColor(col.r, col.g, col.b);
85 end
86  
87  
88 function tradeDispenserSettings_OnColorChange(frame)
89 frame.r = tD_CharDatas.OSD.r;
90 frame.g = tD_CharDatas.OSD.g;
91 frame.b = tD_CharDatas.OSD.b;
92 frame.opacity = 1-tD_CharDatas.OSD.alpha;
93 frame.opacityFunc = tradeDispenserSettings_SetColor;
94 frame.swatchFunc = tradeDispenserSettings_SetOpacity;
95 frame.hasOpacity = 1;
96 ColorPickerFrame.frame = frame;
97 CloseMenus();
98 UIDropDownMenuButton_OpenColorPicker(frame);
99 end
100  
101 function tradeDispenserSettings_SetColor()
102 local r, g, b = ColorPickerFrame:GetColorRGB();
103 tD_CharDatas.OSD.r=r;
104 tD_CharDatas.OSD.g=g;
105 tD_CharDatas.OSD.b=b;
106 tradeDispenserSettings_OnUpdate();
107 tradeDispenserOSD_OnUpdate();
108 getglobal(ColorPickerFrame.frame:GetName() .. "SwatchNormalTexture"):SetVertexColor(r, g, b);
109 end
110  
111 function tradeDispenserSettings_SetOpacity()
112 local a = OpacitySliderFrame:GetValue();
113 tD_CharDatas.OSD.alpha=1-a;
114 tradeDispenserSettings_OnUpdate();
115 tradeDispenserOSD_OnUpdate();
116 end
117  
118  
119  
120  
121 -- FUNCTIONS to insert ITEMLINKS --
122 -- copied and modified from the addon "SuperMacro" --
123 -- really well done! thx.
124 -- btw: they expands the "default" functions by some features
125  
126 function tradeDispenserSettings_InsertItemText(link)
127 if ( not link ) then return end;
128 if ( IsAltKeyDown() or IsShiftKeyDown() or IsControlKeyDown() ) then
129 local temp = tD_CharDatas.OnBroadcastText:GetText();
130 tD_CharDatas.OnBroadcastText:Insert(link);
131 tradeDispenserVerbose(1,"Added "..link);
132 return 1;
133 end
134 end
135  
136  
137 local tD_oldContainerFrameItemButton_OnClick = ContainerFrameItemButton_OnClick;
138 function ContainerFrameItemButton_OnClick(button, ignoreShift)
139 if ( button=="LeftButton" and not ignoreShift and tD_CharDatas.OnBroadcastText~=nil ) then
140 local link = GetContainerItemLink(this:GetParent():GetID(), this:GetID());
141 if ( not tradeDispenserSettings_InsertItemText(link) ) then
142 tD_oldContainerFrameItemButton_OnClick(button, ignoreShift);
143 end
144 return;
145 end
146 tD_oldContainerFrameItemButton_OnClick(button, ignoreShift);
147 end
148  
149 local tD_oldPaperDollItemSlotButton_OnClick = PaperDollItemSlotButton_OnClick;
150 function PaperDollItemSlotButton_OnClick(button, ignoreShift)
151 if ( button=="LeftButton" and not ignoreShift and tD_CharDatas.OnBroadcastText~=nil ) then
152 local link = GetInventoryItemLink("player", this:GetID());
153 if ( not tradeDispenserSettings_InsertItemText(link) ) then
154 tD_oldPaperDollItemSlotButton_OnClick(button, ignoreShift);
155 end
156 return;
157 end
158 tD_oldPaperDollItemSlotButton_OnClick(button, ignoreShift);
159 end
160  
161 local tD_oldBagSlotButton_OnClick = BagSlotButton_OnClick;
162 function BagSlotButton_OnClick()
163 if ( arg1=="LeftButton" and tD_CharDatas.OnBroadcastText~=nil ) then
164 this:SetChecked(not this:GetChecked());
165 local link = GetInventoryItemLink("player", this:GetID());
166 if ( not tradeDispenserSettings_InsertItemText(link) ) then
167 tD_oldBagSlotButton_OnClick();
168 end
169 return;
170 end
171 tD_oldBagSlotButton_OnClick();
172 end
173  
174 local tD_oldBagSlotButton_OnShiftClick = BagSlotButton_OnShiftClick;
175 function BagSlotButton_OnShiftClick()
176 if ( tD_CharDatas.OnBroadcastText~=nil ) then
177 this:SetChecked(not this:GetChecked());
178 local link = GetInventoryItemLink("player", this:GetID());
179 if ( not tradeDispenserSettings_InsertItemText(link) ) then
180 tD_oldBagSlotButton_OnShiftClick();
181 end
182 return;
183 end
184 tD_oldBagSlotButton_OnShiftClick();
185 end