aboutsummaryrefslogtreecommitdiff
path: root/sc4pd/headers/app/SCView.h
blob: a75244574a108945c5332f13bc7b4f9eb654718c (plain)
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
/*
	SuperCollider real time audio synthesis system
    Copyright (c) 2002 James McCartney. All rights reserved.
	http://www.audiosynth.com

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

#import "DrawBackground.h"
#include "PyrObject.h"

enum {
    layout_NoResize,
    layout_Resize
};

enum {
    // mHResize
    layout_FixedLeft = -1,
    layout_HElastic,
    layout_FixedRight,
};
enum {
    // mVResize
    layout_FixedTop = -1,
    layout_VElastic,
    layout_FixedBottom
};


struct Layout
{
    Layout();

    // layout params for dynamic layout views
    float mMinWidth, mMaxWidth, mMinHeight, mMaxHeight;
    float mWeight;
    bool mShouldResize;
    // layout params for composite views
    char mHResize, mVResize;
};



class SCView;
class SCContainerView;
class SCTopView;

typedef SCView* (*SCViewCtor)(SCContainerView *inParent, PyrObject* inObj, SCRect inBounds);

struct SCViewMaker
{
	SCViewMaker(const char* inName, SCViewCtor inCtor);
	static SCView* MakeSCView(PyrObject* inObj, SCContainerView *inParent, SCRect inBounds, const char* classname);
	
	SCViewMaker *mNext;
	SCViewCtor mCtor;
	const char* mName;
};

extern SCViewMaker *gSCViewMakers;
extern SCView *gAnimatedViews;

class SCView
{
public:
	SCView(SCContainerView *inParent, PyrObject* inObj, SCRect inBounds); 
	virtual ~SCView();
		
	virtual void draw(SCRect inDamage);
	virtual void drawFocus(SCRect inDamage);
	virtual void drawDisabled(SCRect inDamage);
	virtual void drawDragHilite(SCRect inDamage);
	virtual void drawIfNecessary(SCRect inDamage);
	virtual void mouseBeginTrack(SCPoint where, int modifiers,NSEvent *theEvent);
	virtual void mouseTrack(SCPoint where, int modifiers,NSEvent *theEvent);
	virtual void mouseEndTrack(SCPoint where, int modifiers,NSEvent *theEvent);
	virtual void mouseOver(SCPoint where);
	virtual void keyDown(int character, int modifiers, unsigned short keycode);
	virtual void keyUp(int character, int modifiers, unsigned short keycode);
	virtual bool shouldDim();
	void beginDrag(SCPoint where);
	
	virtual bool canReceiveDrag();
	virtual void receiveDrag();
	
	bool isFocus() const;
	bool hit(SCPoint p) const;
	void refresh();
	void refreshFocus();
	void setDragHilite(bool inFlag);
	
	virtual int setProperty(PyrSymbol *symbol, PyrSlot *slot);
	virtual int getProperty(PyrSymbol *symbol, PyrSlot *slot);
	
	virtual bool isDragSource() const;
	virtual SCView* findView(SCPoint where);
	virtual SCView* findViewByID(int32 inID);
	virtual void makeFocus(bool focus);
	virtual SCView* nextFocus(bool *foundFocus, bool canFocus);
	virtual SCView* prevFocus(SCView **prevView, bool canFocus);
	virtual bool canFocus();

	void sendMessage(PyrSymbol *method, int numargs, PyrSlot *args, PyrSlot *result);

	virtual void setBounds(SCRect inBounds);
	virtual SCRect getBounds();
	virtual Layout getLayout();
	
	SCView* next() { return mNext; }
	SCContainerView* parent() { return mParent; }
	
	virtual NSMenu* contextMenu(SCPoint inPoint);
	
	virtual void setMenuItemChosen(int inItem) {}
	
	PyrObject* GetSCObj() { return mObj; }
	SCView* NextAnimatedView() const { return mNextAnimatedView; }
	
	void startAnimation();
	void stopAnimation();
	virtual void animate() { refresh(); }
	
protected:
	friend class SCContainerView;

	SCView *mNext;
	SCView *mNextAnimatedView;
	SCView *mPrevAnimatedView;
	SCContainerView *mParent;
	SCTopView *mTop;
	PyrObject* mObj;
	SCRect mBounds;
	Layout mLayout;
	DrawBackground* mBackground;
	bool mVisible;
	bool mEnabled;
	bool mCanFocus;
	bool mDragHilite;
	int32 mID;
};


class SCContainerView : public SCView
{
public:
	SCContainerView(SCContainerView *inParent, PyrObject* inObj, SCRect inBounds); 
	virtual ~SCContainerView();
	
	virtual void drawIfNecessary(SCRect inDamage);
	
	virtual void add(SCView *inChild);
	virtual void remove(SCView *inChild);
	virtual SCView* findView(SCPoint where);
	virtual SCView* findViewByID(int32 inID);
	virtual void makeFocus(bool focus);
	virtual SCView* nextFocus(bool *foundFocus, bool canFocus);
	virtual SCView* prevFocus(SCView **prevView, bool canFocus);
	virtual bool canFocus();
	
protected:
	SCView *mChildren;
	int mNumChildren;
};

class SCCompositeView : public SCContainerView
{
public:
	SCCompositeView(SCContainerView *inParent, PyrObject* inObj, SCRect inBounds); 
	virtual ~SCCompositeView();

	virtual void setBounds(SCRect inBounds);
	
protected:
};

class SCLayoutView : public SCContainerView
{
public:
	SCLayoutView(SCContainerView *inParent, PyrObject* inObj, SCRect inBounds); 
	virtual ~SCLayoutView();
	
	virtual int setProperty(PyrSymbol *symbol, PyrSlot *slot);
	virtual int getProperty(PyrSymbol *symbol, PyrSlot *slot);
	
protected:
    float mSpacing;
};

class SCHLayoutView : public SCLayoutView
{
public:
	SCHLayoutView(SCContainerView *inParent, PyrObject* inObj, SCRect inBounds); 
	virtual ~SCHLayoutView();

	virtual void setBounds(SCRect inBounds);
	
protected:
};

class SCVLayoutView : public SCLayoutView
{
public:
	SCVLayoutView(SCContainerView *inParent, PyrObject* inObj, SCRect inBounds); 
	virtual ~SCVLayoutView();

	virtual void setBounds(SCRect inBounds);
	
protected:
};

// tell host to draw stuff.
typedef void (*DamageCallback)(SCRect inRect, void *inData);
typedef void (*DragCallback)(SCPoint where, PyrSlot* inSlot, void *inData);

class SCTopView : public SCCompositeView
{
public:
	SCTopView(PyrObject* inObj, SCRect inBounds);
	
	SCView *focusView() { return mFocusView; }

	void resetFocus();
	void addDamage(SCRect inRect);
	void beginDragCallback(SCPoint where, PyrSlot* slot);
	
	void setDamageCallback(DamageCallback inFunc, void *inHostData)
            { mDamageCallback = inFunc; mHostData = inHostData; }
	void setDragCallback(DragCallback inFunc)
            { mDragCallback = inFunc; }
	
	void tabNextFocus();
	void tabPrevFocus();
	void setDragView(SCView *inView);
		
		NSView* GetNSView() { return mNSView; }
		void SetNSView(NSView* inView) { mNSView = inView; }
	
		bool ConstructionMode() { return mConstructionMode; }
		void SetConstructionMode(bool inFlag) { mConstructionMode = inFlag; }
		
	virtual void drawFocus(SCRect inDamage);
		
protected:
	friend class SCView;
	void focusIs(SCView *inView) { mFocusView = inView; }

	DamageCallback mDamageCallback;
	DragCallback mDragCallback;
	void *mHostData;
	SCView *mFocusView;
	SCView *mDragView;
		NSView *mNSView;
		
		bool mConstructionMode;
};

inline bool SCView::isFocus() const { return mTop->focusView() == this; }

class SCSlider : public SCView
{
public:	
	SCSlider(SCContainerView *inParent, PyrObject* inObj, SCRect inBounds); 

	virtual void draw(SCRect inDamage);
	virtual void mouseTrack(SCPoint where, int modifiers,NSEvent *theEvent);
	
	double value() { return mValue; }
	bool setValue(double inValue, bool send);

	virtual int setProperty(PyrSymbol *symbol, PyrSlot *slot);
	virtual int getProperty(PyrSymbol *symbol, PyrSlot *slot);

	virtual bool canReceiveDrag();
	virtual void receiveDrag();

protected:
	virtual void setValueFromPoint(SCPoint point);
	void calcThumbRect();
	
	SCRect mThumbRect;
	double mValue, mStepSize, mStepScale;
	DrawBackground* mKnob;
};
SCView* NewSCSlider(SCContainerView *inParent, PyrObject* inObj, SCRect inBounds);


class SCRangeSlider : public SCView
{
public:	
	SCRangeSlider(SCContainerView *inParent, PyrObject* inObj, SCRect inBounds); 

	virtual void draw(SCRect inDamage);
	virtual void mouseBeginTrack(SCPoint where, int modifiers,NSEvent *theEvent);
	virtual void mouseTrack(SCPoint where, int modifiers,NSEvent *theEvent);
	
	bool setValue(double inLo, double inHi, bool send);

	virtual int setProperty(PyrSymbol *symbol, PyrSlot *slot);
	virtual int getProperty(PyrSymbol *symbol, PyrSlot *slot);

	virtual bool canReceiveDrag();
	virtual void receiveDrag();

protected:
	virtual void setValueFromPoint(SCPoint point);
    // sc.solar addition
	void moveRangeFromPoint(SCPoint point);
	void adjustLoFromPoint(SCPoint point);
	void adjustHiFromPoint(SCPoint point);
    // sc.solar addition end
	void calcRangeRect();
	
	SCRect mRangeRect;
	double mLo, mHi, mStepSize, mStepScale;
	SCPoint mAnchor;
	DrawBackground* mKnob;
};
SCView* NewSCRangeSlider(SCContainerView *inParent, PyrObject* inObj, SCRect inBounds);



class SC2DSlider : public SCView
{
public:	
	SC2DSlider(SCContainerView *inParent, PyrObject* inObj, SCRect inBounds); 

	virtual void draw(SCRect inDamage);
	virtual void mouseTrack(SCPoint where, int modifiers,NSEvent *theEvent);
	
	virtual bool setValue(double inLo, double inHi, bool send);

	virtual int setProperty(PyrSymbol *symbol, PyrSlot *slot);
	virtual int getProperty(PyrSymbol *symbol, PyrSlot *slot);

	virtual bool canReceiveDrag();
	virtual void receiveDrag();

protected:
	virtual void setValueFromPoint(SCPoint point);
	void calcThumbRect();
	
	SCRect mThumbRect;
	double mX, mY;
	double mStepSize, mStepScale;
	DrawBackground* mKnob;
};
SCView* NewSC2DSlider(SCContainerView *inParent, PyrObject* inObj, SCRect inBounds);


class SC2DTabletSlider : public SC2DSlider
{
public:	
	SC2DTabletSlider(SCContainerView *inParent, PyrObject* inObj, SCRect inBounds);

	virtual void mouseBeginTrack(SCPoint where, int modifiers,NSEvent *theEvent);
	virtual void mouseTrack(SCPoint where, int modifiers,NSEvent *theEvent);
	virtual void mouseEndTrack(SCPoint where, int modifiers,NSEvent *theEvent);
    
    virtual int setProperty(PyrSymbol *symbol, PyrSlot *slot);

    virtual bool setValue(double inX, double inY,bool send);

protected:	
    int mClipInBounds;

};
SCView* NewSC2DTabletSlider(SCContainerView *inParent, PyrObject* inObj, SCRect inBounds);


#include "SC_SndBuf.h"

const int kMaxScopeChannels = 16;
class SCScope : public SCView
{
public:	
	SCScope(SCContainerView *inParent, PyrObject* inObj, SCRect inBounds); 
	virtual ~SCScope();
	
	virtual void draw(SCRect inDamage);
	virtual void draw0(CGContextRef cgc);
	virtual void draw1(CGContextRef cgc);
	virtual void draw2(CGContextRef cgc);
	virtual void mouseTrack(SCPoint where, int modifiers,NSEvent *theEvent);
	virtual void animate();
	
	virtual int setProperty(PyrSymbol *symbol, PyrSlot *slot);
	virtual int getProperty(PyrSymbol *symbol, PyrSlot *slot);

	SCPoint pixelToUnits(SCPoint p, SCRect r) 
            { 
                return SCMakePoint(
                    (p.x - r.x) * mZoom.x + mScroll.x,
                    (p.y - r.y) * mZoom.y + mScroll.y);
            }
	SCPoint unitsToPixel(SCPoint u, SCRect r) 
            {
                return SCMakePoint(
                    (u.x - mScroll.x) * mInvZoom.x + r.x,
                    (u.y - mScroll.y) * mInvZoom.y + r.y);
            }

protected:
	
	int mBufNum;
	SndBuf mSndBuf;
	SCPoint mZoom, mInvZoom, mScroll;
	int mStyle; // 0 = separate, 1 = overlay, 2 = x,y.
	SCColor mWaveColors[kMaxScopeChannels];
	SCColor mGridColor;
	bool mGridOn;
};
SCView* NewSCScope(SCContainerView *inParent, PyrObject* inObj, SCRect inBounds);



const int kLabelSize = 64;
struct SCButtonState
{
    char mLabel[kLabelSize];
    SCColor mLabelColor;
    SCColor mButtonColor;
};

const int kFontNameSize = 80;

class SCButton : public SCView
{
public:	
	SCButton(SCContainerView *inParent, PyrObject* inObj, SCRect inBounds); 
	virtual ~SCButton();

	virtual void draw(SCRect inDamage);
	virtual void mouseTrack(SCPoint where, int modifiers,NSEvent *theEvent);
    virtual void mouseEndTrack(SCPoint where, int modifiers,NSEvent *theEvent);

	bool setValue(int inValue, bool send);

	virtual int setProperty(PyrSymbol *symbol, PyrSlot *slot);
	virtual int getProperty(PyrSymbol *symbol, PyrSlot *slot);

	virtual bool canReceiveDrag();
	virtual void receiveDrag();

protected:
	
	int mValue;
	char mFontName[kFontNameSize];
	float mFontSize;
	int mNumStates;
	SCButtonState *mStates;
	bool mPushed;
};
SCView* NewSCButton(SCContainerView *inParent, PyrObject* inObj, SCRect inBounds);


class SCPopUpMenu : public SCView
{
public:	
	SCPopUpMenu(SCContainerView *inParent, PyrObject* inObj, SCRect inBounds); 
	virtual ~SCPopUpMenu();

	virtual void draw(SCRect inDamage);
	virtual void mouseBeginTrack(SCPoint where, int modifiers,NSEvent *theEvent);
	
	bool setValue(int inValue, bool send);
	virtual void setMenuItemChosen(int inItem) { setValue(inItem, true); }

	virtual int setProperty(PyrSymbol *symbol, PyrSlot *slot);
	virtual int getProperty(PyrSymbol *symbol, PyrSlot *slot);

	virtual bool canReceiveDrag();
	virtual void receiveDrag();

protected:
	
	int mValue;
	MenuHandle mMenuH;
	char mFontName[kFontNameSize];
	float mFontSize;
	SCColor mStringColor;
};
SCView* NewSCPopUpMenu(SCContainerView *inParent, PyrObject* inObj, SCRect inBounds);


class SCListView : public SCView
{
public:	
	SCListView(SCContainerView *inParent, PyrObject* inObj, SCRect inBounds); 
	virtual ~SCListView();

	virtual void draw(SCRect inDamage);
	virtual void mouseBeginTrack(SCPoint where, int modifiers,NSEvent *theEvent);
	virtual void mouseTrack(SCPoint where, int modifiers, NSEvent *theEvent);
	
	bool setValue(int inValue, bool send);

	virtual int setProperty(PyrSymbol *symbol, PyrSlot *slot);
	virtual int getProperty(PyrSymbol *symbol, PyrSlot *slot);

	virtual bool canReceiveDrag();
	virtual void receiveDrag();
	
	void scrollToValue();

protected:
	
	int mValue;
	CFMutableArrayRef mArray;
	char mFontName[kFontNameSize];
	float mFontSize;
	float mScroll;
	float mAnchorScroll;
	SCPoint mAnchor;
	SCColor mStringColor;
	SCColor mSelectedStringColor;
	SCColor mHiliteColor;
    int mAlignment;
	NSSize mStrSize;
	bool mScrolling;
};
SCView* NewSCListView(SCContainerView *inParent, PyrObject* inObj, SCRect inBounds);

//by jan trutzschler (jt@kandos.de)
class SCMultiSliderView : public SCView
{
public:	
	SCMultiSliderView(SCContainerView *inParent, PyrObject* inObj, SCRect inBounds); 
	virtual ~SCMultiSliderView();

	virtual void draw(SCRect inDamage);
	virtual void mouseBeginTrack(SCPoint where, int modifiers,NSEvent *theEvent);
    virtual void mouseEndTrack(SCPoint where, int modifiers,NSEvent *theEvent);
	virtual void mouseTrack(SCPoint where, int modifiers,NSEvent *theEvent);
	
    void setSelection(SCPoint where);
	bool setValue(int inX, double inY, bool send);
	//virtual void setPoint(int x, double y, bool send);
	virtual int setProperty(PyrSymbol *symbol, PyrSlot *slot);
	virtual int getProperty(PyrSymbol *symbol, PyrSlot *slot);
	void setVisibleSize();
	virtual bool canReceiveDrag();
	virtual void receiveDrag();

protected:
	int indexFromPoint(SCPoint where);
//	int getVisibleMax();

	double valueFromPoint(SCPoint where);
	void setValueFromPoint(SCPoint point);
	SCRect calcThumbRect(int xIn, double valIn, double step);
	int mThumbSize, mThumbSizeY; // size of the rect
	int mTabSize, mVisibleSize; // size of the table
	SCColor mFillColor;
	SCColor mStrokeColor;
	SCRect mThumbRect;
	double mCurrentY, mCurrentX;
	int mCurrentIndex, mStartIndex, mSelectionSize;
	double mStepSize, mStepScale;
	double * mYValues;
	double * mSecYValues;
	DrawBackground* mKnob;
	float mXOffset ; //space between points
	bool mReadOnly, mDrawLinesActive, mShowIndex, mDrawRectsActive, mIsHorizontal, mIsFilled;
	SCPoint mPrevPoint;
	int mElasticMode;
	double mElasticIndexStep;
	
};
SCView* NewSCMultiSliderView(SCContainerView *inParent, PyrObject* inObj, SCRect inBounds);
////
//by jan truetzschler jt@kandos.de
struct SCEnvObject {
    SCColor mColor; //changes between selected and mObjectColor
	SCColor mObjectColor; //if its not selected
    SCRect mRect;
	int mNumConnection;
    SCPoint mDrawPoint;
	double * mConnections; //tells to where it is connected
	int mNumInputs, mNumOutputs; 
	double x, y;
    bool mIsSelected, mIsVisible, mIsStatic;
	char *mString;	
};
typedef struct SCEnvObject SCEnvObject;

class SCEnvelopeView : public SCView
{
public:	
	SCEnvelopeView(SCContainerView *inParent, PyrObject* inObj, SCRect inBounds); 
	virtual ~SCEnvelopeView();
	virtual void draw(SCRect inDamage);
	virtual void mouseBeginTrack(SCPoint where, int modifiers,NSEvent *theEvent);
	virtual void mouseEndTrack(SCPoint where, int modifiers,NSEvent *theEvent);
	virtual void mouseTrack(SCPoint where, int modifiers,NSEvent *theEvent);
    
	void setSelection(SCPoint where, bool fixed, bool checkForConnection);
	virtual int setProperty(PyrSymbol *symbol, PyrSlot *slot);
	virtual int getProperty(PyrSymbol *symbol, PyrSlot *slot);
	virtual bool canReceiveDrag();
	virtual void receiveDrag();

protected:

	void setValueFromPoint(SCPoint point);
	bool setValue(SCEnvObject * envob, double x, double y, bool send);
	int allocSlotEnvObjArray(PyrSlot *slot, SCEnvObject **arr);
	bool setEnvRect(double valX, double valY, SCEnvObject * envobIn);

	int mThumbSize, mThumbSizeY; // size of the rect
	int mTabSize, mVisibleSize, mActiveSize; // size of the table
	SCColor mFillColor, mSelectedColor, mStrokeColor;
	SCRect mThumbRect;
	double mCurrentY, mCurrentX, mAbsoluteX;
	int mCurrentIndex, mStartIndex, mSelectionSize, mLastIndex;
	double mStepSize, mStepScale;
	SCEnvObject * mEnvObj;
	//DrawBackground* mKnob;
	bool  mDrawLinesActive, mShowIndex, mDrawRectsActive, mIsFilled, mIsFixedSelection, mIsEnvView;
	int mSelectedIndex;
	SCPoint mMousePoint;

	double xGridMultiplier;

	//draw string in box
    char mFontName[kFontNameSize];
    float mFontSize;
    SCColor mStringColor;
    int mAlignment;
	bool mDrawCenteredConnection;
	
    
};
SCView* NewSCEnvelopeView(SCContainerView *inParent, PyrObject* inObj, SCRect inBounds);


//

class SCUserView : public SCView
{
public:	
	SCUserView(SCContainerView *inParent, PyrObject* inObj, SCRect inBounds); 

	virtual void draw(SCRect inDamage);
	virtual void mouseBeginTrack(SCPoint where, int modifiers,NSEvent *theEvent);
	virtual void mouseTrack(SCPoint where, int modifiers,NSEvent *theEvent);
	virtual void mouseEndTrack(SCPoint where, int modifiers,NSEvent *theEvent);	
    virtual void keyDown(int character, int modifiers);
	virtual void keyUp(int character, int modifiers);
	
protected:
	void mouseAction(PyrSymbol *method, SCPoint where, int modifiers);
};
SCView* NewSCUserView(SCContainerView *inParent, PyrObject* inObj, SCRect inBounds);


enum {
    kSCAlignLeft = -1,
    kSCAlignCenter,
    kSCAlignRight
};

class SCStaticText : public SCView
{
public:	
	SCStaticText(SCContainerView *inParent, PyrObject* inObj, SCRect inBounds); 
	virtual ~SCStaticText();
	
	virtual void draw(SCRect inDamage);
	virtual bool shouldDim();

	virtual int setProperty(PyrSymbol *symbol, PyrSlot *slot);
	virtual int getProperty(PyrSymbol *symbol, PyrSlot *slot);
	
protected:
	virtual void drawString(SCRect bounds);

    char *mString;
    char mFontName[kFontNameSize];
    float mFontSize;
    SCColor mStringColor;
    int mAlignment;

};
SCView* NewSCStaticText(SCContainerView *inParent, PyrObject* inObj, SCRect inBounds);

class SCNumberBox : public SCStaticText
{
public:	
	SCNumberBox(SCContainerView *inParent, PyrObject* inObj, SCRect inBounds); 
	virtual ~SCNumberBox();
	
	virtual void draw(SCRect inDamage);
	virtual bool shouldDim();

	virtual void mouseTrack(SCPoint where, int modifiers,NSEvent *theEvent);
	//virtual void mouseEndTrack(SCPoint where, int modifiers);
	
	virtual int setProperty(PyrSymbol *symbol, PyrSlot *slot);
	virtual int getProperty(PyrSymbol *symbol, PyrSlot *slot);

	virtual bool canReceiveDrag();
	virtual void receiveDrag();

protected:
    SCColor mBoxColor;
};
SCView* NewSCNumberBox(SCContainerView *inParent, PyrObject* inObj, SCRect inBounds);

class SCDragSource : public SCStaticText
{
public:	
	SCDragSource(SCContainerView *inParent, PyrObject* inObj, SCRect inBounds); 
	virtual ~SCDragSource();
	
	virtual void draw(SCRect inDamage);
	virtual bool shouldDim();
	virtual void mouseBeginTrack(SCPoint where, int modifiers,NSEvent *theEvent);
	
protected:
};
SCView* NewSCDragSource(SCContainerView *inParent, PyrObject* inObj, SCRect inBounds);


class SCDragSink : public SCStaticText
{
public:	
	SCDragSink(SCContainerView *inParent, PyrObject* inObj, SCRect inBounds); 
	virtual ~SCDragSink();
	
	virtual void draw(SCRect inDamage);
	virtual bool shouldDim();
	
	virtual bool canReceiveDrag();
	virtual void receiveDrag();
	
protected:
};
SCView* NewSCDragSink(SCContainerView *inParent, PyrObject* inObj, SCRect inBounds);


class SCDragBoth : public SCDragSink
{
public:	
	SCDragBoth(SCContainerView *inParent, PyrObject* inObj, SCRect inBounds); 
	
	virtual void draw(SCRect inDamage);

	virtual void mouseBeginTrack(SCPoint where, int modifiers,NSEvent *theEvent);

protected:
};
SCView* NewSCDragBoth(SCContainerView *inParent, PyrObject* inObj, SCRect inBounds);


//felix
class SCTabletView : public SCView
{
public:	
	SCTabletView(SCContainerView *inParent, PyrObject* inObj, SCRect inBounds); 
	virtual ~SCTabletView();
    
	virtual int setProperty(PyrSymbol *symbol, PyrSlot *slot);

	virtual void mouseBeginTrack(SCPoint where, int modifiers,NSEvent *theEvent);
	virtual void mouseTrack(SCPoint where, int modifiers,NSEvent *theEvent);
	virtual void mouseEndTrack(SCPoint where, int modifiers,NSEvent *theEvent);
protected:
    int mClipToBounds;
};
SCView* NewSCTabletView(SCContainerView *inParent, PyrObject* inObj, SCRect inBounds);