[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[sc-dev] [Patch] Add thumbSize property to SCSlider
As in subject. Also adds getter/setter methods for the spacing
property at SCLayoutView.
Also, a patch sent last month to sc-users:
<http://www.create.ucsb.edu/pipermail/sc-users/2004-October/013533.html>
was silently dropped. Is there any way I can fix this to get it
included?
Lastly, the OSCresponder help file omits the NetAddr argument to the
reciever. Perhaps:
addr - the NetAddr of the sender of the incoming message
Regards,
Rohan
--- SCView.M.~1.82.~ Tue Oct 26 12:05:36 2004
+++ SCView.M Sat Oct 30 17:31:15 2004
@@ -1233,7 +1233,7 @@
}
SCSlider::SCSlider(SCContainerView *inParent, PyrObject* inObj, SCRect inBounds)
- : SCView(inParent, inObj, inBounds), mStepSize(0.), mStepScale(0.), mKnob(0)
+ : SCView(inParent, inObj, inBounds), mStepSize(0.), mStepScale(0.), mKnob(0),mThumbSize(12.)
{
mValue = 1.;
setValue(0.0, false);
@@ -1278,18 +1278,16 @@
return changed;
}
-const int THUMBSIZE = 12;
-
void SCSlider::setValueFromPoint(SCPoint point)
{
double moveableRange, value;
if (mBounds.width > mBounds.height) {
- moveableRange = mBounds.width - THUMBSIZE - 2;
- value = (point.x - mBounds.x - 1 - THUMBSIZE/2) / moveableRange;
+ moveableRange = mBounds.width - mThumbSize - 2;
+ value = (point.x - mBounds.x - 1 - mThumbSize/2) / moveableRange;
} else {
- moveableRange = mBounds.height - THUMBSIZE - 2;
- value = 1. - (point.y - mBounds.y - 1 - THUMBSIZE/2) / moveableRange;
+ moveableRange = mBounds.height - mThumbSize - 2;
+ value = 1. - (point.y - mBounds.y - 1 - mThumbSize/2) / moveableRange;
}
setValue(value, true);
}
@@ -1300,16 +1298,16 @@
moveableRange = (mBounds.width > mBounds.height)
? mBounds.width : mBounds.height;
- moveableRange -= THUMBSIZE + 2;
+ moveableRange -= mThumbSize + 2;
double offset = mValue * moveableRange;
if (mBounds.width > mBounds.height) {
mThumbRect = SCMakeRect(mBounds.x + offset + 1, mBounds.y + 1,
- THUMBSIZE, mBounds.height - 2);
+ mThumbSize, mBounds.height - 2);
} else {
- mThumbRect = SCMakeRect(mBounds.x + 1, mBounds.y + mBounds.height - offset - 1 - THUMBSIZE,
- mBounds.width - 2, THUMBSIZE);
+ mThumbRect = SCMakeRect(mBounds.x + 1, mBounds.y + mBounds.height - offset - 1 - mThumbSize,
+ mBounds.width - 2, mThumbSize);
}
}
@@ -1349,6 +1347,12 @@
}
return errNone;
}
+ if (strcmp(name, "thumbSize")==0) {
+ err = slotFloatVal(slot, &mThumbSize);
+ if (err) return err;
+ refresh();
+ return errNone;
+ }
return SCView::setProperty(symbol, slot);
}
@@ -1364,6 +1368,10 @@
SetFloat(slot, mStepSize);
return errNone;
}
+ if (strcmp(name, "thumbSize")==0) {
+ SetFloat(slot, mThumbSize);
+ return errNone;
+ }
return SCView::getProperty(symbol, slot);
}
@@ -1703,6 +1711,8 @@
}
return changed;
}
+
+const int THUMBSIZE = 12;
void SC2DSlider::setValueFromPoint(SCPoint where)
{
--- SCView.h.~1.38.~ Tue Oct 26 12:05:28 2004
+++ SCView.h Sat Oct 30 17:27:39 2004
@@ -296,6 +296,7 @@
SCRect mThumbRect;
double mValue, mStepSize, mStepScale;
DrawBackground* mKnob;
+ float mThumbSize;
};
SCView* NewSCSlider(SCContainerView *inParent, PyrObject* inObj, SCRect inBounds);
--- SCView.sc~1.32~ Sat Oct 30 17:47:17 2004
+++ SCView.sc Sat Oct 30 17:45:53 2004
@@ -266,6 +266,13 @@
SCLayoutView : SCContainerView {
properties { ^super.properties ++ #[\spacing] }
+
+ spacing {
+ ^this.getProperty(\spacing, 0)
+ }
+ spacing_ { arg distance;
+ this.setProperty(\spacing, distance)
+ }
}
SCHLayoutView : SCLayoutView {}
@@ -289,6 +296,13 @@
}
step {
^this.getProperty(\step)
+ }
+
+ thumbSize {
+ ^this.getProperty(\thumbSize, 12)
+ }
+ thumbSize_ { arg size;
+ this.setProperty(\thumbSize, size)
}
properties {