/usr/share/SuperCollider/SCClassLibrary/QtCollider/QKnob.sc is in supercollider-common 1:3.6.3~repack-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | // blackrain at realizedsound dot net - 05/2006
// fix key modidiers bug by Stephan Wittwer 08/2006 - thanks!
// Knob updates only on value changes - 10/2006
// GUI.cocoa changes - 04/2007
//
// 03.10.2008 - new implementation:
// - Knob now is a subclass of SCViewHolder
// - Relative origin
//
// 01.20.2009 - SCKnob
// - a subclass of SCUserView again.
// - isSquare option
//
// 08.03.2010 - QKnob = SCKnob adjusted for GUI.qt scheme (by Jakob Leben)
QKnob : QAbstractStepValue {
classvar <>defaultMode = \round;
var <>keystep = 0.01;
*qtClass {^'QcKnob'}
*new { arg parent, bounds;
var me = super.new(parent,bounds);
me.mode = defaultMode;
^me;
}
value { ^this.getProperty(\value) }
value_ { arg val; this.setProperty(\value, val) }
valueAction_ { arg val; this.value = val; this.doAction }
mode {
var m = this.getProperty(\mode);
^ #[\round, \horiz, \vert].at(m);
}
mode_ { arg inputMode;
var iMode;
switch ( inputMode,
\round, { iMode = 0},
\horiz, { iMode = 1},
\vert, { iMode = 2 },
{ ^this }
);
this.setProperty( \mode, iMode );
}
centered_ { arg bool; this.setProperty( \centered, bool ); }
centered { ^this.getProperty( \centered ); }
background { ^this.palette.button; }
background_ { arg color; this.palette = this.palette.button_(color); }
// FIXME: find better alternatives to set colors separately.
color_ { arg colors;
var p;
p = this.palette;
p.button = colors[0];
p.windowText = colors[1];
p.window = colors[2];
p.buttonText = colors[3];
this.palette = p;
}
color {
var p;
p = this.palette;
^[p.button, p.windowText, p.window, p.buttonText];
}
getScale { |modifiers|
^case
{ modifiers.isShift } { this.shift_scale }
{ modifiers.isCtrl } { this.ctrl_scale }
{ modifiers.isAlt } { this.alt_scale }
{ 1 };
}
defaultKeyDownAction { arg char, modifiers, unicode, keycode, key;
var zoom = this.getScale(modifiers);
// standard keydown
switch( char,
$r, { this.valueAction = 1.0.rand },
$n, { this.valueAction = 0.0 },
$x, { this.valueAction = 1.0 },
$c, { this.valueAction = 0.5 },
{
switch( key,
16r5b, { this.decrement(zoom) },
16r5d, { this.increment(zoom) },
16r1000013, { this.increment(zoom) },
16r1000014, { this.increment(zoom) },
16r1000015, { this.decrement(zoom) },
16r1000012, { this.decrement(zoom) },
{^this} // propagate on if the key is a no-op
)
}
);
^true;
}
increment { |zoom=1| ^this.valueAction = (this.value + (keystep * zoom)) }
decrement { |zoom=1| ^this.valueAction = (this.value - (keystep * zoom)) }
defaultGetDrag { ^this.value }
defaultCanReceiveDrag { ^QView.currentDrag.isNumber }
defaultReceiveDrag { this.valueAction = QView.currentDrag }
}
|