2 SuperCollider real time audio synthesis system
3 Copyright (c) 2002 James McCartney. All rights reserved.
4 http://www.audiosynth.com
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 #import "DrawBackground.h"
22 #include "PyrObject.h"
31 layout_FixedLeft
= -1,
43 view_ResizeConstructionMode
,
44 view_PositionConstructionMode
,
51 // layout params for dynamic layout views
52 float mMinWidth
, mMaxWidth
, mMinHeight
, mMaxHeight
;
55 SCRect bounds
; //relative Bounds in SCCompositeView
56 // layout params for composite views
57 char mHResize
, mVResize
;
63 class SCContainerView
;
66 typedef SCView
* (*SCViewCtor
)(SCContainerView
*inParent
, PyrObject
* inObj
, SCRect inBounds
);
70 SCViewMaker(const char* inName
, SCViewCtor inCtor
);
71 static SCView
* MakeSCView(PyrObject
* inObj
, SCContainerView
*inParent
, SCRect inBounds
, const char* classname
);
78 extern SCViewMaker
*gSCViewMakers
;
79 extern SCView
*gAnimatedViews
;
84 SCView(SCContainerView
*inParent
, PyrObject
* inObj
, SCRect inBounds
);
87 virtual void draw(SCRect inDamage
);
88 virtual void drawFocus(SCRect inDamage
);
89 virtual void drawDisabled(SCRect inDamage
);
90 virtual void drawDragHilite(SCRect inDamage
);
91 virtual void drawIfNecessary(SCRect inDamage
);
92 virtual void mouseBeginTrack(SCPoint where
, int modifiers
,NSEvent
*theEvent
);
93 virtual void mouseTrack(SCPoint where
, int modifiers
,NSEvent
*theEvent
);
94 virtual void mouseEndTrack(SCPoint where
, int modifiers
,NSEvent
*theEvent
);
95 virtual void mouseOver(SCPoint where
, int modifiers
,NSEvent
*theEvent
);
96 virtual void draggingEntered (SCPoint where
);
97 virtual void draggingUpdated (SCPoint where
);
98 virtual void keyDown(int character
, int modifiers
, unsigned short keycode
);
99 virtual void keyUp(int character
, int modifiers
, unsigned short keycode
);
100 virtual void keyModifiersChanged(int modifiers
);
101 virtual void mouseDownAction(SCPoint where
, int modifiers
, NSEvent
*theEvent
);
102 virtual void mouseMoveAction(SCPoint where
, int modifiers
, NSEvent
*theEvent
);
103 virtual void mouseUpAction(SCPoint where
, int modifiers
, NSEvent
*theEvent
);
104 void doConstructionMove(SCPoint where
);
105 void setConstructionModeFromPoint(SCPoint where
);
106 virtual bool shouldDim();
107 void beginDrag(SCPoint where
);
109 virtual bool canReceiveDrag();
110 virtual void receiveDrag();
112 bool isFocus() const;
113 bool hit(SCPoint p
) const;
115 virtual void refreshInRect(SCRect b
);
117 void setDragHilite(bool inFlag
);
119 virtual int setProperty(PyrSymbol
*symbol
, PyrSlot
*slot
);
120 virtual int getProperty(PyrSymbol
*symbol
, PyrSlot
*slot
);
122 virtual void setVisibleFromParent() { } // does nothing, needed for Cocoa views
124 virtual bool isDragSource() const;
125 virtual SCView
* findView(SCPoint where
);
126 virtual SCView
* findViewByID(int32 inID
);
127 virtual void makeFocus(bool focus
);
128 virtual SCView
* nextFocus(bool *foundFocus
, bool canFocus
);
129 virtual SCView
* prevFocus(SCView
**prevView
, bool canFocus
);
130 virtual bool canFocus();
131 virtual NSView
* focusResponder();
133 void sendMessage(PyrSymbol
*method
, int numargs
, PyrSlot
*args
, PyrSlot
*result
);
135 virtual void setBounds(SCRect inBounds
);
136 virtual SCRect
getBounds();
137 virtual SCRect
getDrawBounds(); //relative to ContainerView
138 virtual Layout
getLayout();
139 // virtual void setLayout(Layout inLayout);
142 SCView
* next() { return mNext
; }
143 SCContainerView
* parent() { return mParent
; }
145 virtual NSMenu
* contextMenu(SCPoint inPoint
);
147 virtual void setMenuItemChosen(int inItem
) {}
149 PyrObject
* GetSCObj() { return mObj
; }
150 SCView
* NextAnimatedView() const { return mNextAnimatedView
; }
152 void startAnimation();
153 void stopAnimation();
154 virtual void animate() { refresh(); }
156 virtual bool isScroller() { return false; }
157 virtual bool isSubViewScroller() { return false; }
158 virtual bool isContainer() { return false; }
159 virtual SCRect
checkMinimumSize() { return mBounds
; }
161 bool isTopContainer(){ return (!mParent
);};
164 friend class SCContainerView
;
165 friend class SCScrollView
;
168 SCView
*mNextAnimatedView
;
169 SCView
*mPrevAnimatedView
;
170 SCContainerView
*mParent
;
175 DrawBackground
* mBackground
;
176 DrawBackground
* mBackgroundImage
;
182 int mConstructionMode
;
184 NSString
*mDragLabel
;
189 class SCContainerView
: public SCView
192 SCContainerView(SCContainerView
*inParent
, PyrObject
* inObj
, SCRect inBounds
);
193 virtual ~SCContainerView();
195 virtual void drawIfNecessary(SCRect inDamage
);
197 virtual void add(SCView
*inChild
);
198 virtual void remove(SCView
*inChild
);
199 virtual SCView
* findView(SCPoint where
);
200 virtual SCView
* findViewByID(int32 inID
);
201 virtual void makeFocus(bool focus
);
202 virtual SCView
* nextFocus(bool *foundFocus
, bool canFocus
);
203 virtual SCView
* prevFocus(SCView
**prevView
, bool canFocus
);
204 virtual bool canFocus();
205 virtual int setProperty(PyrSymbol
*symbol
, PyrSlot
*slot
);
206 virtual SCRect
checkMinimumSize();
207 virtual void setVisibleFromParent();
208 virtual bool isVisible() {return mVisible
&& mParent
->isVisible(); }
209 virtual bool isContainer() { return true; }
216 class SCCompositeView
: public SCContainerView
219 SCCompositeView(SCContainerView
*inParent
, PyrObject
* inObj
, SCRect inBounds
);
220 virtual ~SCCompositeView();
222 virtual void setBounds(SCRect inBounds
);
226 class SCLayoutView
: public SCContainerView
229 SCLayoutView(SCContainerView
*inParent
, PyrObject
* inObj
, SCRect inBounds
);
230 virtual ~SCLayoutView();
232 virtual int setProperty(PyrSymbol
*symbol
, PyrSlot
*slot
);
233 virtual int getProperty(PyrSymbol
*symbol
, PyrSlot
*slot
);
234 virtual void add(SCView
*inChild
);
240 class SCHLayoutView
: public SCLayoutView
243 SCHLayoutView(SCContainerView
*inParent
, PyrObject
* inObj
, SCRect inBounds
);
244 virtual ~SCHLayoutView();
246 virtual void setBounds(SCRect inBounds
);
251 class SCVLayoutView
: public SCLayoutView
254 SCVLayoutView(SCContainerView
*inParent
, PyrObject
* inObj
, SCRect inBounds
);
255 virtual ~SCVLayoutView();
257 virtual void setBounds(SCRect inBounds
);
262 // tell host to draw stuff.
263 typedef void (*DamageCallback
)(SCRect inRect
, void *inData
);
264 typedef void (*DragCallback
)(SCPoint where
, PyrSlot
* inSlot
, NSString
* inString
, NSString
* label
, void *inData
);
266 class SCTopView
: public SCCompositeView
269 SCTopView(PyrObject
* inObj
, SCRect inBounds
);
271 SCView
*focusView() {
272 if(isSubViewScroller()) {
273 return mTop
->focusView();
279 void forgetView(SCView
*view
);
282 void addDamage(SCRect inRect
);
283 void beginDragCallback(SCPoint where
, PyrSlot
* slot
, NSString
* string
, NSString
* label
);
285 void setDamageCallback(DamageCallback inFunc
, void *inHostData
)
286 { mDamageCallback
= inFunc
; mHostData
= inHostData
; }
287 void setDragCallback(DragCallback inFunc
)
288 { mDragCallback
= inFunc
; }
292 void setDragView(SCView
*inView
);
294 NSView
* GetNSView() { return mNSView
; }
295 void SetNSView(NSView
* inView
) { mNSView
= inView
; }
297 bool ConstructionMode() { return mConstructionMode
; }
298 void SetConstructionMode(bool inFlag
) { mConstructionMode
= inFlag
; }
300 virtual void drawFocus(SCRect inDamage
);
301 virtual bool canReceiveDrag();
302 virtual void receiveDrag();
303 virtual void setInternalBounds(SCRect internalBounds
);
304 virtual bool isVisible() {return mVisible
; }
307 void focusIs(SCView
*inView
) {
308 if(isSubViewScroller()) {
309 mTop
->focusIs(inView
);
315 DamageCallback mDamageCallback
;
316 DragCallback mDragCallback
;
322 bool mConstructionMode
;
326 SCScrollTopView and SCScrollView by Scott Wilson
327 Development funded in part by the Arts and Humanites Research Council http://www.ahrc.ac.uk/
330 class SCScrollTopView
: public SCTopView
333 SCScrollTopView(PyrObject
* inObj
, SCRect inBounds
);
335 NSScrollView
* GetScrollView() { return mNSScrollView
; }
336 void SetNSScrollView(NSScrollView
* inView
) { mNSScrollView
= inView
; }
338 virtual bool isScroller() { return true; }
340 virtual SCRect
getDrawBounds();
341 virtual void setInternalBounds(SCRect inBounds
);
342 virtual int setProperty(PyrSymbol
*symbol
, PyrSlot
*slot
);
343 virtual int getProperty(PyrSymbol
*symbol
, PyrSlot
*slot
);
344 virtual SCRect
checkMinimumSize();
345 virtual void add(SCView
*inChild
);
346 virtual void remove(SCView
*inChild
);
347 bool isInSetClipViewOrigin() { return mInSetClipViewOrigin
; }
348 void setInSetClipViewOrigin(bool flag
) { mInSetClipViewOrigin
= flag
; }
351 NSScrollView
*mNSScrollView
;
352 bool mInSetClipViewOrigin
;
355 class SCScrollView
: public SCScrollTopView
358 SCScrollView(SCContainerView
*inParent
, PyrObject
* inObj
, SCRect inBounds
);
359 virtual ~SCScrollView();
360 virtual int setProperty(PyrSymbol
*symbol
, PyrSlot
*slot
);
361 virtual void setVisibleFromParent();
362 //virtual int getProperty(PyrSymbol *symbol, PyrSlot *slot);
364 virtual void setBounds(SCRect inBounds
);
365 virtual SCRect
getBounds();
366 virtual void add(SCView
*inChild
);
367 // virtual void remove(SCView *inChild);
369 virtual bool isSubViewScroller() { return true; }
371 virtual void drawIfNecessary(SCRect inDamage
);
372 virtual void drawSubViewIfNecessary(SCRect inDamage
);
373 virtual bool isVisible() {return mVisible
&& mParent
->isVisible(); }
376 inline bool SCView::isFocus() const { return mTop
->focusView() == this; }
378 class SCSlider
: public SCView
381 SCSlider(SCContainerView
*inParent
, PyrObject
* inObj
, SCRect inBounds
);
383 virtual void draw(SCRect inDamage
);
384 virtual void mouseTrack(SCPoint where
, int modifiers
,NSEvent
*theEvent
);
386 double value() { return mValue
; }
387 bool setValue(double inValue
, bool send
);
389 virtual int setProperty(PyrSymbol
*symbol
, PyrSlot
*slot
);
390 virtual int getProperty(PyrSymbol
*symbol
, PyrSlot
*slot
);
392 virtual bool canReceiveDrag();
393 virtual void receiveDrag();
396 virtual void setValueFromPoint(SCPoint point
);
397 void calcThumbRect(SCRect bounds
);
400 double mValue
, mStepSize
, mStepScale
;
401 DrawBackground
* mKnob
;
404 SCView
* NewSCSlider(SCContainerView
*inParent
, PyrObject
* inObj
, SCRect inBounds
);
407 class SCRangeSlider
: public SCView
410 SCRangeSlider(SCContainerView
*inParent
, PyrObject
* inObj
, SCRect inBounds
);
412 virtual void draw(SCRect inDamage
);
413 virtual void mouseBeginTrack(SCPoint where
, int modifiers
,NSEvent
*theEvent
);
414 virtual void mouseTrack(SCPoint where
, int modifiers
,NSEvent
*theEvent
);
416 bool setValue(double inLo
, double inHi
, bool send
);
418 virtual int setProperty(PyrSymbol
*symbol
, PyrSlot
*slot
);
419 virtual int getProperty(PyrSymbol
*symbol
, PyrSlot
*slot
);
421 virtual bool canReceiveDrag();
422 virtual void receiveDrag();
425 virtual void setValueFromPoint(SCPoint point
);
427 void moveRangeFromPoint(SCPoint point
);
428 void adjustLoFromPoint(SCPoint point
);
429 void adjustHiFromPoint(SCPoint point
);
430 // sc.solar addition end
431 void calcRangeRect();
434 double mLo
, mHi
, mStepSize
, mStepScale
;
436 DrawBackground
* mKnob
;
438 SCView
* NewSCRangeSlider(SCContainerView
*inParent
, PyrObject
* inObj
, SCRect inBounds
);
442 class SC2DSlider
: public SCView
445 SC2DSlider(SCContainerView
*inParent
, PyrObject
* inObj
, SCRect inBounds
);
447 virtual void draw(SCRect inDamage
);
448 virtual void mouseTrack(SCPoint where
, int modifiers
,NSEvent
*theEvent
);
450 virtual bool setValue(double inLo
, double inHi
, bool send
);
452 virtual int setProperty(PyrSymbol
*symbol
, PyrSlot
*slot
);
453 virtual int getProperty(PyrSymbol
*symbol
, PyrSlot
*slot
);
455 virtual bool canReceiveDrag();
456 virtual void receiveDrag();
459 virtual void setValueFromPoint(SCPoint point
);
460 void calcThumbRect();
464 double mStepSize
, mStepScale
;
465 DrawBackground
* mKnob
;
467 SCView
* NewSC2DSlider(SCContainerView
*inParent
, PyrObject
* inObj
, SCRect inBounds
);
470 class SC2DTabletSlider
: public SC2DSlider
473 SC2DTabletSlider(SCContainerView
*inParent
, PyrObject
* inObj
, SCRect inBounds
);
475 virtual void mouseBeginTrack(SCPoint where
, int modifiers
,NSEvent
*theEvent
);
476 virtual void mouseTrack(SCPoint where
, int modifiers
,NSEvent
*theEvent
);
477 virtual void mouseEndTrack(SCPoint where
, int modifiers
,NSEvent
*theEvent
);
478 virtual void mouseDownAction(SCPoint where
, int modifiers
, NSEvent
*theEvent
);
479 virtual void mouseMoveAction(SCPoint where
, int modifiers
, NSEvent
*theEvent
);
480 virtual void mouseUpAction(SCPoint where
, int modifiers
, NSEvent
*theEvent
);
481 virtual int setProperty(PyrSymbol
*symbol
, PyrSlot
*slot
);
483 virtual bool setValue(double inX
, double inY
,bool send
);
489 SCView
* NewSC2DTabletSlider(SCContainerView
*inParent
, PyrObject
* inObj
, SCRect inBounds
);
492 #include "SC_SndBuf.h"
494 const int kMaxScopeChannels
= 128;
495 class SCScope
: public SCView
498 SCScope(SCContainerView
*inParent
, PyrObject
* inObj
, SCRect inBounds
);
501 virtual void draw(SCRect inDamage
);
502 virtual void draw0(CGContextRef cgc
);
503 virtual void draw1(CGContextRef cgc
);
504 virtual void draw2(CGContextRef cgc
);
505 virtual void mouseTrack(SCPoint where
, int modifiers
,NSEvent
*theEvent
);
506 virtual void animate();
508 virtual int setProperty(PyrSymbol
*symbol
, PyrSlot
*slot
);
509 virtual int getProperty(PyrSymbol
*symbol
, PyrSlot
*slot
);
511 SCPoint
pixelToUnits(SCPoint p
, SCRect r
)
514 (p
.x
- r
.x
) * mZoom
.x
+ mScroll
.x
,
515 (p
.y
- r
.y
) * mZoom
.y
+ mScroll
.y
);
517 SCPoint
unitsToPixel(SCPoint u
, SCRect r
)
520 (u
.x
- mScroll
.x
) * mInvZoom
.x
+ r
.x
,
521 (u
.y
- mScroll
.y
) * mInvZoom
.y
+ r
.y
);
528 SCPoint mZoom
, mInvZoom
, mScroll
;
529 int mStyle
; // 0 = separate, 1 = overlay, 2 = x,y.
530 SCColor mWaveColors
[kMaxScopeChannels
];
534 SCView
* NewSCScope(SCContainerView
*inParent
, PyrObject
* inObj
, SCRect inBounds
);
538 const int kLabelSize
= 64;
541 char mLabel
[kLabelSize
];
543 SCColor mButtonColor
;
546 const int kFontNameSize
= 80;
548 class SCButton
: public SCView
551 SCButton(SCContainerView
*inParent
, PyrObject
* inObj
, SCRect inBounds
);
554 virtual void draw(SCRect inDamage
);
555 virtual void mouseTrack(SCPoint where
, int modifiers
,NSEvent
*theEvent
);
556 virtual void mouseEndTrack(SCPoint where
, int modifiers
,NSEvent
*theEvent
);
558 bool setValue(int inValue
, bool send
, int modifiers
);
560 virtual int setProperty(PyrSymbol
*symbol
, PyrSlot
*slot
);
561 virtual int getProperty(PyrSymbol
*symbol
, PyrSlot
*slot
);
563 virtual bool canReceiveDrag();
564 virtual void receiveDrag();
569 char mFontName
[kFontNameSize
];
572 SCButtonState
*mStates
;
575 SCView
* NewSCButton(SCContainerView
*inParent
, PyrObject
* inObj
, SCRect inBounds
);
578 @interface SCNSMenu
: NSMenu
582 - (void) selectedItem
:(id
)item
;
586 class SCPopUpMenu
: public SCView
589 SCPopUpMenu(SCContainerView
*inParent
, PyrObject
* inObj
, SCRect inBounds
);
590 virtual ~SCPopUpMenu();
592 virtual void draw(SCRect inDamage
);
593 virtual void mouseBeginTrack(SCPoint where
, int modifiers
,NSEvent
*theEvent
);
595 bool setValue(int inValue
, bool send
);
596 virtual void setMenuItemChosen(int inItem
) { setValue(inItem
, true); }
598 virtual int setProperty(PyrSymbol
*symbol
, PyrSlot
*slot
);
599 virtual int getProperty(PyrSymbol
*symbol
, PyrSlot
*slot
);
601 virtual bool canReceiveDrag();
602 virtual void receiveDrag();
608 char mFontName
[kFontNameSize
];
610 SCColor mStringColor
;
612 SCView
* NewSCPopUpMenu(SCContainerView
*inParent
, PyrObject
* inObj
, SCRect inBounds
);
615 class SCListView
: public SCView
618 SCListView(SCContainerView
*inParent
, PyrObject
* inObj
, SCRect inBounds
);
619 virtual ~SCListView();
621 virtual void draw(SCRect inDamage
);
622 virtual void mouseBeginTrack(SCPoint where
, int modifiers
,NSEvent
*theEvent
);
623 virtual void mouseTrack(SCPoint where
, int modifiers
, NSEvent
*theEvent
);
625 bool setValue(int inValue
, bool send
);
627 virtual int setProperty(PyrSymbol
*symbol
, PyrSlot
*slot
);
628 virtual int getProperty(PyrSymbol
*symbol
, PyrSlot
*slot
);
630 virtual bool canReceiveDrag();
631 virtual void receiveDrag();
633 void scrollToValue();
638 CFMutableArrayRef mArray
;
639 char mFontName
[kFontNameSize
];
644 SCColor mStringColor
;
645 SCColor mSelectedStringColor
;
646 SCColor mHiliteColor
;
647 SCColor
* mItemBackgroundColor
;
652 SCView
* NewSCListView(SCContainerView
*inParent
, PyrObject
* inObj
, SCRect inBounds
);
655 class SCMultiSliderView
: public SCView
658 SCMultiSliderView(SCContainerView
*inParent
, PyrObject
* inObj
, SCRect inBounds
);
659 virtual ~SCMultiSliderView();
661 virtual void draw(SCRect inDamage
);
662 virtual void mouseBeginTrack(SCPoint where
, int modifiers
,NSEvent
*theEvent
);
663 virtual void mouseEndTrack(SCPoint where
, int modifiers
,NSEvent
*theEvent
);
664 virtual void mouseTrack(SCPoint where
, int modifiers
,NSEvent
*theEvent
);
666 void setSelection(SCPoint where
);
667 bool setValue(int inX
, double inY
, bool send
);
668 //virtual void setPoint(int x, double y, bool send);
669 virtual int setProperty(PyrSymbol
*symbol
, PyrSlot
*slot
);
670 virtual int getProperty(PyrSymbol
*symbol
, PyrSlot
*slot
);
671 void setVisibleSize();
672 virtual bool canReceiveDrag();
673 virtual void receiveDrag();
676 int indexFromPoint(SCPoint where
);
677 // int getVisibleMax();
679 double valueFromPoint(SCPoint where
);
680 void setValueFromPoint(SCPoint point
);
681 SCRect
calcThumbRect(int xIn
, double valIn
, double step
);
682 float mThumbSize
, mThumbSizeY
; // size of the rect
683 int mTabSize
, mVisibleSize
; // size of the table
685 SCColor mStrokeColor
;
687 double mCurrentY
, mCurrentX
;
688 int mCurrentIndex
, mStartIndex
, mSelectionSize
;
689 double mStepSize
, mStepScale
;
691 double * mSecYValues
;
692 DrawBackground
* mKnob
;
693 float mXOffset
; //space between points
694 bool mReadOnly
, mDrawLinesActive
, mShowIndex
, mDrawRectsActive
, mIsHorizontal
, mIsFilled
;
697 double mElasticIndexStep
;
700 SCView
* NewSCMultiSliderView(SCContainerView
*inParent
, PyrObject
* inObj
, SCRect inBounds
);
702 //by jan truetzschler jt[at]kandos[dot]de
704 //enum taken from PyrArrayPrimitives should move to a header file
717 SCColor mColor
; //changes between selected and mObjectColor
718 SCColor mObjectColor
; //if its not selected
722 double * mConnections
; //tells to where it is connected
723 int mNumInputs
, mNumOutputs
;
725 bool mIsSelected
, mIsVisible
, mEditable
;
730 typedef struct SCEnvObject SCEnvObject
;
732 class SCEnvelopeView
: public SCView
735 SCEnvelopeView(SCContainerView
*inParent
, PyrObject
* inObj
, SCRect inBounds
);
736 virtual ~SCEnvelopeView();
737 virtual void draw(SCRect inDamage
);
738 virtual void mouseDownAction(SCPoint where
, int modifiers
, NSEvent
*theEvent
);
739 virtual void mouseBeginTrack(SCPoint where
, int modifiers
,NSEvent
*theEvent
);
740 virtual void mouseEndTrack(SCPoint where
, int modifiers
,NSEvent
*theEvent
);
741 virtual void mouseTrack(SCPoint where
, int modifiers
,NSEvent
*theEvent
);
743 void setSelection(SCPoint where
, bool fixed
, bool checkForConnection
);
744 virtual int setProperty(PyrSymbol
*symbol
, PyrSlot
*slot
);
745 virtual int getProperty(PyrSymbol
*symbol
, PyrSlot
*slot
);
746 virtual bool canReceiveDrag();
747 virtual void receiveDrag();
751 void setValueFromPoint(SCPoint point
);
752 bool setValue(SCEnvObject
* envob
, double x
, double y
, bool send
);
753 int allocSlotEnvObjArray(PyrSlot
*slot
, SCEnvObject
**arr
);
754 bool setEnvRect(double valX
, double valY
, SCEnvObject
* envobIn
);
756 int mThumbSize
, mThumbSizeY
; // size of the rect
757 int mTabSize
, mVisibleSize
, mActiveSize
; // size of the table
758 SCColor mFillColor
, mSelectedColor
, mStrokeColor
;
760 double mCurrentY
, mCurrentX
, mAbsoluteX
;
761 int mCurrentIndex
, mStartIndex
, mSelectionSize
, mLastIndex
;
762 double mStepSize
, mStepScale
;
763 SCEnvObject
* mEnvObj
;
764 //DrawBackground* mKnob;
765 bool mDrawLinesActive
, mShowIndex
, mDrawRectsActive
, mIsFilled
, mIsFixedSelection
, mIsEnvView
, mIsTracking
;
775 char mFontName
[kFontNameSize
];
777 SCColor mStringColor
;
779 bool mDrawCenteredConnection
;
785 SCView
* NewSCEnvelopeView(SCContainerView
*inParent
, PyrObject
* inObj
, SCRect inBounds
);
790 const char kFrameLastTimes
= 10;
791 class SCUserView
: public SCView
794 SCUserView(SCContainerView
*inParent
, PyrObject
* inObj
, SCRect inBounds
);
795 virtual ~SCUserView();
797 virtual void draw(SCRect inDamage
);
798 virtual void mouseBeginTrack(SCPoint where
, int modifiers
,NSEvent
*theEvent
);
799 virtual void mouseTrack(SCPoint where
, int modifiers
,NSEvent
*theEvent
);
800 virtual void mouseEndTrack(SCPoint where
, int modifiers
,NSEvent
*theEvent
);
801 virtual void mouseMoveAction(SCPoint where
, int modifiers
, NSEvent
*theEvent
);
802 virtual void mouseUpAction(SCPoint where
, int modifiers
, NSEvent
*theEvent
);
803 virtual void mouseDownAction(SCPoint where
, int modifiers
, NSEvent
*theEvent
);
804 virtual void mouseOver(SCPoint where
, int modifiers
, NSEvent
*theEvent
);
805 virtual void keyDown(int character
, int modifiers
);
806 virtual void keyUp(int character
, int modifiers
);
807 virtual bool canReceiveDrag();
808 virtual void receiveDrag();
809 virtual int setProperty(PyrSymbol
*symbol
, PyrSlot
*slot
);
810 virtual int getProperty(PyrSymbol
*symbol
, PyrSlot
*slot
);
811 virtual void clearDrawing();
812 virtual void refreshInRect(SCRect b
);
814 bool mDrawingEnabled
;
815 bool mClearOnRefresh
;
816 double mFrameLastTimes
[kFrameLastTimes
];
819 SCPoint mRealtiveMousePoint
;
821 NSImage
* mNSImageForLayering
; // offscreen image object
822 NSBitmapImageRep
* mImageRep
;
823 void mouseAction(PyrSymbol
*method
, SCPoint where
, int modifiers
);
825 SCView
* NewSCUserView(SCContainerView
*inParent
, PyrObject
* inObj
, SCRect inBounds
);
836 class SCStaticText
: public SCView
839 SCStaticText(SCContainerView
*inParent
, PyrObject
* inObj
, SCRect inBounds
);
840 virtual ~SCStaticText();
842 virtual void draw(SCRect inDamage
);
843 virtual bool shouldDim();
845 virtual int setProperty(PyrSymbol
*symbol
, PyrSlot
*slot
);
846 virtual int getProperty(PyrSymbol
*symbol
, PyrSlot
*slot
);
849 virtual void drawString(SCRect bounds
);
852 char mFontName
[kFontNameSize
];
854 SCColor mStringColor
;
858 SCView
* NewSCStaticText(SCContainerView
*inParent
, PyrObject
* inObj
, SCRect inBounds
);
860 class SCNumberBoxOld
: public SCStaticText
863 SCNumberBoxOld(SCContainerView
*inParent
, PyrObject
* inObj
, SCRect inBounds
);
864 virtual ~SCNumberBoxOld();
866 virtual void draw(SCRect inDamage
);
867 virtual bool shouldDim();
869 virtual void mouseTrack(SCPoint where
, int modifiers
,NSEvent
*theEvent
);
870 //virtual void mouseEndTrack(SCPoint where, int modifiers);
872 //virtual int setProperty(PyrSymbol *symbol, PyrSlot *slot);
873 //virtual int getProperty(PyrSymbol *symbol, PyrSlot *slot);
875 virtual bool canReceiveDrag();
876 virtual void receiveDrag();
878 SCView
* NewSCNumberBoxOld(SCContainerView
*inParent
, PyrObject
* inObj
, SCRect inBounds
);
880 class SCDragSource
: public SCStaticText
883 SCDragSource(SCContainerView
*inParent
, PyrObject
* inObj
, SCRect inBounds
);
884 virtual ~SCDragSource();
886 virtual void draw(SCRect inDamage
);
887 virtual bool shouldDim();
888 virtual void mouseBeginTrack(SCPoint where
, int modifiers
,NSEvent
*theEvent
);
892 SCView
* NewSCDragSource(SCContainerView
*inParent
, PyrObject
* inObj
, SCRect inBounds
);
895 class SCDragSink
: public SCStaticText
898 SCDragSink(SCContainerView
*inParent
, PyrObject
* inObj
, SCRect inBounds
);
899 virtual ~SCDragSink();
901 virtual void draw(SCRect inDamage
);
902 virtual bool shouldDim();
904 virtual bool canReceiveDrag();
905 virtual void receiveDrag();
909 SCView
* NewSCDragSink(SCContainerView
*inParent
, PyrObject
* inObj
, SCRect inBounds
);
912 class SCDragBoth
: public SCDragSink
915 SCDragBoth(SCContainerView
*inParent
, PyrObject
* inObj
, SCRect inBounds
);
917 virtual void draw(SCRect inDamage
);
919 virtual void mouseBeginTrack(SCPoint where
, int modifiers
,NSEvent
*theEvent
);
923 SCView
* NewSCDragBoth(SCContainerView
*inParent
, PyrObject
* inObj
, SCRect inBounds
);
927 class SCTabletView
: public SCView
930 SCTabletView(SCContainerView
*inParent
, PyrObject
* inObj
, SCRect inBounds
);
931 virtual ~SCTabletView();
933 virtual int setProperty(PyrSymbol
*symbol
, PyrSlot
*slot
);
935 virtual void mouseBeginTrack(SCPoint where
, int modifiers
,NSEvent
*theEvent
);
936 virtual void mouseTrack(SCPoint where
, int modifiers
,NSEvent
*theEvent
);
937 virtual void mouseEndTrack(SCPoint where
, int modifiers
,NSEvent
*theEvent
);
938 virtual void mouseDownAction(SCPoint where
, int modifiers
, NSEvent
*theEvent
);
939 virtual void mouseMoveAction(SCPoint where
, int modifiers
, NSEvent
*theEvent
);
940 virtual void mouseUpAction(SCPoint where
, int modifiers
, NSEvent
*theEvent
);
944 SCView
* NewSCTabletView(SCContainerView
*inParent
, PyrObject
* inObj
, SCRect inBounds
);