/usr/share/SuperCollider/SCClassLibrary/QtCollider/QNumberBox.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 114 115 116 117 118 119 120 121 122 123 124 125 126 | QNumberBox : QAbstractStepValue {
var <scroll, <scroll_step;
var <align, <buttonsVisible = false;
var <normalColor, <typingColor;
var <object, <>setBoth = true;
*qtClass { ^'QcNumberBox' }
*new { arg aParent, aBounds;
var obj = super.new( aParent, aBounds );
obj.initQNumberBox;
^obj;
}
initQNumberBox {
scroll = true;
scroll_step = 1;
normalColor = Color.black;
typingColor = Color.red;
}
object_ { arg obj;
if( setBoth ) {
if( obj.isNumber ) { this.value = obj } { this.string = obj.asString }
};
object = obj
}
value {
var type = this.getProperty( \valueType );
var val;
switch( type,
0 /* Number */, { val = this.getProperty( \value ) },
1 /* Inf */, { val = inf },
2 /* -Inf */, { val = -inf },
3 /* NaN */, { val = 0 },
4 /* Text */, { val = 0 }
);
^val;
}
value_ { arg value;
case
// isNaN has to be on the first plase, because a NaN is also equal to inf and -inf
{ value.isNaN } { this.invokeMethod( \setNaN ); }
{ value == inf } { this.invokeMethod( \setInfinite, true ); }
{ value == -inf } { this.invokeMethod( \setInfinite, false ); }
{ this.setProperty( \value, value.asFloat ); }
;
}
valueAction_ { arg val;
this.value_(val);
action.value(this);
}
string { ^this.getProperty( \text ); }
string_ { arg string; this.setProperty( \text, string ); }
clipLo { ^this.getProperty(\minimum) }
clipLo_ { arg aFloat; this.setProperty( \minimum, aFloat ) }
clipHi { ^this.getProperty(\maximum) }
clipHi_ { arg aFloat; this.setProperty( \maximum, aFloat ) }
scroll_ { arg aBool;
scroll = aBool;
this.setProperty( \scroll, aBool );
}
scroll_step_ { arg aFloat;
scroll_step = aFloat;
this.setProperty( \scrollStep, aFloat );
}
decimals { ^this.getProperty(\decimals); }
minDecimals { ^this.getProperty(\minDecimals); }
maxDecimals { ^this.getProperty(\maxDecimals); }
decimals_ { arg decimals; this.setProperty( \decimals, decimals ); }
minDecimals_ { arg decimals; this.setProperty( \minDecimals, decimals ); }
maxDecimals_ { arg decimals; this.setProperty( \maxDecimals, decimals ); }
align_ { arg alignment;
align = alignment;
this.setProperty( \alignment, QAlignment(alignment));
}
stringColor {
^this.palette.baseText;
}
stringColor_ { arg color;
this.palette = this.palette.baseText_(color);
}
normalColor_ { arg aColor;
normalColor = aColor;
this.setProperty( \normalColor, aColor );
}
typingColor_ { arg aColor;
typingColor = aColor;
this.setProperty( \editingColor, aColor );
}
background {
^this.palette.base;
}
background_ { arg color;
this.palette = this.palette.base_(color);
}
buttonsVisible_ { arg aBool;
buttonsVisible = aBool;
this.setProperty( \buttonsVisible, aBool );
}
defaultGetDrag { ^this.value; }
defaultCanReceiveDrag { ^QView.currentDrag.isNumber; }
defaultReceiveDrag {
this.valueAction = QView.currentDrag;
}
}
|