/usr/share/SuperCollider/HelpSource/Classes/TabletSlider2D.schelp is in supercollider-common 1:3.8.0~repack-2.
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 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | CLASS:: TabletSlider2D
summary:: An extended Slider2D responding to Wacom tablet
categories:: GUI>Views
related:: Classes/TabletView
DESCRIPTION::
TabletSlider2D inherits most of its functionality from link::Classes/Slider2D::. Aside from that it receives extended wacom tablet data.
note:: TabletSlider2D is only available in Cocoa GUI ::
strong::Drag-and-drop:: returns and accepts a Point, describing the current x and y value.
All the strong::mouse actions:: ( link::Classes/Slider2D#-action#action::, link::Classes/View#-mouseDownAction#mouseDownAction::, and link::Classes/View#-mouseUpAction#mouseUpAction:: ) receive the following arguments:
table::
## view || the view
## x || subpixel location in view
## y || subpixel location in view
## pressure || 0..1
## tiltX || 0 (max. left) ... 1 (max. right)
## tiltY || 0 (max. down) ... 1 (max. up)
## deviceID || All tablet-pointer events generated in the period between the device entering and leaving tablet proximity have the same device ID. Therefore, when working with multiple tablets / mice, you can match actions by looking at the deviceID.
## buttonNumber || 0 left, 1 right, 2 middle wheel click.
## clickCount || double click, triple click ... most relevant for the mouseDown, but still valid for the dragged and mouseUp
## absoluteZ || the wheel on the side of some mice
## rotation || in degrees. Used for example on the "4d mouse", and the "art marker". Note: on Mac OS X 10.4.11 using an Intuos3 tablet with Art Marker, the returned value must be multiplied by 1024 to actually obtain degrees (bug?).
::
CLASSMETHODS::
PRIVATE:: key
EXAMPLES::
SUBSECTION:: Basic use
code::
(
var window;
var slider;
window = Window("2DSlider", Rect(100,100, 140 ,140));
window.front;
slider = TabletSlider2D(window, Rect(20, 20,80, 80))
.x_(0.5).y_(1);
slider.mouseDownAction = { arg view,x,y,pressure,tiltx,tilty,deviceID, buttonNumber,clickCount;
["down",view,x,y,pressure,tiltx,tilty,deviceID, buttonNumber,clickCount].postln;
};
slider.action = { arg view,x,y,pressure,tiltx,tilty,deviceID, buttonNumber,clickCount;
[view,x,y,pressure,tiltx,tilty,deviceID, buttonNumber,clickCount].postln;
};
slider.mouseUpAction = { arg view,x,y,pressure,tiltx,tilty,deviceID, buttonNumber,clickCount;
["up",view,x,y,pressure,tiltx,tilty,deviceID, buttonNumber,clickCount].postln;
};
slider.setProperty(\clipInBounds,0)
)
::
SUBSECTION:: Drag and drop Points
code::
(
w = Window("TabletSlider2D", Rect(100,100, 500 ,300));
w.view.decorator = FlowLayout(w.view.bounds);
t = TabletSlider2D(w, Rect(20, 20,280, 280))
.x_(0.5) // initial location of x
.y_(1) // initial location of y
.knobColor_(Color.rand)
.action_({|sl|
[\sliderX, sl.x, \sliderY, sl.y].postln;
});
t.step_(0.01);
n = CompositeView.new(w, 200@300);
n.decorator = FlowLayout(n.bounds);
v = { |i| DragBoth(n, Rect(0, i * 20, 200, 20)).align_(\center).background_(Color.rand) }.dup(5);
StaticText.new(n,200@150).string_("hold down cmd and drag points from the slider to the drag slots, or reverse").stringColor_(Color.white);
w.front;
)
::
SUBSECTION:: A sound example
code::
(
s.waitForBoot({
var w, v,int,synth;
synth=SynthDef("help-TabletSlider2D",{ arg freq=440,int1=5,int2 = -5,
ffreqInterval=0,rq=0.4,gate=0.0;
var p,c,d,f;
c=LFNoise1.kr(0.1,0.45,0.55);
d=LFNoise1.kr(0.1,0.45,0.55);
f=LFNoise1.kr(0.1,2);
p=Pulse.ar([ freq * int1.midiratio + f , freq, freq * int2.midiratio - f],
[c,d,c],0.2);
Out.ar(0,
RLPF.ar(Mix.ar(p),freq * ffreqInterval.midiratio,rq)
* EnvGen.kr(Env.adsr, gate, gate)
)
},[0.1,0.1,0.1,0.1,0.1,nil]).play(s);
w = Window.new.front;
int = ControlSpec(-48,48,\linear,1);
v = TabletSlider2D(w,Rect(10,10,380,380));
v.background = Color.blue.alpha_(0.2);
v.knobColor = Color.red;
v.action = { arg view,x,y,pressure,tiltx,tilty;
synth.set(
\int1, int.map(x),
\int2, int.map(y),
\ffreqInterval, int.map(pressure),
\gate, pressure.postln
);
};
v.mouseDownAction = { arg view,x,y,pressure;
synth.set(
\freq , rrand(30,80).midicps,
\gate, pressure.postln
)
};
v.mouseUpAction = { arg view,x,y,pressure;
synth.set( \gate, 0.postln )
};
});
)
::
|