-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSourceItemsManager.lua
67 lines (51 loc) · 1.69 KB
/
SourceItemsManager.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
local Set = require('common/Set');
local IQueue = require('InfoQueue');
local IManager = require('ItemsManager')
local SItem = require('common/SourceItem');
local IWidget = require('common/ItemWidget');
local FileInfoPanel = require('FileInfoPanel');
local DecoderInfoPanel = require('DecoderInfoPanel');
local SourceControlPanel = require('SourceControlPanel');
local sim = IManager:subclass("SourceItemsManager");
local function windowContent(item, manager)
IWidget.update(item);
FileInfoPanel(item.parent.file, "FileInfo");
if Slab.Button("Change id") then
manager:openModItemDialog(item)
end
Slab.Separator();
DecoderInfoPanel(item.parent.decoder, "DecoderInfo");
Slab.Separator();
SourceControlPanel.update(item);
end
function sim:initialize()
IManager.initialize(self, "filesources",
{ name = "source", names = "sources", title = "Source", titles = "Sources" },
SItem, windowContent, true);
self.container.itemAdded:connect(self.onNewItem, self);
self.playing = 0;
end
function sim:onNewItem(item)
item.played:connect(self.onPlayed, self);
item.paused:connect(self.onPaused, self);
item.changed:connect(self.StateChanged, self);
end
function sim:onPlayed()
self.playing = self.playing + 1;
self:StateChanged();
end
function sim:onPaused()
self.playing = self.playing - 1;
self:StateChanged();
end
function sim:updateMainMenu()
if Slab.BeginMenu(self.naming.titles) then
self:updateMainMenuContent();
if Slab.MenuItem("Pause all") then
love.audio.pause();
self.playing = 0;
end
Slab.EndMenu();
end
end
return sim;