lotrointerface.com
Search Downloads

LoTROInterface SVN SequenceBars

[/] [trunk/] [Thurallor/] [SequenceBars/] [Group.lua] - Blame information for rev 201

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 8 Thurallor-7095
Group = class(Node);
2 2 Thurallor-7095
 
3 Thurallor-7095
function Group:Constructor(parent, groupID, settings)
4 Thurallor-7095
    Turbine.UI.Window.Constructor(self);
5 Thurallor-7095
    self.constructing = true;
6 Thurallor-7095
 
7 Thurallor-7095
    self.parent = parent;
8 Thurallor-7095
    self.manager = parent.manager;
9 Thurallor-7095
    self.groupID = groupID;
10 Thurallor-7095
    self.objectID = groupID;
11 Thurallor-7095
    self.globals = self.manager.settings;
12 Thurallor-7095
 
13 Thurallor-7095
    -- Default settings
14 Thurallor-7095
    local defaults = {};
15 Thurallor-7095
    defaults.type = "group";
16 Thurallor-7095
    defaults.hidden = false;
17 Thurallor-7095
    defaults.barsMoveTogether = false;
18 Thurallor-7095
    defaults.caption = {};
19 Thurallor-7095
    defaults.caption.text = L:GetText("/Default/GroupName");
20 Thurallor-7095
    defaults.caption.width = 80;
21 Thurallor-7095
    defaults.caption.height = 20;
22 Thurallor-7095
    defaults.caption.font = Turbine.UI.Lotro.Font.TrajanPro15;
23 Thurallor-7095
    defaults.color = "C0C0C0";
24 Thurallor-7095
    defaults.barIDs = { "new" };
25 Thurallor-7095
    defaults.groupIDs = {};
26 Thurallor-7095
    defaults.deletedBarIDs = {};
27 Thurallor-7095
    defaults.deletedGroupIDs = {};
28 Thurallor-7095
    defaults.eventHandlers = {};
29 Thurallor-7095
    defaults.eventsEnabled = false;
30 Thurallor-7095
 
31 Thurallor-7095
    -- Previously-saved settings override the defaults
32 Thurallor-7095
    DeepTableCopy(settings, defaults);
33 Thurallor-7095
    DeepTableCopy(defaults, settings);
34 Thurallor-7095
    self.settings = settings;
35 Thurallor-7095
 
36 29 Thurallor-7095
    self:ReapplySettings();
37 2 Thurallor-7095
    self:LoadBars();
38 Thurallor-7095
    self:LoadGroups();
39 Thurallor-7095
    self.constructing = nil;
40 Thurallor-7095
    self:SetWantsEvents(self.settings.eventsEnabled);
41 Thurallor-7095
end
42 Thurallor-7095
 
43 29 Thurallor-7095
function Group:ReapplySettings()
44 Thurallor-7095
 
45 Thurallor-7095
    -- Make color object from hex string
46 Thurallor-7095
    self.color = Thurallor.Utils.Color(1, 0, 0, 0);
47 Thurallor-7095
    self.color:SetHex(self.settings.color);
48 Thurallor-7095
 
49 Thurallor-7095
    -- For backward compatibility
50 Thurallor-7095
    for _, handler in pairs(self.settings.eventHandlers) do
51 Thurallor-7095
        if (handler.action) then
52 30 Thurallor-7095
            handler.action = string.gsub(handler.action, "self:SetHidden%(false%); self:Activate%(%); ", "self:SetHidden(false); ");
53 31 Thurallor-7095
            handler.action = string.gsub(handler.action, "self:SetHidden%(false%); self:BringToFront%(%); ", "self:SetHidden(false); ");
54 30 Thurallor-7095
            handler.action = string.gsub(handler.action, "self:Expand%(%); self:Activate%(%); ", "self:Expand(); ");
55 31 Thurallor-7095
            handler.action = string.gsub(handler.action, "self:Expand%(%); self:BringToFront%(%); ", "self:Expand(); ");
56 29 Thurallor-7095
        end
57 Thurallor-7095
    end
58 112 Thurallor-7095
        -- Convert fadetogray's settings
59 Thurallor-7095
        if (self.settings.barsCaptionsMinimized) then
60 Thurallor-7095
                self.settings.barsCaptionsMinimized = nil;
61 Thurallor-7095
                for b = 1, #self.settings.barIDs, 1 do
62 Thurallor-7095
                        local barID = self.settings.barIDs[b];
63 Thurallor-7095
                        local barSettings = self.globals.bars[barID];
64 Thurallor-7095
                        if (type(barSettings) == "table") then
65 Thurallor-7095
                                barSettings.caption.hidden = nil;
66 Thurallor-7095
                                barSettings.caption.visible = "WhenMouseIsPresent";
67 Thurallor-7095
                                barSettings.caption.clickThru = true;
68 Thurallor-7095
                        end
69 Thurallor-7095
                end
70 Thurallor-7095
        end
71 29 Thurallor-7095
end
72 Thurallor-7095
 
73 2 Thurallor-7095
function Group:LoadBars()
74 Thurallor-7095
    for b = 1, #self.settings.barIDs, 1 do
75 Thurallor-7095
        local barID = self.settings.barIDs[b];
76 Thurallor-7095
        if (barID == "new") then
77 Thurallor-7095
            barID = self:FindNewObjectID();
78 Thurallor-7095
            self.settings.barIDs[b] = barID;
79 Thurallor-7095
        end
80 Thurallor-7095
        if (self.globals.bars[barID] == nil) then
81 Thurallor-7095
            self.globals.bars[barID] = {};
82 Thurallor-7095
        end
83 Thurallor-7095
        self.manager.objects[barID] = Bar(self, barID, self.globals.bars[barID]);
84 Thurallor-7095
    end
85 Thurallor-7095
end
86 Thurallor-7095
 
87 Thurallor-7095
function Group:LoadGroups()
88 Thurallor-7095
    for g = 1, #self.settings.groupIDs, 1 do
89 Thurallor-7095
        local groupID = self.settings.groupIDs[g];
90 Thurallor-7095
        if (groupID == "new") then
91 Thurallor-7095
            groupID = self:FindNewObjectID();
92 Thurallor-7095
            self.settings.groupIDs[g] = groupID;
93 Thurallor-7095
        end
94 Thurallor-7095
        if (self.globals.groups[groupID] == nil) then
95 Thurallor-7095
            self.globals.groups[groupID] = {};
96 Thurallor-7095
        end
97 Thurallor-7095
        self.manager.objects[groupID] = Group(self, groupID, self.globals.groups[groupID]);
98 Thurallor-7095
    end
99 Thurallor-7095
end
100 Thurallor-7095
 
101 20 Thurallor-7095
-- Iterator for bar objects
102 Thurallor-7095
function Group:bar_objects()
103 Thurallor-7095
    local state = { ["index"] = 1 };
104 Thurallor-7095
    local function iterator(state)
105 Thurallor-7095
        local barID = self.settings.barIDs[state.index];
106 Thurallor-7095
        state.index = state.index + 1;
107 Thurallor-7095
        if (barID ~= nil) then
108 Thurallor-7095
            local bar = self.manager.objects[barID];
109 Thurallor-7095
            if (bar == nil) then -- proceed to the next bar ID
110 Thurallor-7095
                return iterator(state);
111 Thurallor-7095
            end
112 Thurallor-7095
            return bar;
113 2 Thurallor-7095
        end
114 Thurallor-7095
    end
115 20 Thurallor-7095
    return iterator, state, nil;
116 Thurallor-7095
end
117 Thurallor-7095
 
118 Thurallor-7095
-- Iterator for subgroup objects
119 Thurallor-7095
function Group:group_objects()
120 Thurallor-7095
    local state = { ["index"] = 1 };
121 Thurallor-7095
    local function iterator(state)
122 Thurallor-7095
        local groupID = self.settings.groupIDs[state.index];
123 Thurallor-7095
        state.index = state.index + 1;
124 Thurallor-7095
        if (groupID ~= nil) then
125 Thurallor-7095
            local group = self.manager.objects[groupID];
126 Thurallor-7095
            if (group == nil) then -- proceed to the next group ID
127 Thurallor-7095
                return iterator(state);
128 Thurallor-7095
            end
129 Thurallor-7095
            return group;
130 2 Thurallor-7095
        end
131 Thurallor-7095
    end
132 20 Thurallor-7095
    return iterator, state, nil;
133 Thurallor-7095
end
134 Thurallor-7095
 
135 Thurallor-7095
function Group:ApplyHiddenness()
136 Thurallor-7095
    for bar in self:bar_objects() do
137 Thurallor-7095
        bar:ApplyHiddenness();
138 Thurallor-7095
    end
139 Thurallor-7095
    for group in self:group_objects() do
140 Thurallor-7095
        group:ApplyHiddenness();
141 Thurallor-7095
    end
142 2 Thurallor-7095
end
143 Thurallor-7095
 
144 20 Thurallor-7095
function Group:Activate()
145 Thurallor-7095
    for bar in self:bar_objects() do
146 Thurallor-7095
        bar:Activate();
147 Thurallor-7095
    end
148 Thurallor-7095
    for group in self:group_objects() do
149 Thurallor-7095
        group:Activate();
150 Thurallor-7095
    end
151 Thurallor-7095
end
152 Thurallor-7095
 
153 31 Thurallor-7095
function Group:BringToFront()
154 Thurallor-7095
    for bar in self:bar_objects() do
155 Thurallor-7095
        bar:BringToFront();
156 Thurallor-7095
    end
157 Thurallor-7095
    for group in self:group_objects() do
158 Thurallor-7095
        group:BringToFront();
159 Thurallor-7095
    end
160 Thurallor-7095
end
161 Thurallor-7095
 
162 26 Thurallor-7095
function Group:Expand()
163 121 Thurallor-7095
    if (self.Log) then
164 Thurallor-7095
        DoCallbacks(self, "Log", {"expanding all bars", "GROUP"});
165 Thurallor-7095
    end
166 26 Thurallor-7095
    for bar in self:bar_objects() do
167 Thurallor-7095
        bar:Expand();
168 Thurallor-7095
    end
169 Thurallor-7095
    for group in self:group_objects() do
170 Thurallor-7095
        group:Expand();
171 Thurallor-7095
    end
172 Thurallor-7095
end
173 Thurallor-7095
 
174 Thurallor-7095
function Group:IsExpanded()
175 Thurallor-7095
    for bar in self:bar_objects() do
176 Thurallor-7095
        if (not bar:IsExpanded()) then
177 Thurallor-7095
            return false;
178 Thurallor-7095
        end
179 Thurallor-7095
    end
180 Thurallor-7095
    for group in self:group_objects() do
181 Thurallor-7095
        if (not group:IsExpanded()) then
182 Thurallor-7095
            return false;
183 Thurallor-7095
        end
184 Thurallor-7095
    end
185 Thurallor-7095
    return true;
186 Thurallor-7095
end
187 Thurallor-7095
 
188 Thurallor-7095
function Group:Collapse()
189 121 Thurallor-7095
    if (self.Log) then
190 Thurallor-7095
        DoCallbacks(self, "Log", {"collapsing all bars", "GROUP"});
191 Thurallor-7095
    end
192 26 Thurallor-7095
    for bar in self:bar_objects() do
193 Thurallor-7095
        bar:Collapse();
194 Thurallor-7095
    end
195 Thurallor-7095
    for group in self:group_objects() do
196 Thurallor-7095
        group:Collapse();
197 Thurallor-7095
    end
198 Thurallor-7095
end
199 Thurallor-7095
 
200 Thurallor-7095
function Group:IsCollapsed()
201 Thurallor-7095
    for bar in self:bar_objects() do
202 Thurallor-7095
        if (not bar:IsCollapsed()) then
203 Thurallor-7095
            return false;
204 Thurallor-7095
        end
205 Thurallor-7095
    end
206 Thurallor-7095
    for group in self:group_objects() do
207 Thurallor-7095
        if (not group:IsCollapsed()) then
208 Thurallor-7095
            return false;
209 Thurallor-7095
        end
210 Thurallor-7095
    end
211 Thurallor-7095
    return true;
212 Thurallor-7095
end
213 Thurallor-7095
 
214 43 Thurallor-7095
function Group:StartExecuting()
215 121 Thurallor-7095
    if (self.Log) then
216 Thurallor-7095
        DoCallbacks(self, "Log", {"starting continuous execution", "GROUP"});
217 Thurallor-7095
    end
218 43 Thurallor-7095
    for bar in self:bar_objects() do
219 Thurallor-7095
        bar:StartExecuting();
220 Thurallor-7095
    end
221 Thurallor-7095
    for group in self:group_objects() do
222 Thurallor-7095
        group:StartExecuting();
223 Thurallor-7095
    end
224 Thurallor-7095
end
225 Thurallor-7095
 
226 Thurallor-7095
function Group:StopExecuting()
227 121 Thurallor-7095
    if (self.Log) then
228 Thurallor-7095
        DoCallbacks(self, "Log", {"halting continuous execution", "GROUP"});
229 Thurallor-7095
    end
230 43 Thurallor-7095
    for bar in self:bar_objects() do
231 Thurallor-7095
        bar:StopExecuting();
232 Thurallor-7095
    end
233 Thurallor-7095
    for group in self:group_objects() do
234 Thurallor-7095
        group:StopExecuting();
235 Thurallor-7095
    end
236 Thurallor-7095
end
237 Thurallor-7095
 
238 16 Thurallor-7095
function Group:Redraw(noReset)
239 20 Thurallor-7095
    for bar in self:bar_objects() do
240 Thurallor-7095
        bar:Redraw(noReset);
241 2 Thurallor-7095
    end
242 20 Thurallor-7095
    for group in self:group_objects() do
243 Thurallor-7095
        group:Redraw(noReset);
244 2 Thurallor-7095
    end
245 Thurallor-7095
end
246 Thurallor-7095
 
247 128 Thurallor-7095
function Group:SetTransparency(opacity)
248 Thurallor-7095
    for bar in self:bar_objects() do
249 Thurallor-7095
        bar:SetTransparency(opacity);
250 Thurallor-7095
    end
251 Thurallor-7095
    for group in self:group_objects() do
252 Thurallor-7095
        group:SetTransparency(opacity);
253 Thurallor-7095
    end
254 Thurallor-7095
    self:SaveSettings(true);
255 Thurallor-7095
end
256 Thurallor-7095
 
257 167 Thurallor-7095
function Group:SetUseOnRightClick(useOnRightClick)
258 Thurallor-7095
    for bar in self:bar_objects() do
259 Thurallor-7095
        bar:SetUseOnRightClick(useOnRightClick);
260 Thurallor-7095
    end
261 Thurallor-7095
    for group in self:group_objects() do
262 Thurallor-7095
        group:SetUseOnRightClick(useOnRightClick);
263 Thurallor-7095
    end
264 Thurallor-7095
end
265 Thurallor-7095
 
266 2 Thurallor-7095
function Group:CanHaveChildren()
267 Thurallor-7095
    return true;
268 Thurallor-7095
end
269 Thurallor-7095
 
270 Thurallor-7095
function Group:Contains(object)
271 Thurallor-7095
    while (object.parent) do
272 Thurallor-7095
        if (object.parent == self) then
273 Thurallor-7095
            return true;
274 Thurallor-7095
        end
275 Thurallor-7095
        object = object.parent;
276 Thurallor-7095
    end
277 Thurallor-7095
    return false;
278 Thurallor-7095
end
279 Thurallor-7095
 
280 Thurallor-7095
function Group:GetChildIDs()
281 Thurallor-7095
    local objectIDs = {};
282 Thurallor-7095
    for b = 1, #self.settings.barIDs, 1 do
283 Thurallor-7095
        local barID = self.settings.barIDs[b];
284 Thurallor-7095
        table.insert(objectIDs, barID);
285 Thurallor-7095
    end
286 Thurallor-7095
    for g = 1, #self.settings.groupIDs, 1 do
287 Thurallor-7095
        local groupID = self.settings.groupIDs[g];
288 Thurallor-7095
        table.insert(objectIDs, groupID);
289 Thurallor-7095
    end
290 Thurallor-7095
    return objectIDs;
291 Thurallor-7095
end
292 Thurallor-7095
 
293 Thurallor-7095
function Group:GetChild(childID)
294 Thurallor-7095
    return self.manager.objects[childID];
295 Thurallor-7095
end
296 Thurallor-7095
 
297 Thurallor-7095
function Group:GetBarsMoveTogether()
298 Thurallor-7095
    if (self.settings.barsMoveTogether) then
299 Thurallor-7095
        return true;
300 Thurallor-7095
    elseif (self.parent and self.parent.GetBarsMoveTogether) then
301 Thurallor-7095
        return self.parent:GetBarsMoveTogether();
302 Thurallor-7095
    else
303 Thurallor-7095
        return false;
304 Thurallor-7095
    end
305 Thurallor-7095
end
306 Thurallor-7095
 
307 Thurallor-7095
function Group:IsEmpty()
308 Thurallor-7095
    return ((#self.settings.barIDs == 0) and (#self.settings.groupIDs == 0));
309 Thurallor-7095
end
310 Thurallor-7095
 
311 Thurallor-7095
function Group:CloneBar(barID)
312 Thurallor-7095
    local oldSettings = self.globals.bars[barID];
313 Thurallor-7095
    local newBarID = self:FindNewObjectID();
314 Thurallor-7095
    local newSettings = { };
315 Thurallor-7095
    self.globals.bars[newBarID] = newSettings;
316 Thurallor-7095
    DeepTableCopy(oldSettings, newSettings);
317 6 Thurallor-7095
    local newBar = Bar(self, newBarID, newSettings);
318 Thurallor-7095
    self.manager.objects[newBarID] = newBar;
319 2 Thurallor-7095
    local gridSize = self.globals.gridSize;
320 6 Thurallor-7095
    newBar:OffsetPosition(gridSize, gridSize);
321 Thurallor-7095
    newBar:MoveOntoScreen();
322 2 Thurallor-7095
    table.insert(self.settings.barIDs, newBarID);
323 Thurallor-7095
    self:SaveSettings(true);
324 Thurallor-7095
    return newBarID;
325 Thurallor-7095
end
326 Thurallor-7095
 
327 Thurallor-7095
function Group:CloneGroup(groupID)
328 Thurallor-7095
--Alert("Settings before cloning", PrettyPrint(self.globals, ""));
329 Thurallor-7095
    local oldSettings = self.globals.groups[groupID];
330 Thurallor-7095
    local newGroupID = self:FindNewObjectID();
331 Thurallor-7095
    local newSettings = {};
332 Thurallor-7095
 
333 Thurallor-7095
    -- Create a clone of the existing group, but with nothing in it
334 Thurallor-7095
    local oldGroup = self.manager.objects[groupID];
335 Thurallor-7095
    self.globals.groups[newGroupID] = newSettings;
336 Thurallor-7095
    DeepTableCopy(oldSettings, newSettings);
337 Thurallor-7095
    newSettings.barIDs = {};
338 Thurallor-7095
    newSettings.groupIDs = {};
339 Thurallor-7095
    table.insert(self.settings.groupIDs, newGroupID);
340 Thurallor-7095
    local newGroup = Group(self, newGroupID, newSettings);
341 Thurallor-7095
    self.manager.objects[newGroupID] = newGroup;
342 Thurallor-7095
 
343 Thurallor-7095
    -- Clone the bars and subgroups, and transfer the clones from old group to new group
344 Thurallor-7095
    for b = 1, #oldSettings.barIDs, 1 do
345 Thurallor-7095
        local barID = oldSettings.barIDs[b];
346 Thurallor-7095
        local newBarID = oldGroup:CloneBar(barID);
347 Thurallor-7095
        self.manager:TransferBar(newBarID, oldGroup, newGroup);
348 Thurallor-7095
    end
349 Thurallor-7095
    for g = 1, #oldSettings.groupIDs, 1 do
350 Thurallor-7095
        local oldGroupID = oldSettings.groupIDs[g];
351 Thurallor-7095
        local _newGroupID = oldGroup:CloneGroup(oldGroupID);
352 Thurallor-7095
        self.manager:TransferGroup(_newGroupID, oldGroup, newGroup);
353 Thurallor-7095
    end
354 Thurallor-7095
 
355 Thurallor-7095
    self:SaveSettings(true);
356 Thurallor-7095
--Alert("Settings after cloning", PrettyPrint(self.globals, ""));
357 Thurallor-7095
    return newGroupID;
358 Thurallor-7095
end
359 Thurallor-7095
 
360 Thurallor-7095
function Group:DeleteBar(barID)
361 Thurallor-7095
    local foundPos;
362 Thurallor-7095
    local bar = self.manager.objects[barID];
363 Thurallor-7095
    if (bar) then
364 16 Thurallor-7095
        self.globals.bars[barID].deleted = true;
365 2 Thurallor-7095
        bar:Destroy();
366 Thurallor-7095
    end
367 Thurallor-7095
    for pos = 1, #self.settings.barIDs, 1 do
368 Thurallor-7095
        if (self.settings.barIDs[pos] == barID) then
369 Thurallor-7095
            foundPos = pos;
370 Thurallor-7095
            break;
371 Thurallor-7095
        end
372 Thurallor-7095
    end
373 Thurallor-7095
    table.remove(self.settings.barIDs, foundPos);
374 Thurallor-7095
    table.insert(self.settings.deletedBarIDs, barID);
375 5 Thurallor-7095
    self.manager.objects[barID] = nil;
376 2 Thurallor-7095
    self:SaveSettings(true);
377 Thurallor-7095
end
378 Thurallor-7095
 
379 Thurallor-7095
function Group:DeleteGroup(groupID)
380 Thurallor-7095
    local group = self.manager.objects[groupID];
381 Thurallor-7095
    if (group) then
382 16 Thurallor-7095
        self.globals.groups[groupID].deleted = true;
383 2 Thurallor-7095
        group:Destroy();
384 Thurallor-7095
    end
385 20 Thurallor-7095
    local foundPos = Search(self.settings.groupIDs, groupID);
386 2 Thurallor-7095
    if (foundPos) then
387 Thurallor-7095
        table.remove(self.settings.groupIDs, foundPos);
388 Thurallor-7095
    end
389 Thurallor-7095
    table.insert(self.settings.deletedGroupIDs, groupID);
390 5 Thurallor-7095
    self.manager.objects[groupID] = nil;
391 2 Thurallor-7095
    self:SaveSettings(true);
392 Thurallor-7095
end
393 Thurallor-7095
 
394 Thurallor-7095
function Group:UndeleteBar(barID)
395 20 Thurallor-7095
    local foundPos = Search(self.settings.deletedBarIDs, barID);
396 2 Thurallor-7095
    if (foundPos) then
397 Thurallor-7095
        table.remove(self.settings.deletedBarIDs, foundPos);
398 16 Thurallor-7095
        self.globals.bars[barID].deleted = nil;
399 2 Thurallor-7095
        self.manager.objects[barID] = Bar(self, barID, self.globals.bars[barID]);
400 Thurallor-7095
        table.insert(self.settings.barIDs, barID);
401 Thurallor-7095
        self:SaveSettings(true);
402 Thurallor-7095
    end
403 Thurallor-7095
end
404 Thurallor-7095
 
405 Thurallor-7095
function Group:UndeleteGroup(groupID)
406 20 Thurallor-7095
    local foundPos = Search(self.settings.deletedGroupIDs, groupID);
407 2 Thurallor-7095
    if (foundPos) then
408 Thurallor-7095
        table.remove(self.settings.deletedGroupIDs, foundPos);
409 16 Thurallor-7095
        self.globals.groups[groupID].deleted = nil;
410 2 Thurallor-7095
        self.manager.objects[groupID] = Group(self, groupID, self.globals.groups[groupID]);
411 Thurallor-7095
        table.insert(self.settings.groupIDs, groupID);
412 Thurallor-7095
        self:SaveSettings(true);
413 Thurallor-7095
    end
414 Thurallor-7095
end
415 Thurallor-7095
 
416 Thurallor-7095
function Group:CreateBar()
417 Thurallor-7095
    local barID = self:FindNewObjectID();
418 Thurallor-7095
    self.globals.bars[barID] = {};
419 Thurallor-7095
    table.insert(self.settings.barIDs, barID);
420 13 Thurallor-7095
    local bar = Bar(self, barID, self.globals.bars[barID]);
421 Thurallor-7095
    self.manager.objects[barID] = bar;
422 Thurallor-7095
    bar:SnapToGrid();
423 2 Thurallor-7095
    self:SaveSettings(true);
424 17 Thurallor-7095
    return bar;
425 2 Thurallor-7095
end
426 Thurallor-7095
 
427 Thurallor-7095
function Group:CreateGroup()
428 Thurallor-7095
    local groupID = self:FindNewObjectID();
429 Thurallor-7095
    self.globals.groups[groupID] = { };
430 Thurallor-7095
    table.insert(self.settings.groupIDs, groupID);
431 Thurallor-7095
    self.manager.objects[groupID] = Group(self, groupID, self.globals.groups[groupID]);
432 Thurallor-7095
    self:SaveSettings(true);
433 17 Thurallor-7095
    return group;
434 2 Thurallor-7095
end
435 Thurallor-7095
 
436 Thurallor-7095
function Group:FindNewObjectID()
437 Thurallor-7095
    return self.manager:FindNewObjectID();
438 Thurallor-7095
end
439 Thurallor-7095
 
440 Thurallor-7095
function Group:Destroy()
441 20 Thurallor-7095
    for bar in self:bar_objects() do
442 Thurallor-7095
        bar:Destroy();
443 2 Thurallor-7095
    end
444 20 Thurallor-7095
    for group in self:group_objects() do
445 Thurallor-7095
        group:Destroy();
446 2 Thurallor-7095
    end
447 Thurallor-7095
    if (self.importWindow) then
448 Thurallor-7095
        self.importWindow:Close();
449 Thurallor-7095
    end
450 8 Thurallor-7095
    Node.Destroy(self);
451 2 Thurallor-7095
end
452 Thurallor-7095
 
453 Thurallor-7095
function Group:HaveTrash()
454 Thurallor-7095
    if (#self.settings.deletedBarIDs + #self.settings.deletedGroupIDs > 0) then
455 Thurallor-7095
        return true;
456 Thurallor-7095
    end
457 20 Thurallor-7095
    for group in self:group_objects() do
458 Thurallor-7095
        if (group:HaveTrash()) then
459 2 Thurallor-7095
            return true;
460 Thurallor-7095
        end
461 20 Thurallor-7095
    end
462 2 Thurallor-7095
    return false;
463 Thurallor-7095
end
464 Thurallor-7095
 
465 Thurallor-7095
function Group:OpenImportWindow()
466 Thurallor-7095
    -- Create the import window
467 Thurallor-7095
    local title = L:GetText("/ImportWindow/Title");
468 Thurallor-7095
    title = string.gsub(title, "<group>", self.settings.caption.text);
469 Thurallor-7095
    self.importWindow = ImportWindow(title, self);
470 Thurallor-7095
    self.importWindow.Closing = function()
471 Thurallor-7095
        self.importWindow = nil;
472 Thurallor-7095
    end
473 Thurallor-7095
end
474 Thurallor-7095
 
475 Thurallor-7095
function Group:Import(importData)
476 Thurallor-7095
    self.importData = importData;
477 Thurallor-7095
 
478 Thurallor-7095
    -- Uncompress the data in the next Update cycle.
479 Thurallor-7095
    self:SetWantsUpdates(true);
480 Thurallor-7095
    self.updateCount = 0;
481 Thurallor-7095
    self.oldUpdateFunction = self.Update;
482 Thurallor-7095
    self.Update = function(g)
483 Thurallor-7095
        g.updateCount = g.updateCount + 1;
484 Thurallor-7095
        if (g.updateCount == 1) then
485 Thurallor-7095
            if (not string.find(g.importData, "{")) then
486 Thurallor-7095
                Puts(L:GetText("/ImportWindow/Decoding"));
487 Thurallor-7095
                g.encodedData = g.importData;
488 Thurallor-7095
            else
489 Thurallor-7095
                g.decodedData = g.importData;
490 Thurallor-7095
            end
491 Thurallor-7095
            g.importData = nil;
492 Thurallor-7095
        elseif (g.updateCount == 3) then
493 Thurallor-7095
            if (g.encodedData) then
494 Thurallor-7095
                -- Remove whitespace and newlines
495 Thurallor-7095
                g.encodedData = string.gsub(g.encodedData, "[%c%s]", "");
496 Thurallor-7095
                local success, decodedData = pcall(Text2Bin, g.encodedData);
497 Thurallor-7095
                if (not success) then
498 6 Thurallor-7095
                    Puts(L:GetText("/ImportWindow/InvalidEncoding"));
499 2 Thurallor-7095
                    g.encodedData = nil;
500 Thurallor-7095
                    g.updateCount = 10;
501 Thurallor-7095
                    return;
502 Thurallor-7095
                end
503 Thurallor-7095
                g.encodedData = nil;
504 Thurallor-7095
                g.decodedData = decodedData;
505 Thurallor-7095
            end
506 Thurallor-7095
        elseif (g.updateCount == 4) then
507 Thurallor-7095
            Puts(L:GetText("/ImportWindow/Decompressing"));
508 Thurallor-7095
            g.compressor = Thurallor.Utils.LibCompress();
509 Thurallor-7095
        elseif (g.updateCount == 6) then
510 Thurallor-7095
            if (g.decodedData) then
511 Thurallor-7095
                local success, uncompressedData = pcall(g.compressor.Decompress, g.compressor, g.decodedData);
512 Thurallor-7095
                if ((not success) or (not uncompressedData)) then
513 Thurallor-7095
                    -- Data was either not compressed or invalid.  Let's assume the former for now.
514 Thurallor-7095
                    uncompressedData = g.decodedData;
515 Thurallor-7095
                end
516 Thurallor-7095
                g.decodedData = nil;
517 Thurallor-7095
                g.uncompressedData = uncompressedData;
518 Thurallor-7095
            end
519 Thurallor-7095
        elseif (g.updateCount == 7) then
520 Thurallor-7095
            local f, e = loadstring("return " .. g.uncompressedData);
521 Thurallor-7095
            if (not f) then
522 6 Thurallor-7095
                Puts(L:GetText("/ImportWindow/ParseError") .. tostring(e));
523 2 Thurallor-7095
            else
524 Thurallor-7095
                g.newObjects = f();
525 6 Thurallor-7095
                if (type(g.newObjects) == "table") then
526 Thurallor-7095
                    Puts(L:GetText("/ImportWindow/Importing"));
527 Thurallor-7095
                    g:AddImportedObjects();
528 Thurallor-7095
                else
529 Thurallor-7095
                    Puts(L:GetText("/ImportWindow/NothingToDo"));
530 Thurallor-7095
                end
531 2 Thurallor-7095
            end
532 Thurallor-7095
            g.compressor = nil;
533 Thurallor-7095
            g.uncompressedData = nil;
534 Thurallor-7095
            g.newObjects = nil;
535 Thurallor-7095
        elseif (g.updateCount == 10) then
536 Thurallor-7095
            g:SetWantsUpdates(false);
537 Thurallor-7095
            g.Update = g.oldUpdateFunction; -- if this is a Manager object, it needs to have its Update function restored
538 Thurallor-7095
            g:SaveSettings(true);
539 Thurallor-7095
        end
540 Thurallor-7095
    end
541 Thurallor-7095
end
542 Thurallor-7095
 
543 Thurallor-7095
function Group:AddImportedObjects()
544 Thurallor-7095
 
545 Thurallor-7095
    -- Assign new object IDs to the new bars and groups.
546 Thurallor-7095
    -- Find out which one(s) are at the top level.
547 Thurallor-7095
    local newObjectIDs, hasParent = {}, {};
548 Thurallor-7095
    for oldObjectID, settings in pairs(self.newObjects) do
549 Thurallor-7095
        if (not newObjectIDs[oldObjectID]) then
550 Thurallor-7095
            newObjectIDs[oldObjectID] = self:FindNewObjectID();
551 Thurallor-7095
--Puts("     " .. oldObjectID .. " -> " .. newObjectIDs[oldObjectID]);
552 Thurallor-7095
        end
553 Thurallor-7095
        if (settings.type == "group") then
554 Thurallor-7095
            local title = L:GetText("/GroupMenu/UndeleteMenu/GroupName");
555 Thurallor-7095
            title = string.gsub(title, "<name>", settings.caption.text);
556 6 Thurallor-7095
            Puts(" + " .. title);
557 2 Thurallor-7095
            for b = 1, #settings.barIDs do
558 Thurallor-7095
                local oldBarID = settings.barIDs[b];
559 Thurallor-7095
                if (not newObjectIDs[oldBarID]) then
560 Thurallor-7095
                    newObjectIDs[oldBarID] = self:FindNewObjectID();
561 Thurallor-7095
--Puts("     " .. oldObjectID .. " -> " .. newObjectIDs[oldObjectID]);
562 Thurallor-7095
                end
563 Thurallor-7095
                local barID = newObjectIDs[oldBarID];
564 Thurallor-7095
                settings.barIDs[b] = barID;
565 Thurallor-7095
                hasParent[barID] = true;
566 Thurallor-7095
            end
567 Thurallor-7095
            for g = 1, #settings.groupIDs do
568 Thurallor-7095
                local oldGroupID = settings.groupIDs[g];
569 Thurallor-7095
                if (not newObjectIDs[oldGroupID]) then
570 Thurallor-7095
                    newObjectIDs[oldGroupID] = self:FindNewObjectID();
571 Thurallor-7095
--Puts("     " .. oldObjectID .. " -> " .. newObjectIDs[oldObjectID]);
572 Thurallor-7095
                end
573 Thurallor-7095
                local groupID = newObjectIDs[oldGroupID];
574 Thurallor-7095
                settings.groupIDs[g] = groupID;
575 Thurallor-7095
                hasParent[groupID] = true;
576 Thurallor-7095
            end
577 Thurallor-7095
        else
578 Thurallor-7095
            local title = L:GetText("/GroupMenu/UndeleteMenu/BarName");
579 Thurallor-7095
            title = string.gsub(title, "<name>", settings.caption.text);
580 6 Thurallor-7095
            Puts(" + " .. title);
581 2 Thurallor-7095
        end
582 Thurallor-7095
    end
583 Thurallor-7095
 
584 16 Thurallor-7095
    -- Update all "include" slots with new object IDs
585 Thurallor-7095
    for oldObjectID, settings in pairs(self.newObjects) do
586 Thurallor-7095
        if (settings.sequenceItemInfo) then
587 Thurallor-7095
            for i = 1, #settings.sequenceItemInfo, 1 do
588 Thurallor-7095
                local item = settings.sequenceItemInfo[i];
589 Thurallor-7095
                if (item.include and newObjectIDs[item.include]) then
590 Thurallor-7095
                    item.include = newObjectIDs[item.include];
591 Thurallor-7095
                end
592 Thurallor-7095
            end
593 Thurallor-7095
        end
594 Thurallor-7095
    end
595 Thurallor-7095
 
596 2 Thurallor-7095
    -- Add new group/bar settings to the database.
597 Thurallor-7095
    for oldObjectID, settings in pairs(self.newObjects) do
598 Thurallor-7095
        if (settings.type == "group") then
599 Thurallor-7095
            local groupID = newObjectIDs[oldObjectID];
600 Thurallor-7095
            self.globals.groups[groupID] = settings;
601 Thurallor-7095
        else
602 Thurallor-7095
            local barID = newObjectIDs[oldObjectID];
603 Thurallor-7095
            self.globals.bars[barID] = settings;
604 Thurallor-7095
        end
605 Thurallor-7095
    end
606 Thurallor-7095
 
607 Thurallor-7095
    -- For the top-level bars/groups, add them to the current group.
608 Thurallor-7095
    for oldObjectID, settings in pairs(self.newObjects) do
609 Thurallor-7095
        if (settings.type == "group") then
610 Thurallor-7095
            local groupID = newObjectIDs[oldObjectID];
611 Thurallor-7095
            if (not hasParent[groupID]) then
612 Thurallor-7095
                table.insert(self.settings.groupIDs, groupID);
613 Thurallor-7095
                self.manager.objects[groupID] = Group(self, groupID, settings);
614 Thurallor-7095
            end
615 Thurallor-7095
        else
616 Thurallor-7095
            local barID = newObjectIDs[oldObjectID];
617 Thurallor-7095
            if (not hasParent[barID]) then
618 Thurallor-7095
                table.insert(self.settings.barIDs, barID);
619 Thurallor-7095
                self.manager.objects[barID] = Bar(self, barID, settings);
620 Thurallor-7095
            end
621 Thurallor-7095
        end
622 Thurallor-7095
    end
623 Thurallor-7095
end
624 Thurallor-7095
 
625 201 Thurallor-7095
function Group:AddSettingsMenuItem(parent, itemName, amSubMenuOf, fromOptionsPanel)
626 200 Thurallor-7095
    self.amSubMenuOf = amSubMenuOf or self.amSubMenuOf;
627 2 Thurallor-7095
    local item = Turbine.UI.MenuItem(L:GetText(itemName), true, false);
628 200 Thurallor-7095
    item._name = itemName;
629 Thurallor-7095
    item._parent = parent;
630 Thurallor-7095
    parent._itemsByName = parent._itemsByName or {};
631 Thurallor-7095
    parent._itemsByName[itemName] = item;
632 2 Thurallor-7095
    parent:GetItems():Add(item);
633 Thurallor-7095
 
634 Thurallor-7095
    if (itemName == "Root") then
635 Thurallor-7095
        local prevContext = L:SetContext("/GroupMenu");
636 Thurallor-7095
        parent:GetItems():Clear();
637 Thurallor-7095
        self:AddSettingsMenuItem(parent, "Hide");
638 26 Thurallor-7095
        if (not self:IsExpanded()) then
639 Thurallor-7095
            self:AddSettingsMenuItem(parent, "Expand");
640 Thurallor-7095
        end
641 Thurallor-7095
        if (not self:IsCollapsed()) then
642 Thurallor-7095
            self:AddSettingsMenuItem(parent, "Collapse");
643 Thurallor-7095
        end
644 2 Thurallor-7095
        self:AddSettingsMenuItem(parent, "CloneGroup");
645 Thurallor-7095
        self:AddSettingsMenuItem(parent, "DeleteGroup");
646 Thurallor-7095
        self:AddSettingsMenuItem(parent, "ExportGroup");
647 Thurallor-7095
        if (not self.importWindow) then
648 Thurallor-7095
            self:AddSettingsMenuItem(parent, "Import");
649 Thurallor-7095
        end
650 Thurallor-7095
        self:AddSettingsMenuItem(parent, "CreateNewBar");
651 Thurallor-7095
        self:AddSettingsMenuItem(parent, "CreateNewSubgroup");
652 Thurallor-7095
        if (#self.settings.deletedBarIDs + #self.settings.deletedGroupIDs > 0) then
653 Thurallor-7095
            self:AddSettingsMenuItem(parent, "Undelete");
654 Thurallor-7095
        end
655 Thurallor-7095
        self:AddSettingsMenuItem(parent, "ArrangeBars");
656 12 Thurallor-7095
        self:AddSettingsMenuItem(parent, "GroupEventBehaviors");
657 2 Thurallor-7095
        self:AddSettingsMenuItem(parent, "GroupSettings");
658 121 Thurallor-7095
        self:AddSettingsMenuItem(parent, "Debug");
659 2 Thurallor-7095
        L:SetContext(prevContext);
660 121 Thurallor-7095
    elseif (itemName == "Debug") then
661 Thurallor-7095
        item:SetText(item:GetText() .. "...");
662 Thurallor-7095
        item.Click = function()
663 Thurallor-7095
            self:OpenDebugWindow();
664 Thurallor-7095
        end
665 2 Thurallor-7095
    elseif (itemName == "ExportGroup") then
666 121 Thurallor-7095
        item.Click = function()
667 2 Thurallor-7095
            self:Export();
668 Thurallor-7095
        end
669 Thurallor-7095
    elseif (itemName == "Import") then
670 121 Thurallor-7095
        item.Click = function()
671 2 Thurallor-7095
            self:OpenImportWindow();
672 Thurallor-7095
        end
673 Thurallor-7095
    elseif (itemName == "Hide") then
674 Thurallor-7095
        item:SetChecked(self.settings.hidden);
675 121 Thurallor-7095
        item.Click = function()
676 2 Thurallor-7095
            self:SetHidden(not self.settings.hidden);
677 Thurallor-7095
        end
678 Thurallor-7095
    elseif (itemName == "GroupSettings") then
679 Thurallor-7095
        local prevContext = L:SetContext("/GroupMenu/GroupSettingsMenu");
680 Thurallor-7095
        self:AddSettingsMenuItem(item, "Rename");
681 Thurallor-7095
        self:AddSettingsMenuItem(item, "BarsMoveTogether");
682 Thurallor-7095
        L:SetContext(prevContext);
683 Thurallor-7095
    elseif (itemName == "Undelete") then
684 Thurallor-7095
        local prevContext = L:SetContext("/GroupMenu/UndeleteMenu");
685 Thurallor-7095
        for b = 1, #self.settings.deletedBarIDs, 1 do
686 Thurallor-7095
            local barID = self.settings.deletedBarIDs[b];
687 Thurallor-7095
            local barItemName = L:GetText("BarName");
688 5 Thurallor-7095
            if (self.globals.bars[barID]) then
689 Thurallor-7095
                local barCaption = self.globals.bars[barID].caption.text;
690 Thurallor-7095
                barItemName = string.gsub(barItemName, "<name>", barCaption);
691 Thurallor-7095
                local barItem = Turbine.UI.MenuItem(barItemName, true, false);
692 Thurallor-7095
                item:GetItems():Add(barItem);
693 121 Thurallor-7095
                barItem.Click = function()
694 5 Thurallor-7095
                    self:UndeleteBar(barID);
695 Thurallor-7095
                end
696 2 Thurallor-7095
            end
697 Thurallor-7095
        end
698 Thurallor-7095
        for g = 1, #self.settings.deletedGroupIDs, 1 do
699 Thurallor-7095
            local groupID = self.settings.deletedGroupIDs[g];
700 Thurallor-7095
            local groupItemName = L:GetText("GroupName");
701 5 Thurallor-7095
            if (self.globals.groups[groupID]) then
702 Thurallor-7095
                local groupName = self.globals.groups[groupID].caption.text;
703 Thurallor-7095
                groupItemName = string.gsub(groupItemName, "<name>", groupName);
704 Thurallor-7095
                local groupItem = Turbine.UI.MenuItem(groupItemName, true, false);
705 Thurallor-7095
                item:GetItems():Add(groupItem);
706 121 Thurallor-7095
                groupItem.Click = function()
707 5 Thurallor-7095
                    self:UndeleteGroup(groupID);
708 Thurallor-7095
                end
709 2 Thurallor-7095
            end
710 Thurallor-7095
        end
711 Thurallor-7095
        L:SetContext(prevContext);
712 Thurallor-7095
    elseif (itemName == "Rename") then
713 Thurallor-7095
        item:SetEnabled(not self.captionEditor);
714 121 Thurallor-7095
        item.Click = function()
715 2 Thurallor-7095
            self:EditCaption();
716 Thurallor-7095
        end
717 Thurallor-7095
    elseif (itemName == "BarsMoveTogether") then
718 201 Thurallor-7095
        local topGroup = self:GetTopTogetherGroup();
719 Thurallor-7095
        if (topGroup and (topGroup ~= self)) then
720 Thurallor-7095
            item:SetChecked(true);
721 Thurallor-7095
            local text = L:GetText("/GroupMenu/GroupSettingsMenu/BarsMoveTogetherInherited");
722 Thurallor-7095
            item:SetText(text:gsub("<name>", topGroup:GetName()));
723 Thurallor-7095
            item:SetEnabled(false);
724 Thurallor-7095
        else
725 Thurallor-7095
            item:SetChecked(self.settings.barsMoveTogether);
726 Thurallor-7095
        end
727 121 Thurallor-7095
        item.Click = function()
728 2 Thurallor-7095
            self.settings.barsMoveTogether = not self.settings.barsMoveTogether;
729 Thurallor-7095
        end
730 Thurallor-7095
    elseif (itemName == "ArrangeBars") then
731 Thurallor-7095
        local prevContext = L:SetContext("/GroupMenu/ArrangeBarsMenu");
732 Thurallor-7095
        local descendentBarIDs = self:FindAllDescendentIDs(nil, true, nil);
733 Thurallor-7095
        if (#descendentBarIDs < 2) then
734 Thurallor-7095
            item:SetEnabled(false);
735 Thurallor-7095
        else
736 Thurallor-7095
            self:AddSettingsMenuItem(item, "AlignVertically");
737 Thurallor-7095
            self:AddSettingsMenuItem(item, "AlignHorizontally");
738 Thurallor-7095
        end
739 Thurallor-7095
        L:SetContext(prevContext);
740 12 Thurallor-7095
    elseif ((itemName == "GroupEventBehaviors") or (itemName == "GlobalEventBehaviors")) then
741 8 Thurallor-7095
        local prevContext = L:SetContext("/EventBehaviorsMenu");
742 2 Thurallor-7095
        if (self.settings.eventsEnabled) then
743 200 Thurallor-7095
            self:AddSettingsMenuItem(item, "AddBehavior");
744 2 Thurallor-7095
            if (#self.settings.eventHandlers > 0) then
745 Thurallor-7095
                self:AddSettingsMenuItem(item, "CurrentBehaviors");
746 Thurallor-7095
            end
747 Thurallor-7095
            self:AddSettingsMenuItem(item, "DisableEvents");
748 Thurallor-7095
        else
749 Thurallor-7095
            self:AddSettingsMenuItem(item, "EnableEvents");
750 Thurallor-7095
        end
751 Thurallor-7095
        L:SetContext(prevContext);
752 Thurallor-7095
    elseif (itemName == "EnableEvents") then
753 200 Thurallor-7095
        item.Click = function(ctl)
754 177 Thurallor-7095
            self:SetEventHandlersEnabled(true);
755 200 Thurallor-7095
            self:RedisplayMenu(ctl._parent);
756 2 Thurallor-7095
        end
757 Thurallor-7095
    elseif (itemName == "DisableEvents") then
758 200 Thurallor-7095
        item.Click = function(ctl)
759 177 Thurallor-7095
            self:SetEventHandlersEnabled(false);
760 200 Thurallor-7095
            self:RedisplayMenu(ctl._parent);
761 2 Thurallor-7095
        end
762 Thurallor-7095
    elseif (itemName == "CurrentBehaviors") then
763 Thurallor-7095
        if (self.settings.eventHandlers) then
764 Thurallor-7095
            for h = 1, #self.settings.eventHandlers do
765 Thurallor-7095
                local handler = self.settings.eventHandlers[h];
766 Thurallor-7095
                local handlerItem = Turbine.UI.MenuItem(handler.description, true, false);
767 200 Thurallor-7095
                handlerItem._parent = item;
768 2 Thurallor-7095
                item:GetItems():Add(handlerItem);
769 Thurallor-7095
                local removeItem = Turbine.UI.MenuItem(L:GetText("Remove"), true, false);
770 200 Thurallor-7095
                removeItem._parent = handlerItem;
771 2 Thurallor-7095
                handlerItem:GetItems():Add(removeItem);
772 200 Thurallor-7095
                removeItem.Click = function(ctl)
773 2 Thurallor-7095
                    self:RemoveEventHandler(h);
774 200 Thurallor-7095
                    self:RedisplayMenu(ctl._parent._parent);
775 2 Thurallor-7095
                end
776 Thurallor-7095
            end
777 Thurallor-7095
        end
778 Thurallor-7095
    elseif (itemName == "AddBehavior") then
779 20 Thurallor-7095
        local prevContext = L:SetContext("/EventBehaviorsMenu/Actions");
780 2 Thurallor-7095
        self:AddSettingsMenuItem(item, "ShowGroup");
781 Thurallor-7095
        self:AddSettingsMenuItem(item, "HideGroup");
782 Thurallor-7095
        self:AddSettingsMenuItem(item, "ResetGroup");
783 26 Thurallor-7095
        self:AddSettingsMenuItem(item, "ExpandGroup");
784 Thurallor-7095
        self:AddSettingsMenuItem(item, "CollapseGroup");
785 128 Thurallor-7095
        self:AddSettingsMenuItem(item, "SetGroupTransparency");
786 43 Thurallor-7095
        self:AddSettingsMenuItem(item, "StartExecuting");
787 Thurallor-7095
        self:AddSettingsMenuItem(item, "StopExecuting");
788 20 Thurallor-7095
        L:SetContext(prevContext);
789 128 Thurallor-7095
    elseif (itemName == "SetGroupTransparency") then
790 Thurallor-7095
        local prevContext = L:SetContext("/BarMenu/SettingsMenu/TransparencyMenu");
791 Thurallor-7095
        local subItem = self:AddSettingsMenuItem(item, "SetGroupTransparency:");
792 200 Thurallor-7095
        subItem._name = "SetGroupTransparency";
793 128 Thurallor-7095
        subItem:SetText(L:GetText("UseGlobalSetting"));
794 Thurallor-7095
        subItem.argName = L:GetText("default");
795 Thurallor-7095
        subItem.argValue = "nil";
796 Thurallor-7095
        for i = 0, 10 do
797 Thurallor-7095
            subItem = self:AddSettingsMenuItem(item, "SetGroupTransparency:");
798 200 Thurallor-7095
            subItem._name = "SetGroupTransparency";
799 128 Thurallor-7095
            subItem.argName = L:GetText("PartiallyTransparent"):gsub("<pct>", i * 10);
800 Thurallor-7095
            if (i == 0) then
801 Thurallor-7095
                subItem:SetText(L:GetText("FullyTransparent"));
802 Thurallor-7095
                subItem.argValue = "0";
803 Thurallor-7095
            elseif (i == 10) then
804 Thurallor-7095
                subItem:SetText(L:GetText("FullyOpaque"));
805 Thurallor-7095
                subItem.argValue = "1";
806 Thurallor-7095
            else
807 Thurallor-7095
                subItem:SetText(subItem.argName);
808 Thurallor-7095
                subItem.argValue = "0." .. i;
809 Thurallor-7095
            end
810 Thurallor-7095
        end
811 Thurallor-7095
        L:SetContext(prevContext);
812 Thurallor-7095
 
813 Thurallor-7095
    elseif (string.find("|SetGroupTransparency:|ShowGroup|HideGroup|ResetGroup|ExpandGroup|CollapseGroup|StartExecuting|StopExecuting|", "|" .. itemName .. "|")) then
814 20 Thurallor-7095
        local prevContext = L:SetContext("/EventBehaviorsMenu/Triggers");
815 43 Thurallor-7095
        if ((itemName ~= "ResetGroup") and (itemName ~= "StopExecuting")) then
816 34 Thurallor-7095
            self:AddSettingsMenuItem(item, "AtStartup");
817 Thurallor-7095
        end
818 2 Thurallor-7095
        self:AddSettingsMenuItem(item, "WhenCombatBegins");
819 Thurallor-7095
        self:AddSettingsMenuItem(item, "WhenCombatEnds");
820 46 Thurallor-7095
        self:AddSettingsMenuItem(item, "WhenTargetChanges");
821 128 Thurallor-7095
        if (string.find("|SetGroupTransparency:|ResetGroup|ExpandGroup|StartExecuting|", "|" .. itemName .. "|")) then
822 42 Thurallor-7095
            self:AddSettingsMenuItem(item, "WhenMouseArrives");
823 Thurallor-7095
        end
824 128 Thurallor-7095
        if (string.find("|SetGroupTransparency:|HideGroup|ResetGroup|CollapseGroup|StopExecuting|", "|" .. itemName .. "|")) then
825 42 Thurallor-7095
            self:AddSettingsMenuItem(item, "WhenMouseDeparts");
826 Thurallor-7095
        end
827 128 Thurallor-7095
        if (string.find("|SetGroupTransparency:|ShowGroup|ResetGroup|StartExecuting|StopExecuting|", "|" .. itemName .. "|")) then
828 35 Thurallor-7095
            self:AddSettingsMenuItem(item, "WhenTraitTreeChanges");
829 111 Thurallor-7095
            self:AddSettingsMenuItem(item, "WhenStanceChanges");
830 35 Thurallor-7095
        end
831 200 Thurallor-7095
        self:AddSettingsMenuItem(item, "WhenPetChanges");
832 Thurallor-7095
        self:AddSettingsMenuItem(item, "WhenMountChanges");
833 165 Thurallor-7095
        self:AddSettingsMenuItem(item, "WhenYouAreIncapacitated");
834 Thurallor-7095
        self:AddSettingsMenuItem(item, "WhenYouAreRevived");
835 2 Thurallor-7095
        self.availableEvents = self.manager:GetEventNames();
836 33 Thurallor-7095
        self:AddSettingsMenuItem(item, "WhenEventOccurs");
837 20 Thurallor-7095
        L:SetContext(prevContext);
838 2 Thurallor-7095
    elseif (itemName == "WhenEventOccurs") then
839 33 Thurallor-7095
        if (#self.availableEvents > 0) then
840 Thurallor-7095
            for e = 1, #self.availableEvents do
841 Thurallor-7095
                local eventName = self.availableEvents[e];
842 Thurallor-7095
                local eventNameItem = Turbine.UI.MenuItem(eventName, true, false);
843 200 Thurallor-7095
                eventNameItem._parent = item;
844 33 Thurallor-7095
                item:GetItems():Add(eventNameItem);
845 200 Thurallor-7095
                eventNameItem.Click = function(ctl)
846 Thurallor-7095
                    self:AddEventHandler("WhenEventOccurs:" .. eventName, parent._name, parent.argValue, parent.argName);
847 Thurallor-7095
                    self:RedisplayMenu(ctl._parent._parent._parent._parent, "CurrentBehaviors");
848 33 Thurallor-7095
                end
849 2 Thurallor-7095
            end
850 33 Thurallor-7095
        else
851 Thurallor-7095
            local noEventsItem = Turbine.UI.MenuItem(L:GetText("/EventBehaviorsMenu/NoEventsDefined"), false, false);
852 Thurallor-7095
            item:GetItems():Add(noEventsItem);
853 2 Thurallor-7095
        end
854 199 Thurallor-7095
        local eventDirectoryItem = Turbine.UI.MenuItem("( . . . )", true, false);
855 Thurallor-7095
        eventDirectoryItem.Click = function()
856 Thurallor-7095
            self.manager:ShowDirectory("events");
857 Thurallor-7095
        end
858 Thurallor-7095
        item:GetItems():Add(eventDirectoryItem);
859 200 Thurallor-7095
    elseif (string.find("|AtStartup|WhenTargetChanges|WhenCombatBegins|WhenCombatEnds|WhenMouseArrives|WhenMouseDeparts|WhenTraitTreeChanges|WhenStanceChanges|WhenPetChanges|WhenMountChanges|WhenYouAreIncapacitated|WhenYouAreRevived|", "|" .. itemName .. "|")) then
860 Thurallor-7095
        item.Click = function(ctl)
861 Thurallor-7095
            self:AddEventHandler(itemName, parent._name, parent.argValue, parent.argName);
862 Thurallor-7095
            self:RedisplayMenu(ctl._parent._parent._parent, "CurrentBehaviors");
863 2 Thurallor-7095
        end
864 Thurallor-7095
    elseif (itemName == "AlignVertically") then
865 Thurallor-7095
        local prevContext = L:SetContext("/GroupMenu/ArrangeBarsMenu/AlignVerticallyMenu");
866 Thurallor-7095
        self:AddSettingsMenuItem(item, "Tops");
867 Thurallor-7095
        self:AddSettingsMenuItem(item, "Middles");
868 Thurallor-7095
        self:AddSettingsMenuItem(item, "Bottoms");
869 Thurallor-7095
        L:SetContext(prevContext);
870 Thurallor-7095
    elseif (itemName == "AlignHorizontally") then
871 Thurallor-7095
        local prevContext = L:SetContext("/GroupMenu/ArrangeBarsMenu/AlignHorizontallyMenu");
872 Thurallor-7095
        self:AddSettingsMenuItem(item, "LeftSides");
873 Thurallor-7095
        self:AddSettingsMenuItem(item, "Centers");
874 Thurallor-7095
        self:AddSettingsMenuItem(item, "RightSides");
875 Thurallor-7095
        L:SetContext(prevContext);
876 11 Thurallor-7095
    elseif (string.find("|Tops|Middles|Bottoms|LeftSides|Centers|RightSides|", "|" .. itemName .. "|")) then
877 2 Thurallor-7095
        local checked = self:BarsAreAligned(itemName);
878 Thurallor-7095
        item:SetChecked(checked);
879 Thurallor-7095
        item:SetEnabled(not checked);
880 121 Thurallor-7095
        item.Click = function()
881 2 Thurallor-7095
            self:AlignBars(itemName);
882 Thurallor-7095
        end
883 26 Thurallor-7095
    elseif (itemName == "Expand") then
884 121 Thurallor-7095
        item.Click = function()
885 26 Thurallor-7095
            self:Expand();
886 Thurallor-7095
        end
887 Thurallor-7095
    elseif (itemName == "Collapse") then
888 121 Thurallor-7095
        item.Click = function()
889 26 Thurallor-7095
            self:Collapse();
890 Thurallor-7095
        end
891 2 Thurallor-7095
    elseif (itemName == "CloneGroup") then
892 121 Thurallor-7095
        item.Click = function()
893 2 Thurallor-7095
            self.parent:CloneGroup(self.groupID);
894 Thurallor-7095
        end
895 Thurallor-7095
    elseif (itemName == "DeleteGroup") then
896 121 Thurallor-7095
        item.Click = function()
897 2 Thurallor-7095
            self.parent:DeleteGroup(self.groupID);
898 Thurallor-7095
        end
899 Thurallor-7095
    elseif (itemName == "Global") then
900 200 Thurallor-7095
        self.manager:AddSettingsMenuItem(item, "Root", self);
901 2 Thurallor-7095
    elseif (itemName == "CreateNewBar") then
902 121 Thurallor-7095
        item.Click = function()
903 2 Thurallor-7095
            self:CreateBar();
904 Thurallor-7095
        end
905 Thurallor-7095
    elseif (itemName == "CreateNewSubgroup") then
906 121 Thurallor-7095
        item.Click = function()
907 2 Thurallor-7095
            self:CreateGroup();
908 Thurallor-7095
        end
909 Thurallor-7095
    end
910 128 Thurallor-7095
    return item;
911 2 Thurallor-7095
end
912 Thurallor-7095
 
913 Thurallor-7095
function Group:Reset()
914 121 Thurallor-7095
    if (self.Log) then
915 Thurallor-7095
        DoCallbacks(self, "Log", {"reset", "GROUP"})
916 Thurallor-7095
    end
917 20 Thurallor-7095
    for bar in self:bar_objects() do
918 Thurallor-7095
        bar:Reset();
919 2 Thurallor-7095
    end
920 20 Thurallor-7095
    for group in self:group_objects() do
921 Thurallor-7095
        group:Reset();
922 Thurallor-7095
    end
923 2 Thurallor-7095
end
924 Thurallor-7095
 
925 Thurallor-7095
function Group:FindAllDescendentIDs(descendents, includeBars, includeGroups)
926 Thurallor-7095
    if (descendents == nil) then
927 Thurallor-7095
        descendents = {};
928 Thurallor-7095
    end
929 20 Thurallor-7095
    for group in self:group_objects() do
930 2 Thurallor-7095
        if (includeGroups) then
931 20 Thurallor-7095
            table.insert(descendents, group.objectID);
932 2 Thurallor-7095
        end
933 Thurallor-7095
        group:FindAllDescendentIDs(descendents, includeBars, includeGroups);
934 Thurallor-7095
    end
935 20 Thurallor-7095
    if (includeBars) then
936 Thurallor-7095
        for bar in self:bar_objects() do
937 Thurallor-7095
            table.insert(descendents, bar.objectID);
938 2 Thurallor-7095
        end
939 Thurallor-7095
    end
940 Thurallor-7095
    return descendents;
941 Thurallor-7095
end
942 Thurallor-7095
 
943 Thurallor-7095
function Group:GetBarLocationData(barIDs)
944 Thurallor-7095
    local lefts, tops, rights, bottoms, centers, middles = {}, {}, {}, {}, {}, {};
945 Thurallor-7095
    if (barIDs == nil) then
946 Thurallor-7095
        barIDs = self:FindAllDescendentIDs(nil, true, nil);
947 Thurallor-7095
    end
948 20 Thurallor-7095
    local numBars = 0;
949 Thurallor-7095
    for b = 1, #barIDs, 1 do
950 2 Thurallor-7095
        local barID = barIDs[b];
951 Thurallor-7095
        local bar = self.manager.objects[barID];
952 20 Thurallor-7095
        if (bar) then
953 Thurallor-7095
            numBars = numBars + 1;
954 Thurallor-7095
            local left, top, width, height = bar:GetVisibleLeft(), bar:GetVisibleTop(), bar:GetVisibleWidth(), bar:GetVisibleHeight();
955 Thurallor-7095
            table.insert(lefts, left);
956 Thurallor-7095
            table.insert(tops, top);
957 Thurallor-7095
            local right, bottom = left + width, top + height;
958 Thurallor-7095
            table.insert(rights, right);
959 Thurallor-7095
            table.insert(bottoms, bottom);
960 Thurallor-7095
            local center = (left + right) / 2;
961 Thurallor-7095
            local middle = (top + bottom) / 2;
962 Thurallor-7095
            table.insert(centers, center);
963 Thurallor-7095
            table.insert(middles, middle);
964 Thurallor-7095
        end
965 2 Thurallor-7095
    end
966 Thurallor-7095
    return numBars, lefts, tops, rights, bottoms, centers, middles;
967 Thurallor-7095
end
968 Thurallor-7095
 
969 Thurallor-7095
function Group:GetBarLocationStats(numBars, lefts, tops, rights, bottoms, centers, middles)
970 Thurallor-7095
    local minLeft, maxRight = math.min(unpack(lefts)), math.max(unpack(rights));
971 Thurallor-7095
    local minTop, maxBottom = math.min(unpack(tops)), math.max(unpack(bottoms));
972 Thurallor-7095
    local avgCenter, avgMiddle = 0, 0;
973 Thurallor-7095
    for b = 1, numBars, 1 do
974 Thurallor-7095
        avgCenter = avgCenter + centers[b];
975 Thurallor-7095
        avgMiddle = avgMiddle + middles[b];
976 Thurallor-7095
    end
977 Thurallor-7095
    avgCenter = avgCenter / numBars;
978 Thurallor-7095
    avgMiddle = avgMiddle / numBars;
979 Thurallor-7095
    local minCenter, maxCenter = math.min(unpack(centers)), math.max(unpack(centers));
980 Thurallor-7095
    local minMiddle, maxMiddle = math.min(unpack(middles)), math.max(unpack(middles));
981 Thurallor-7095
    return numBars, minLeft, maxRight, minTop, maxBottom, minCenter, avgCenter, maxCenter, minMiddle, avgMiddle, maxMiddle;
982 Thurallor-7095
end
983 Thurallor-7095
 
984 Thurallor-7095
function Group:BarsAreAligned(alignment)
985 Thurallor-7095
    local barIDs = self:FindAllDescendentIDs(nil, true, nil);
986 Thurallor-7095
    local numBars, lefts, tops, rights, bottoms, centers, middles = self:GetBarLocationData(barIDs);
987 Thurallor-7095
    local _, minLeft, maxRight, minTop, maxBottom, _, avgCenter, _, _, avgMiddle, _ = self:GetBarLocationStats(numBars, lefts, tops, rights, bottoms, centers, middles);
988 Thurallor-7095
    local aligned = true;
989 Thurallor-7095
    for b = 1, numBars, 1 do
990 Thurallor-7095
        if (alignment == "LeftSides") then
991 Thurallor-7095
            aligned = aligned and lefts[b] == minLeft;
992 Thurallor-7095
        elseif (alignment == "RightSides") then
993 Thurallor-7095
            aligned = aligned and rights[b] == maxRight;
994 Thurallor-7095
        elseif (alignment == "Tops") then
995 Thurallor-7095
            aligned = aligned and tops[b] == minTop;
996 Thurallor-7095
        elseif (alignment == "Bottoms") then
997 Thurallor-7095
            aligned = aligned and bottoms[b] == maxBottom;
998 Thurallor-7095
        elseif (alignment == "Centers") then
999 Thurallor-7095
            aligned = aligned and math.floor(centers[b]) == math.floor(avgCenter);
1000 Thurallor-7095
        elseif (alignment == "Middles") then
1001 Thurallor-7095
            aligned = aligned and math.floor(middles[b]) == math.floor(avgMiddle);
1002 Thurallor-7095
        end
1003 Thurallor-7095
    end
1004 Thurallor-7095
    return aligned;
1005 Thurallor-7095
end
1006 Thurallor-7095
 
1007 Thurallor-7095
function Group:AlignBars(alignment)
1008 Thurallor-7095
    local barIDs = self:FindAllDescendentIDs(nil, true, nil);
1009 Thurallor-7095
    local numBars, lefts, tops, rights, bottoms, centers, middles = self:GetBarLocationData(barIDs);
1010 Thurallor-7095
    local _, minLeft, maxRight, minTop, maxBottom, _, avgCenter, _, _, avgMiddle, _ = self:GetBarLocationStats(numBars, lefts, tops, rights, bottoms, centers, middles);
1011 20 Thurallor-7095
    for bar in self:bar_objects() do
1012 2 Thurallor-7095
        if (alignment == "LeftSides") then
1013 Thurallor-7095
            bar:SetVisibleLeft(minLeft);
1014 Thurallor-7095
        elseif (alignment == "RightSides") then
1015 Thurallor-7095
            bar:SetVisibleLeft(maxRight - bar:GetVisibleWidth());
1016 Thurallor-7095
        elseif (alignment == "Tops") then
1017 Thurallor-7095
            bar:SetVisibleTop(minTop);
1018 Thurallor-7095
        elseif (alignment == "Bottoms") then
1019 Thurallor-7095
            bar:SetVisibleTop(maxBottom - bar:GetVisibleHeight());
1020 Thurallor-7095
        elseif (alignment == "Centers") then
1021 Thurallor-7095
            bar:SetVisibleLeft(avgCenter - math.floor((bar:GetVisibleWidth() + 0.5) / 2));
1022 Thurallor-7095
        elseif (alignment == "Middles") then
1023 Thurallor-7095
            bar:SetVisibleTop(avgMiddle - math.floor((bar:GetVisibleHeight() + 0.5) / 2));
1024 Thurallor-7095
        end
1025 Thurallor-7095
        bar:Redraw();
1026 Thurallor-7095
    end
1027 Thurallor-7095
    self:SaveSettings(false);
1028 Thurallor-7095
end
1029 Thurallor-7095
 
1030 201 Thurallor-7095
-- Finds the topmost group containing (or being) this group which has the "bars move together" option enabled.
1031 Thurallor-7095
function Group:GetTopTogetherGroup()
1032 Thurallor-7095
    local group, topGroup = self;
1033 Thurallor-7095
    while (group) do
1034 Thurallor-7095
        if (group.settings.barsMoveTogether) then
1035 Thurallor-7095
            topGroup = group;
1036 Thurallor-7095
        end
1037 Thurallor-7095
        group = group.parent;
1038 17 Thurallor-7095
    end
1039 201 Thurallor-7095
    return topGroup;
1040 Thurallor-7095
end
1041 17 Thurallor-7095
 
1042 201 Thurallor-7095
function Group:SnapToGrid()
1043 Thurallor-7095
    -- Snap all children contained in this group and subgroups to grid
1044 20 Thurallor-7095
    for bar in self:bar_objects() do
1045 Thurallor-7095
        bar:SnapToGrid();
1046 2 Thurallor-7095
    end
1047 20 Thurallor-7095
    for group in self:group_objects() do
1048 201 Thurallor-7095
        group:SnapToGrid();
1049 2 Thurallor-7095
    end
1050 Thurallor-7095
end
1051 Thurallor-7095
 
1052 201 Thurallor-7095
function Group:OffsetPosition(deltaX, deltaY)
1053 Thurallor-7095
    -- Move all children contained in this group and subgroups, irrespective of locks
1054 20 Thurallor-7095
    for bar in self:bar_objects() do
1055 201 Thurallor-7095
        bar:OffsetPosition(deltaX, deltaY);
1056 2 Thurallor-7095
    end
1057 20 Thurallor-7095
    for group in self:group_objects() do
1058 201 Thurallor-7095
        group:OffsetPosition(deltaX, deltaY);
1059 2 Thurallor-7095
    end
1060 Thurallor-7095
end
1061 Thurallor-7095
 
1062 42 Thurallor-7095
function Group:MouseArrive(objectID)
1063 Thurallor-7095
    if (self.mouseInside) then
1064 Thurallor-7095
        -- Already inside; do nothing.
1065 Thurallor-7095
        return;
1066 Thurallor-7095
    end
1067 Thurallor-7095
    self.mouseInside = true;
1068 Thurallor-7095
    if (self.parent) then
1069 Thurallor-7095
        self.parent:MouseArrive(self.objectID);
1070 Thurallor-7095
    end
1071 Thurallor-7095
    DoCallbacks(self, "MouseArrived");
1072 Thurallor-7095
end
1073 Thurallor-7095
 
1074 Thurallor-7095
function Group:MouseInside(mouseLeft, mouseTop)
1075 Thurallor-7095
    if (self:IsHidden()) then
1076 Thurallor-7095
        return false;
1077 Thurallor-7095
    end
1078 Thurallor-7095
    for bar in self:bar_objects() do
1079 Thurallor-7095
        if (bar:MouseInside(mouseLeft, mouseTop)) then
1080 Thurallor-7095
            return true;
1081 Thurallor-7095
        end
1082 Thurallor-7095
    end
1083 Thurallor-7095
    for group in self:group_objects() do
1084 Thurallor-7095
        if (group:MouseInside(mouseLeft, mouseTop)) then
1085 Thurallor-7095
            return true;
1086 Thurallor-7095
        end
1087 Thurallor-7095
    end
1088 Thurallor-7095
    return false;
1089 Thurallor-7095
end
1090 Thurallor-7095
 
1091 Thurallor-7095
function Group:MouseDepart()
1092 Thurallor-7095
    if (self.parent) then
1093 Thurallor-7095
        self.parent:MouseDepart(self.objectID);
1094 Thurallor-7095
    end
1095 Thurallor-7095
 
1096 Thurallor-7095
    -- If a callback is registered, we need to make sure the mouse hasn't
1097 Thurallor-7095
    -- entered another bar in the group before generating the MouseDeparted event.
1098 Thurallor-7095
    if (self.MouseDeparted) then
1099 Thurallor-7095
        local mouseLeft, mouseTop = Turbine.UI.Display:GetMousePosition();
1100 Thurallor-7095
        if (not self:MouseInside(mouseLeft, mouseTop)) then
1101 Thurallor-7095
            self.mouseInside = false;
1102 Thurallor-7095
            DoCallbacks(self, "MouseDeparted");
1103 Thurallor-7095
        end
1104 Thurallor-7095
    else
1105 Thurallor-7095
        self.mouseInside = false;
1106 Thurallor-7095
    end
1107 Thurallor-7095
end
1108 Thurallor-7095
 
1109 121 Thurallor-7095
function Group:OpenDebugWindow()
1110 Thurallor-7095
    local title = L:GetText("/GroupMenu/Debug") .. ": " .. self.settings.caption.text;
1111 Thurallor-7095
    local debugWindow = Thurallor.UI.LogWindow(title, { self });
1112 Thurallor-7095
    debugWindow:SetBackColor(self.color);
1113 Thurallor-7095
    debugWindow:SetTrace("GROUP", "Group status changes", true);
1114 Thurallor-7095
    debugWindow:SetTrace("EVENT", "Event behaviours", true);
1115 Thurallor-7095
    debugWindow:SetVisible(true);
1116 Thurallor-7095
    debugWindow:AppendText("Debugging started");
1117 Thurallor-7095
end
1118 Thurallor-7095
 
1119 2 Thurallor-7095
function Group:EditCaption(optionsNode)
1120 Thurallor-7095
    if (self.captionEditor == nil) then
1121 Thurallor-7095
        if (optionsNode) then
1122 Thurallor-7095
            self.settings.caption.font = optionsNode:GetFont();
1123 Thurallor-7095
            self.settings.caption.width = optionsNode:GetWidth();
1124 Thurallor-7095
            self.settings.caption.height = optionsNode:GetHeight();
1125 Thurallor-7095
        end
1126 Thurallor-7095
        self.captionEditor = CaptionEditor("GroupName", self, self.settings.caption.width, self.settings.caption.height, self.settings.caption.text);
1127 Thurallor-7095
        self:FormatCaptionEditorTextBox();
1128 121 Thurallor-7095
        self.captionEditor.Closed = function()
1129 2 Thurallor-7095
            self.captionEditor = nil;
1130 Thurallor-7095
        end
1131 Thurallor-7095
    end
1132 Thurallor-7095
end
1133 Thurallor-7095
 
1134 Thurallor-7095
function Group:FormatCaptionEditorTextBox()
1135 Thurallor-7095
    if (self.captionEditor ~= nil) then
1136 Thurallor-7095
        local control = self.captionEditor:GetTextBox();
1137 Thurallor-7095
        control:SetFont(self.settings.caption.font);
1138 Thurallor-7095
        control:SetForeColor(self.color);
1139 Thurallor-7095
        control:SetFontStyle(Turbine.UI.FontStyle.Outline);
1140 Thurallor-7095
        control:SetOutlineColor(Turbine.UI.Color(0.75, 0, 0, 0));
1141 Thurallor-7095
        control:SetTextAlignment(Turbine.UI.ContentAlignment.MiddleLeft);
1142 Thurallor-7095
        control:SetWidth(self.settings.caption.width);
1143 Thurallor-7095
        control:SetHeight(self.settings.caption.height);
1144 Thurallor-7095
        self.captionEditor:Redraw();
1145 Thurallor-7095
    end
1146 Thurallor-7095
end
1147 Thurallor-7095
 
1148 Thurallor-7095
function Group:SetCaptionSize(width, height)
1149 10 Thurallor-7095
    Node.SetCaptionSize(self, width, height);
1150 2 Thurallor-7095
    self:FormatCaptionEditorTextBox();
1151 Thurallor-7095
end
1152 Thurallor-7095
 
1153 Thurallor-7095
function Group:SetColor(color)
1154 8 Thurallor-7095
    Node.SetColor(self, color);
1155 2 Thurallor-7095
    self:FormatCaptionEditorTextBox();
1156 Thurallor-7095
end

All times are GMT -5. The time now is 02:39 PM.


Our Network
EQInterface | EQ2Interface | Minion | WoWInterface | ESOUI | LoTROInterface | MMOUI | Swtorui