diff options
Diffstat (limited to 'sc4pd/headers/app')
22 files changed, 1831 insertions, 0 deletions
diff --git a/sc4pd/headers/app/AIAttributedStringAdditions.h b/sc4pd/headers/app/AIAttributedStringAdditions.h new file mode 100644 index 0000000..ae81326 --- /dev/null +++ b/sc4pd/headers/app/AIAttributedStringAdditions.h @@ -0,0 +1,39 @@ +/*-------------------------------------------------------------------------------------------------------*\ +| Adium, Copyright (C) 2001-2003, Adam Iser (adamiser@mac.com | http://www.adiumx.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 <Cocoa/Cocoa.h> +#import <Foundation/Foundation.h> + +@interface NSMutableAttributedString (AIAttributedStringAdditions) + +- (void)appendString:(NSString *)aString withAttributes:(NSDictionary *)attrs; +- (NSData *)dataRepresentation; +- (NSAttributedString *)safeString; +- (unsigned int)replaceOccurrencesOfString:(NSString *)target withString:(NSString*)replacement options:(unsigned)opts range:(NSRange)searchRange; +- (unsigned int)replaceOccurrencesOfString:(NSString *)target withString:(NSString*)replacement attributes:(NSDictionary*)attributes options:(unsigned)opts range:(NSRange)searchRange; +- (void)adjustColorsToShowOnBackground:(NSColor *)backgroundColor; +- (void)adjustColorsToShowOnBackgroundRelativeToOriginalBackground:(NSColor *)backgroundColor; +@end + +@interface NSAttributedString (AIAttributedStringAdditions) + +- (float)heightWithWidth:(float)width; +- (NSData *)dataRepresentation; ++ (NSAttributedString *)stringWithData:(NSData *)inData; +- (NSAttributedString *)safeString; + +@end + + diff --git a/sc4pd/headers/app/AIColorAdditions.h b/sc4pd/headers/app/AIColorAdditions.h new file mode 100644 index 0000000..6af9dc8 --- /dev/null +++ b/sc4pd/headers/app/AIColorAdditions.h @@ -0,0 +1,39 @@ +/*-------------------------------------------------------------------------------------------------------*\ +| Adium, Copyright (C) 2001-2003, Adam Iser (adamiser@mac.com | http://www.adiumx.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 <Cocoa/Cocoa.h> +#import <Foundation/Foundation.h> + +@interface NSString (AIColorAdditions) + +- (NSColor *)hexColor; +- (NSColor *)representedColor; +- (NSColor *)representedColorWithAlpha:(float)alpha; + +@end + +@interface NSColor (AIColorAdditions) + +- (BOOL)equalToRGBColor:(NSColor *)inColor; +- (BOOL)colorIsDark; +- (NSColor *)darkenBy:(float)amount; +- (NSString *)hexString; +- (NSString *)stringRepresentation; +- (void)getHue:(float *)hue luminance:(float *)luminance saturation:(float *)saturation; ++ (NSColor *)colorWithCalibratedHue:(float)hue luminance:(float)luminance saturation:(float)saturation alpha:(float)alpha; +- (NSColor *)colorWithInvertedLuminance; +- (NSColor *)adjustHue:(float)dHue saturation:(float)dSat brightness:(float)dBrit; + +@end diff --git a/sc4pd/headers/app/AIHTMLDecoder.h b/sc4pd/headers/app/AIHTMLDecoder.h new file mode 100644 index 0000000..492d663 --- /dev/null +++ b/sc4pd/headers/app/AIHTMLDecoder.h @@ -0,0 +1,28 @@ +/*-------------------------------------------------------------------------------------------------------*\ +| Adium, Copyright (C) 2001-2003, Adam Iser (adamiser@mac.com | http://www.adiumx.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 <Cocoa/Cocoa.h> +#import <Foundation/Foundation.h> +#import "AIStringAdditions.h" + +@interface AIHTMLDecoder : NSObject { + +} + ++ (NSAttributedString *)decodeHTML:(NSString *)inMessage; ++ (NSString *)encodeHTML:(NSAttributedString *)inMessage encodeFullString:(BOOL)encodeFullString; ++ (NSString *)encodeHTML:(NSAttributedString *)inMessage headers:(BOOL)includeHeaders fontTags:(BOOL)includeFontTags closeFontTags:(BOOL)closeFontTags styleTags:(BOOL)includeStyleTags closeStyleTagsOnFontChange:(BOOL)closeStyleTagsOnFontChange encodeNonASCII:(BOOL)encodeNonASCII; + +@end diff --git a/sc4pd/headers/app/AIStringAdditions.h b/sc4pd/headers/app/AIStringAdditions.h new file mode 100644 index 0000000..b0a5a64 --- /dev/null +++ b/sc4pd/headers/app/AIStringAdditions.h @@ -0,0 +1,25 @@ +/*-------------------------------------------------------------------------------------------------------*\ +| Adium, Copyright (C) 2001-2003, Adam Iser (adamiser@mac.com | http://www.adiumx.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 <Cocoa/Cocoa.h> +#import <Foundation/Foundation.h> + +@interface NSString (AIStringAdditions) +- (NSString *)compactedString; +- (int)intValueFromHex; +- (NSString *)stringByExpandingBundlePath; +- (NSString *)stringByCollapsingBundlePath; +- (NSString *)stringByTruncatingTailToWidth:(float)inWidth; +@end diff --git a/sc4pd/headers/app/AITextAttributes.h b/sc4pd/headers/app/AITextAttributes.h new file mode 100644 index 0000000..02b0754 --- /dev/null +++ b/sc4pd/headers/app/AITextAttributes.h @@ -0,0 +1,44 @@ +/*-------------------------------------------------------------------------------------------------------*\ +| Adium, Copyright (C) 2001-2003, Adam Iser (adamiser@mac.com | http://www.adiumx.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 <Cocoa/Cocoa.h> +#import <Foundation/Foundation.h> + +#define AIBodyColorAttributeName @"AIBodyColor" + +@interface AITextAttributes : NSObject { + + NSMutableDictionary *dictionary; + + NSString *fontFamilyName; + NSFontTraitMask fontTraitsMask; + int fontSize; + +} + ++ (id)textAttributesWithFontFamily:(NSString *)inFamilyName traits:(NSFontTraitMask)inTraits size:(int)inSize; +- (void)dealloc; +- (void)setFontFamily:(NSString *)inName; +- (void)setFontSize:(int)inSize; +- (void)enableTrait:(NSFontTraitMask)inTrait; +- (void)disableTrait:(NSFontTraitMask)inTrait; +- (NSDictionary *)dictionary; +- (void)setUnderline:(BOOL)inUnderline; +- (void)setTextColor:(NSColor *)inColor; +- (void)setTextBackgroundColor:(NSColor *)inColor; +- (void)setBackgroundColor:(NSColor *)inColor; +- (void)setLinkURL:(NSString *)inURL; + +@end diff --git a/sc4pd/headers/app/ChangeCounter.h b/sc4pd/headers/app/ChangeCounter.h new file mode 100644 index 0000000..db74fe5 --- /dev/null +++ b/sc4pd/headers/app/ChangeCounter.h @@ -0,0 +1,30 @@ +/* + 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 +*/ + +class ChangeCounter +{ + int changes, updates; +public: + ChangeCounter() { changes = updates = 0; } + bool NeedsUpdate() { return changes != updates; } + void Update() { updates = changes; } + void Change() { changes++; } +}; + diff --git a/sc4pd/headers/app/ControlSpec.h b/sc4pd/headers/app/ControlSpec.h new file mode 100644 index 0000000..7446759 --- /dev/null +++ b/sc4pd/headers/app/ControlSpec.h @@ -0,0 +1,36 @@ +/* + 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 +*/ + +/* +struct ControlSpec { + float minval, maxval, initial; + int numticks; + bool constrained; + + ControlSpec(); +}; + +inline ControlSpec() + : minval(0.), maxval(1.), initial(0.), numticks(11), constrained(false) +{ +} + + +*/
\ No newline at end of file diff --git a/sc4pd/headers/app/DrawBackground.h b/sc4pd/headers/app/DrawBackground.h new file mode 100644 index 0000000..e5fe040 --- /dev/null +++ b/sc4pd/headers/app/DrawBackground.h @@ -0,0 +1,83 @@ +/* + 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 "SCGeom.h" + +class DrawBackground +{ +public: + DrawBackground(); + virtual void draw(CGContextRef cgc, CGRect rect); + virtual void drawSelf(CGContextRef cgc, CGRect rect); +}; + + +class SolidColorBackground : public DrawBackground +{ +public: + SolidColorBackground(SCColor inColor); + virtual void drawSelf(CGContextRef cgc, CGRect rect); +private: + SCColor mColor; +}; + +enum { + grad_Horizontal, + grad_Vertical, + grad_Narrow, + grad_Wide +}; + +class GradientBackground : public DrawBackground +{ +public: + GradientBackground(SCColor inStartColor, SCColor inEndColor, int inDirection, int inSteps); + virtual void drawSelf(CGContextRef cgc, CGRect rect); + +protected: + SCColor mStartColor, mEndColor; + int mDirection, mSteps; +}; + +class HiliteGradientBackground : public GradientBackground +{ +public: + HiliteGradientBackground(SCColor inStartColor, SCColor inEndColor, int inDirection, int inSteps, float inFrac = .33); + + virtual void drawSelf(CGContextRef cgc, CGRect rect); + +protected: + float mFrac, mFrac1; +}; + +/* +class TiledBackground : public DrawBackground +{ +public: + TiledBackground(NSImage* inTile); + + virtual void drawSelf(CGContextRef cgc, CGRect rect); + +protected: + NSImage* mTile; + CGRect mTiledBounds; +}; + +*/ diff --git a/sc4pd/headers/app/GetStringFromUser.h b/sc4pd/headers/app/GetStringFromUser.h new file mode 100644 index 0000000..0e13d71 --- /dev/null +++ b/sc4pd/headers/app/GetStringFromUser.h @@ -0,0 +1,46 @@ +/* + 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 <Cocoa/Cocoa.h> + +@interface GetStringFromUser : NSObject { + NSString *string; + id textField; + id promptField; + id okButton; + id cancelButton; +} + ++ (id)sharedInstance; + +/* Loads UI lazily */ +- (NSPanel *)getStringPanel; + +- (NSString *)string; +- (void)setString:(NSString *)string; + +- (void)setPrompt:(NSString *)string; + +/* Action methods, sent from the find panel UI; can also be connected to menu items */ +- (void)ok:(id)sender; +- (void)cancel:(id)sender; + +@end diff --git a/sc4pd/headers/app/GoToPanel.h b/sc4pd/headers/app/GoToPanel.h new file mode 100644 index 0000000..6808884 --- /dev/null +++ b/sc4pd/headers/app/GoToPanel.h @@ -0,0 +1,52 @@ +/* + * GoToPanel.M + * SC3lang + * + * Created by j. trutzschler on 02 sept 2003. + derived from TextFinder.m by Ali Ozer + + a panel that searches and selects a line + + 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 <Cocoa/Cocoa.h> + +@interface GoToPanel : NSObject { + id findTextField; + id okButton; +} + +/* Common way to get a text finder. One instance of TextFinder per app is good enough. */ ++ (id)sharedInstance; + +/* Main method for external users; does a find in the first responder. Selects found range or beeps. */ +- (void)selectLine:(id)sender; +- (void) getAndDisplayCurrentLine; +- (void)prselectLine:(int)linenum; + +/* Loads UI lazily */ +- (NSPanel *)gotoLinePanel; + +/* Gets the first responder and returns it if it's an NSTextView */ +- (NSTextView *)textObjectToSelectIn; + +- (void)orderFrontGotoLinePanel:(id)sender; + +/* Misc internal methods */ +- (void)appDidActivate:(NSNotification *)notification; + + +@end diff --git a/sc4pd/headers/app/MyDocument.h b/sc4pd/headers/app/MyDocument.h new file mode 100644 index 0000000..d52eabc --- /dev/null +++ b/sc4pd/headers/app/MyDocument.h @@ -0,0 +1,107 @@ +/* + 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 <Cocoa/Cocoa.h> +#import "UserPanel.h" +#include "PyrObject.h" +#include "PyrKernel.h" +#include "GC.h" +#include "VMGlobals.h" + +extern pthread_mutex_t gLangMutex; +extern PyrSymbol *s_closed; + +@interface MyDocument : NSDocument +{ + IBOutlet NSTextView* initTextView; + IBOutlet NSTextView* textView; + IBOutlet NSScrollView* scrollView; + Boolean isRichText; + struct PyrObject *mWindowObj; +} + + +- (NSTextView*)makeTextView; +- (NSTextView*) textView; + +- (void)windowControllerDidLoadNib:(NSWindowController*) aController; + +- (void)addDocument; + +- (IBAction)openCode:(id)sender; +- (IBAction)methodTemplates: (id)sender; +- (IBAction)methodReferences: (id)sender; + +- (IBAction)balanceParens: (id)sender; + +- (IBAction)syntaxColorize: (id)sender; +- (void) insertText: (char*) text length: (int)length; +- (IBAction)shiftLeft: (id)sender; +- (IBAction)shiftRight: (id)sender; +- (IBAction)commentCode: (id)sender; +- (IBAction)uncommentCode:(id)sender; + +- (IBAction) executeSelection: (id) sender; +- (NSString*)currentlySelectedTextOrLine: (NSRange*) outRange; +-(void)selectRangeStart:(int)rangeStart size:(int)rangeSize; + +- (IBAction) showHelp: (id) sender; + +- (BOOL) textView: (NSTextView *) textView + clickedOnLink: (id) link + atIndex: (unsigned) charIndex; +- (IBAction) createLink: (id) sender; + +- (void)sendSelection: (char*) methodName; + +- (NSString *)windowNibName; + +- (BOOL)writeToFile:(NSString*) path ofType:(NSString *)aType; +- (BOOL)readFromFile:(NSString *)path ofType:(NSString *)aType; + +- (BOOL) shouldRunSavePanelWithAccessoryView; + +- (BOOL)windowShouldClose:(id)sender; +- (void)windowWillClose:(NSNotification *)aNotification; +- (IBAction) becomePostWindow: (id) sender; +- (BOOL) isDocumentEdited; + +- (void)doToggleRich; +// toggleRich: puts up an alert before ultimately calling doToggleRich +- (IBAction)toggleRich:(id)sender; +- (void)setRichText:(BOOL)flag; + +- (BOOL)validateMenuItem:(NSMenuItem *)aCell; + +- (void)setSCObject: (struct PyrObject*)inObject; +- (struct PyrObject*)getSCObject; +- (void) closeWindow; +- (void)setBackgroundColor:(NSColor *)color; +- (NSScrollView*) scrollView; +- (NSTextView*) initTextView; +-(void)selectLine:(int)linenum; +- (IBAction)selectLineWindow: (id) sender; +- (void) callSCLangWithMethod: (PyrSymbol*) method; + +@end + +NSString* pathOfHelpFileFor(NSString* selection); +void showHelpFor(NSString* selection); + diff --git a/sc4pd/headers/app/RendezvousClient.h b/sc4pd/headers/app/RendezvousClient.h new file mode 100644 index 0000000..e66f518 --- /dev/null +++ b/sc4pd/headers/app/RendezvousClient.h @@ -0,0 +1,39 @@ +// +// RendezvousClient.h +// SC3lang +// +// Created by C. Ramakrishnan on Mon Feb 24 2003. +// Copyright (c) 2003 __MyCompanyName__. All rights reserved. +// + +#import <Foundation/Foundation.h> + +@interface OSCService : NSObject { +// a glorified struct (declared as an Obj-C class so I can put it in NSArrays) +// stored in the oscServices ivar of RendezvousClient +@public + NSNetService* netService; + BOOL isResolved; + NSString* hostName; + const struct sockaddr_in* sockaddr; + unsigned hostAddress; + unsigned short port; + int refCount; +} + +@end + +@interface RendezvousClient : NSObject { + NSNetServiceBrowser* browser; + NSMutableArray* oscServices; +} + ++ (RendezvousClient*)sharedClient; + +// interface +- (void)findOSCServices; +- (OSCService*)oscServiceAtIndex:(unsigned)index; +- (unsigned)numberOfOSCServices; + +@end + diff --git a/sc4pd/headers/app/SCDialog.h b/sc4pd/headers/app/SCDialog.h new file mode 100644 index 0000000..fdebdbb --- /dev/null +++ b/sc4pd/headers/app/SCDialog.h @@ -0,0 +1,41 @@ +// +// SCDialogs.h +// SC3lang +// +// Created by cruxxial on Tue Dec 17 2002. +// Copyright (c) 2002 crucial-systems. All rights reserved. +// + +#import <Cocoa/Cocoa.h> + +#include "PyrPrimitive.h" +#include "PyrObject.h" +#include "PyrKernel.h" +#include "VMGlobals.h" +#include "GC.h" +#include "PyrSched.h" +#import "SCVirtualMachine.h" + +@interface SCDialog : NSObject { + PyrObject *receiver; + PyrObject *result; + NSOpenPanel *openPanel; +} + ++(id)receiver:(PyrObject*)argReceiver result:(PyrObject*)argResult; +-(id)initWithReceiver:(PyrObject*)argReceiver result:(PyrObject*)argResult; + +-(void)ok; +-(void)cancel; +-(void)error; + +-(void)returnPaths:(NSArray*)urls; +-(void)getPaths; +-(void)returnPath:(NSString*)path; + + +// call method on self when SCVM is ready for sclang usage +-(void)scvmDeferWithSelector:(SEL)selector; + + +@end diff --git a/sc4pd/headers/app/SCGeom.h b/sc4pd/headers/app/SCGeom.h new file mode 100644 index 0000000..04904a4 --- /dev/null +++ b/sc4pd/headers/app/SCGeom.h @@ -0,0 +1,90 @@ +/* + 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 <Carbon/Carbon.h> +#include "SC_BoundsMacros.h" + +struct SCColor { + float red, green, blue, alpha; +}; +typedef struct SCColor SCColor; + +inline SCColor SCMakeColor(float red, float green, float blue, float alpha) +{ + SCColor sccolor; + sccolor.red = red; + sccolor.green = green; + sccolor.blue = blue; + sccolor.alpha = alpha; + return sccolor; +} + +struct SCPoint { + float x, y; +}; + +inline SCPoint SCMakePoint(float x, float y) +{ + SCPoint p; + p.x = x; + p.y = y; + return p; +} + +struct SCRect { + float x, y, width, height; +}; + +inline SCRect SCRectUnion(SCRect a, SCRect b) +{ + if (a.height <= 0. && a.width <= 0.) return b; + if (b.height <= 0. && b.width <= 0.) return a; + + SCRect u; + u.x = sc_min(a.x, b.x); + u.y = sc_min(a.y, b.y); + u.width = sc_max(a.x + a.width, b.x + b.width) - u.x; + u.height = sc_max(a.y + a.height, b.y + b.height) - u.y; + return u; +} + +inline bool SCRectsDoIntersect(SCRect a, SCRect b) +{ + if (a.x + a.width < b.x) return false; + if (a.y + a.height < b.y) return false; + if (a.x > b.x + b.width) return false; + if (a.y > b.y + b.height) return false; + return true; +} + +inline SCRect SCMakeRect(float x, float y, float width, float height) +{ + SCRect r; + r.x = x; r.y = y; r.width = width; r.height = height; + return r; +} + +inline bool SCPointInRect(SCPoint p, SCRect r) +{ + return + p.x >= r.x && p.x <= r.x + r.width + && p.y >= r.y && p.y <= r.y + r.height; + +} diff --git a/sc4pd/headers/app/SCGraphView.h b/sc4pd/headers/app/SCGraphView.h new file mode 100644 index 0000000..84b259d --- /dev/null +++ b/sc4pd/headers/app/SCGraphView.h @@ -0,0 +1,55 @@ +/* + 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 <Cocoa/Cocoa.h> +#import "SCView.h" + +@interface SCGraphView : NSView +{ + struct PyrObject *mWindowObj; + SCTopView *mTopView; + bool mDragStarted; + SCView* mMenuView; + bool windowShouldClose; +} + +- (void)drawRect: (NSRect)bounds; +- (void) keyDown: (NSEvent*) event; +- (void) keyUp: (NSEvent*) event; +- (void) mouseDown: (NSEvent*) event; +- (void)setSCObject: (struct PyrObject*)inObject; +- (struct PyrObject*)getSCObject; +- (BOOL)isFlipped; +- (BOOL)mouseDownCanMoveWindow; + +- (void)setSCTopView: (SCTopView*)inView; +//- (void)dealloc; +- (void)closeWindow; +- (void)willClose; +- (void)setWindowShouldClose:(BOOL)boo; +- (BOOL)windowShouldClose; +- (void) beginDragFrom: (NSPoint)where of: (PyrSlot*)slot; + +- (NSMenu*) menuForEvent:(NSEvent*)event; +- (void)startMenuTracking: (SCView*) inView; + +- (IBAction) toggleUIEditMode: (id) sender; + +@end diff --git a/sc4pd/headers/app/SCService.h b/sc4pd/headers/app/SCService.h new file mode 100644 index 0000000..64a78a0 --- /dev/null +++ b/sc4pd/headers/app/SCService.h @@ -0,0 +1,16 @@ +// +// SCService.h +// SC3lang +// +// Created by C. Ramakrishnan on Mon Oct 20 2003. +// Copyright (c) 2003 __MyCompanyName__. All rights reserved. +// + +#import <Foundation/Foundation.h> + + +@interface SCService : NSObject { + +} + +@end diff --git a/sc4pd/headers/app/SCTextView.h b/sc4pd/headers/app/SCTextView.h new file mode 100644 index 0000000..b1b721c --- /dev/null +++ b/sc4pd/headers/app/SCTextView.h @@ -0,0 +1,33 @@ +/* + 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 <Cocoa/Cocoa.h> + +@interface SCTextView : NSTextView +{ + +} + + - (void) keyDown: (NSEvent*) event; + - (void) mouseDown: (NSEvent*) event; + - (void) autoIndent: (NSEvent*) event; + - (void) mouseDownAction; + +@end diff --git a/sc4pd/headers/app/SCView.h b/sc4pd/headers/app/SCView.h new file mode 100644 index 0000000..a752445 --- /dev/null +++ b/sc4pd/headers/app/SCView.h @@ -0,0 +1,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); + diff --git a/sc4pd/headers/app/SCVirtualMachine.h b/sc4pd/headers/app/SCVirtualMachine.h new file mode 100644 index 0000000..354e8a5 --- /dev/null +++ b/sc4pd/headers/app/SCVirtualMachine.h @@ -0,0 +1,65 @@ +/* + 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 <Cocoa/Cocoa.h> + + +@interface SCVirtualMachine : NSObject { + NSMutableArray *deferredOperations; + NSMutableArray *guiWindows; + NSTimer *deferredTaskTimer; + NSTimer *appClockTimer; +} + ++ (id)sharedInstance; + +- (id)init; +- (void)start; +- (void)doPeriodicTask: (NSTimer*) timer; +- (void)doClockTask: (NSTimer*) timer; +- (void)setCmdLine: (const char*) text length: (int)length; +- (void)sendMain: (char*) methodName; + +- (void)defer: (NSInvocation*) action; +- (void)performDeferredOperations; +- (void)doAnimatedViews; + +- (void)addWindow: (NSWindow*)window; +- (void)closeAllGUIWindows; + +- (IBAction) runMain: (id) sender; +- (IBAction) stopMain: (id) sender; +- (IBAction) compileLibrary: (id) sender; +- (IBAction) newSCWindow: (id) sender; +- (IBAction)clearPostWindow:(id)sender; +- (void)postWindowToFront:(id)sender; + +// deferred primitives + + +- (void)becomeFullScreen: (NSWindow*)window; +- (void)endFullScreen: (NSWindow*)window; +- (void)loadUserPanel:(NSString*)filename SCObject: (void*)scobj; + + +-(IBAction)showHelp:(id)sender; + + +@end diff --git a/sc4pd/headers/app/TabletEvents.h b/sc4pd/headers/app/TabletEvents.h new file mode 100644 index 0000000..3607ab9 --- /dev/null +++ b/sc4pd/headers/app/TabletEvents.h @@ -0,0 +1,75 @@ +/*---------------------------------------------------------------------------- + +FILE NAME + +TabletEvents.h - Header file for TabletEvent Category. + This is an extension to the NSEvent class. + +COPYRIGHT + +Copyright WACOM Technology, Inc. 2001. + +All rights reserved. + +----------------------------------------------------------------------------*/ + +#import <Cocoa/Cocoa.h> +#import <Carbon/Carbon.h> + +@interface NSEvent ( TabletEvents ) + +- (void *)eventRef; +- (BOOL) isTabletPointerEvent; +- (BOOL) isTabletProximityEvent; +- (void) setLocation:(NSPoint)loc; +- (TabletPointerRec) tabletRec; +- (SInt32) absoluteX; +- (SInt32) absoluteY; +- (SInt32) absoluteZ; +- (void) getAbsoluteX:(SInt32*)absX Y:(SInt32*)absY Z:(SInt32*)absZ; +- (NSPoint) tilt; +- (UInt16) rawTabletPressure; +- (float) scaledTabletPressure; +- (float) rotationInDegrees; /* 0¡ <-> +359.9999¡ */ +- (float) rotationInRadians; /* 0 <-> 2¹ */ +- (UInt16) deviceID; + +@end + +/////////////////////////////////////////////////////////////////////////// +/* This is the name of the Notification sent when a proximity event is + captured by the application */ +extern NSString *kProximityNotification; + +/* vendor-defined ID - typically will be USB vendor ID */ +extern NSString *kVendorID; + +/* vendor-defined tablet ID */ +extern NSString *kTabletID; + +/* vendor-defined ID of the specific pointing device */ +extern NSString *kPointerID; + +/* unique device ID - matches to deviceID field in tablet event */ +extern NSString *kDeviceID; + +/* unique tablet ID */ +extern NSString *kSystemTabletID; + +/* vendor-defined pointer type */ +extern NSString *kVendorPointerType; + + /* vendor-defined serial number of the specific pointing device */ +extern NSString *kPointerSerialNumber; + + /* vendor-defined unique ID for this pointer */ +extern NSString *kUniqueID; + +/* mask representing the capabilities of the device */ +extern NSString *kCapabilityMask; + + /* type of pointing device - enum to be defined */ +extern NSString *kPointerType; + + /* non-zero = entering; zero = leaving */ +extern NSString *kEnterProximity; diff --git a/sc4pd/headers/app/TextFinder.h b/sc4pd/headers/app/TextFinder.h new file mode 100644 index 0000000..66de160 --- /dev/null +++ b/sc4pd/headers/app/TextFinder.h @@ -0,0 +1,64 @@ +/* + Reusable find panel functionality (find, replace). + Need one shared instance of TextFinder to which the menu items and widgets in the find panel are connected. + Loads UI lazily. + Works on first responder, assumed to be an NSTextView. +*/ + +#import <Cocoa/Cocoa.h> + +#define Forward YES +#define Backward NO + +@interface TextFinder : NSObject { + NSString *findString; + NSString *replaceString; + id findTextField; + id replaceTextField; + id ignoreCaseButton; + id findNextButton; + id replaceAllScopeMatrix; + id statusField; + BOOL lastFindWasSuccessful; +} + +/* Common way to get a text finder. One instance of TextFinder per app is good enough. */ ++ (id)sharedInstance; + +/* Main method for external users; does a find in the first responder. Selects found range or beeps. */ +- (BOOL)find:(BOOL)direction; + +/* Loads UI lazily */ +- (NSPanel *)findPanel; + +/* Gets the first responder and returns it if it's an NSTextView */ +- (NSTextView *)textObjectToSearchIn; + +/* Get/set the current find string. Will update UI if UI is loaded */ +- (NSString *)findString; +- (void)setFindString:(NSString *)string; +- (void)setFindString:(NSString *)string writeToPasteboard:(BOOL)flag; + +/* Get/set the current replace string. Will update UI if UI is loaded */ +- (NSString *)replaceString; +- (void)setReplaceString:(NSString *)string; + +/* Misc internal methods */ +- (void)appDidActivate:(NSNotification *)notification; +- (void)loadFindStringFromPasteboard; +- (void)loadStringToPasteboard:(NSString *)string; + +/* Action methods, sent from the find panel UI; can also be connected to menu items */ +- (void)findNext:(id)sender; +- (void)findPrevious:(id)sender; +- (void)findNextAndOrderFindPanelOut:(id)sender; +- (void)replace:(id)sender; +- (void)replaceAndFind:(id)sender; +- (void)replaceAll:(id)sender; +- (void)orderFrontFindPanel:(id)sender; +- (void)takeFindStringFromSelection:(id)sender; +- (void)takeReplaceStringFromSelection:(id)sender; +- (void)jumpToSelection:(id)sender; + +@end + diff --git a/sc4pd/headers/app/UserPanel.h b/sc4pd/headers/app/UserPanel.h new file mode 100644 index 0000000..4dd724b --- /dev/null +++ b/sc4pd/headers/app/UserPanel.h @@ -0,0 +1,40 @@ +/* + 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 <Cocoa/Cocoa.h> + +@interface UserPanel : NSObject +{ + IBOutlet id window; + void *scobject; +} + ++ (void)closeAll; + +- (id)init; +- (NSWindow*)window; +- (void)close; +- (void)windowWillClose:(NSNotification *)aNotification; +- (void)setSCObject: (void*)inObject; +- (void*) getSCObject; + +- (IBAction) panelAction: (id) sender; + +@end |