forked from supercollider-quarks/ddwMixerChannel
-
Notifications
You must be signed in to change notification settings - Fork 1
/
MixerScopeGui.sc
48 lines (40 loc) · 1.32 KB
/
MixerScopeGui.sc
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
MixerScopeGui : ObjectGui {
classvar defaultWidth = 500, defaultHeight = 100;
var <layout, <masterLayout, scopeView, <iMadeMasterLayout,
myModel;
guify { arg lay,bounds,title;
if(lay.isNil,{
masterLayout = lay = ResizeHeightFlowWindow
(title ?? { model.asString.copyRange(0,50) },
bounds ?? { Rect(0, 0, defaultWidth,
defaultHeight * model.channel.outChannels) });
iMadeMasterLayout = true; // now when I'm removed, I'll close the window too
},{
masterLayout = lay; // should only pass in the FixedWidthMultiPageLayout
lay = lay.asPageLayout(title,bounds);
});
// i am not really a view in the hierarchy
lay.removeOnClose(this);
^lay
}
guiBody { arg lay;
layout = lay;
scopeView = GUI.scopeView.new(lay, lay.bounds)
.bufnum_(model.buffer.bufnum);
myModel = model;
}
remove { arg dummy, freeModel = true; // when model frees programmatically, this is false
model.dependants.remove(this); // to avoid recursion with model.free below
// scopeView is nil if remove has been called before
if(scopeView.notNil) {
scopeView.notClosed.if({
scopeView.remove;
});
freeModel.if({ myModel.free; });
if(iMadeMasterLayout and: { masterLayout.isClosed.not }) {
masterLayout.prClose;
};
layout = masterLayout = scopeView = iMadeMasterLayout = myModel = nil;
};
}
}