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 68 69 70 71 72 73 74 75 76 77
|
/*
** lock proxymixer to fixed size.
** can move border between nameview and slider to show long proxy names
s.boot;
n = NdefMixer(s);
"bcdefghijk".do { |k| Ndef(k.asSymbol).ar };
"qwrtyu".do { |k| Ndef(k.asSymbol).kr };
n.enableNameResize;
n.getNameLeftBorder;
n.setNameLeftBorder(200);
n.shiftNameLeftBorder(10);
n.shiftNameLeftBorder(-10);
n.shiftArBorder(10);
n.shiftArBorder(-10);
*/
+ ProxyMixer {
enableNameResize { |flag = true|
var canDrag = false;
if (flag) {
arZone.mouseDownAction = { |arZone, x, y|
// if between slider and nameView, startDrag
var nameLeft = this.getNameLeftBorder;
canDrag = x.absdif(nameLeft) < 15;
};
arZone.mouseMoveAction = { |arZone, x, y|
if (canDrag) { this.setNameLeftBorder(x.postln) };
};
arZone.mouseUpAction = { canDrag = false };
} {
arZone.mouseDownAction = nil;
arZone.mouseMoveAction = nil;
arZone.mouseUpAction = nil;
}
}
makeWindow {
parent = Window(this.winName,
bounds.copy.resizeBy(10, 10),
resizable: false
).front;
parent.addFlowLayout;
hasWindow = true;
}
getNameLeftBorder {
^arGuis[0].nameView.bounds.left;
}
setNameLeftBorder { |xpos = 250|
arGuis.do { |ag|
var moniZone = ag.monitorGui.zone;
var nvbnds = ag.nameView.bounds;
var nvbndsRight = nvbnds.right;
moniZone.bounds_(moniZone.bounds.width_(xpos));
nvbnds = nvbnds.left_(xpos);
nvbnds = nvbnds.width_(nvbndsRight - xpos);
ag.nameView.bounds_(nvbnds);
}
}
shiftNameLeftBorder { |x = 0|
this.setNameLeftBorder(this.getNameLeftBorder + x);
}
}
|