18 | {
19 | IBOutlet NSArrayController *snippetCollectionsArrayController;
20 | IBOutlet NSTableView *snippetCollectionsTableView;
21 | IBOutlet NSArrayController *snippetsArrayController;
22 | IBOutlet NSTableView *snippetsTableView;
23 | IBOutlet NSWindow *snippetsWindow;
24 | IBOutlet NSTextView *snippetsTextView;
25 | IBOutlet NSView *snippetsFilterView;
26 | }
27 |
28 | @property (readonly) IBOutlet NSTextView *snippetsTextView;
29 | @property (readonly) IBOutlet NSWindow *snippetsWindow;
30 | @property (readonly) IBOutlet NSArrayController *snippetCollectionsArrayController;
31 | @property (readonly) IBOutlet NSTableView *snippetCollectionsTableView;
32 | @property (readonly) IBOutlet NSArrayController *snippetsArrayController;
33 | @property (readonly) IBOutlet NSTableView *snippetsTableView;
34 |
35 | + (SMLSnippetsController *)sharedInstance;
36 |
37 | - (void)openSnippetsWindow;
38 |
39 | - (IBAction)newCollectionAction:(id)sender;
40 | - (IBAction)newSnippetAction:(id)sender;
41 |
42 | - (id)performInsertNewSnippet;
43 |
44 | - (void)insertSnippet:(id)snippet;
45 |
46 | - (void)performDeleteCollection;
47 |
48 | - (void)importSnippets;
49 | - (void)performSnippetsImportWithPath:(NSString *)path;
50 | - (void)exportSnippets;
51 |
52 | - (NSManagedObjectContext *)managedObjectContext;
53 |
54 |
55 | @end
56 |
--------------------------------------------------------------------------------
/ICU/icu/LICENSE.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | ICU License - ICU 1.8.1 and later
6 |
7 |
8 |
9 | ICU License - ICU 1.8.1 and later
10 |
11 | COPYRIGHT AND PERMISSION NOTICE
12 |
13 |
14 | Copyright (c) 1995-2006 International Business Machines Corporation and others
15 |
16 |
17 | All rights reserved.
18 |
19 |
20 | Permission is hereby granted, free of charge, to any person obtaining a copy
21 | of this software and associated documentation files (the "Software"),
22 | to deal in the Software without restriction, including without limitation
23 | the rights to use, copy, modify, merge, publish, distribute, and/or sell
24 | copies of the Software, and to permit persons
25 | to whom the Software is furnished to do so, provided that the above
26 | copyright notice(s) and this permission notice appear in all copies
27 | of the Software and that both the above copyright notice(s) and this
28 | permission notice appear in supporting documentation.
29 |
30 |
31 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
32 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
33 | PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL
34 | THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM,
35 | OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
36 | RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
37 | NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
38 | USE OR PERFORMANCE OF THIS SOFTWARE.
39 |
40 |
41 | Except as contained in this notice, the name of a copyright holder shall not be
42 | used in advertising or otherwise to promote the sale, use or other dealings in
43 | this Software without prior written authorization of the copyright holder.
44 |
45 |
46 |
47 |
48 | All trademarks and registered trademarks mentioned herein are the property of their respective owners.
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/Classes/SMLSyntaxDefinitionManagedObject.m:
--------------------------------------------------------------------------------
1 | /*
2 | Textron
3 | Based on Smultron Written by Peter Borg, pgw3@mac.com
4 | Find the latest version at http://vijaykiran.com/textron
5 |
6 | Copyright 2004-2009 Peter Borg
7 |
8 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
13 | */
14 |
15 | #import "SMLStandardHeader.h"
16 |
17 | #import "SMLSyntaxDefinitionManagedObject.h"
18 | #import "SMLApplicationDelegate.h"
19 | #import "SMLVariousPerformer.h"
20 |
21 | @implementation SMLSyntaxDefinitionManagedObject
22 |
23 | - (void)didChangeValueForKey:(NSString *)key
24 | {
25 | [super didChangeValueForKey:key];
26 |
27 | if ([[SMLApplicationDelegate sharedInstance] hasFinishedLaunching] == NO) {
28 | return;
29 | }
30 |
31 | if ([SMLVarious isChangingSyntaxDefinitionsProgrammatically] == YES) {
32 | return;
33 | }
34 |
35 | NSDictionary *changedObject = [NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:[self valueForKey:@"name"], [self valueForKey:@"extensions"], nil] forKeys:[NSArray arrayWithObjects:@"name", @"extensions", nil]];
36 | if ([SMLDefaults valueForKey:@"ChangedSyntaxDefinitions"]) {
37 | NSMutableArray *changedSyntaxDefinitionsArray = [NSMutableArray arrayWithArray:[SMLDefaults valueForKey:@"ChangedSyntaxDefinitions"]];
38 | NSArray *array = [NSArray arrayWithArray:changedSyntaxDefinitionsArray];
39 | for (id item in array) {
40 | if ([[item valueForKey:@"name"] isEqualToString:[self valueForKey:@"name"]]) {
41 | [changedSyntaxDefinitionsArray removeObject:item];
42 | }
43 | }
44 | [changedSyntaxDefinitionsArray addObject:changedObject];
45 | [SMLDefaults setValue:changedSyntaxDefinitionsArray forKey:@"ChangedSyntaxDefinitions"];
46 | } else {
47 | [SMLDefaults setValue:[NSArray arrayWithObject:changedObject] forKey:@"ChangedSyntaxDefinitions"];
48 | }
49 | }
50 | @end
51 |
--------------------------------------------------------------------------------
/Classes/SMLToolsMenuController.h:
--------------------------------------------------------------------------------
1 | /*
2 | Textron
3 | Based on Smultron Written by Peter Borg, pgw3@mac.com
4 | Find the latest version at http://vijaykiran.com/textron
5 |
6 | Copyright 2004-2009 Peter Borg
7 |
8 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
13 | */
14 |
15 | #import
16 |
17 | @interface SMLToolsMenuController : NSObject
18 | {
19 | IBOutlet NSMenu *runCommandMenu;
20 | IBOutlet NSMenu *insertSnippetMenu;
21 | IBOutlet NSMenu *functionsMenu;
22 |
23 | NSTextView *textViewToInsertColourInto;
24 | }
25 |
26 | + (SMLToolsMenuController *)sharedInstance;
27 |
28 | - (IBAction)createSnippetFromSelectionAction:(id)sender;
29 | - (IBAction)insertColourAction:(id)sender;
30 | - (IBAction)previewAction:(id)sender;
31 | - (IBAction)reloadPreviewAction:(id)sender;
32 | - (IBAction)showCommandsWindowAction:(id)sender;
33 | - (IBAction)runTextAction:(id)sender;
34 | - (IBAction)showSnippetsWindowAction:(id)sender;
35 | - (IBAction)previousFunctionAction:(id)sender;
36 | - (IBAction)nextFunctionAction:(id)sender;
37 |
38 | - (void)buildInsertSnippetMenu;
39 | - (void)buildRunCommandMenu;
40 |
41 | - (IBAction)emptyDummyAction:(id)sender;
42 |
43 | - (IBAction)getInfoAction:(id)sender;
44 | - (IBAction)refreshInfoAction:(id)sender;
45 |
46 | - (IBAction)importSnippetsAction:(id)sender;
47 | - (IBAction)exportSnippetsAction:(id)sender;
48 |
49 | - (IBAction)importCommandsAction:(id)sender;
50 | - (IBAction)exportCommandsAction:(id)sender;
51 |
52 | - (IBAction)showCommandResultWindowAction:(id)sender;
53 | - (IBAction)runSelectionInlineAction:(id)sender;
54 |
55 | - (IBAction)runCommandAction:(id)sender;
56 | - (IBAction)newCommandAction:(id)sender;
57 | - (IBAction)newCommandCollectionAction:(id)sender;
58 |
59 | - (IBAction)newSnippetAction:(id)sender;
60 | - (IBAction)newSnippetCollectionAction:(id)sender;
61 |
62 | @end
63 |
--------------------------------------------------------------------------------
/Classes/SMLDocumentManagedObject.m:
--------------------------------------------------------------------------------
1 | /*
2 | Textron
3 | Based on Smultron Written by Peter Borg, pgw3@mac.com
4 | Find the latest version at http://vijaykiran.com/textron
5 |
6 | Copyright 2004-2009 Peter Borg
7 |
8 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
13 | */
14 |
15 | #import "SMLStandardHeader.h"
16 |
17 | #import "SMLDocumentManagedObject.h"
18 |
19 | @implementation SMLDocumentManagedObject
20 |
21 | - (void)awakeFromInsert
22 | {
23 | [super awakeFromInsert];
24 |
25 | // NSImage *defaultDocumentIcon = [SMLInterface documentIcon];
26 | // [defaultDocumentIcon setDataRetained:NO];
27 | // [defaultDocumentIcon setScalesWhenResized:YES];
28 | //
29 | // NSImage *defaultUnsavedDocumentIcon = [[NSImage alloc] initWithData:[[SMLVarious unsavedIconFromImage:defaultDocumentIcon] TIFFRepresentation]];
30 | // [defaultUnsavedDocumentIcon setDataRetained:NO];
31 | // [defaultUnsavedDocumentIcon setScalesWhenResized:YES];
32 | //
33 | // [self setValue:defaultDocumentIcon forKey:@"icon"];
34 | // [self setValue:defaultUnsavedDocumentIcon forKey:@"unsavedIcon"];
35 |
36 | [self setValue:[NSNumber numberWithBool:[[SMLDefaults valueForKey:@"SyntaxColourNewDocuments"] boolValue]] forKey:@"isSyntaxColoured"];
37 | [self setValue:[NSNumber numberWithBool:[[SMLDefaults valueForKey:@"LineWrapNewDocuments"] boolValue]] forKey:@"isLineWrapped"];
38 | [self setValue:[NSNumber numberWithBool:[[SMLDefaults valueForKey:@"ShowInvisibleCharacters"] boolValue]] forKey:@"showInvisibleCharacters"];
39 | [self setValue:[NSNumber numberWithBool:[[SMLDefaults valueForKey:@"ShowLineNumberGutter"] boolValue]] forKey:@"showLineNumberGutter"];
40 | [self setValue:[NSNumber numberWithInteger:[[SMLDefaults valueForKey:@"GutterWidth"] integerValue]] forKey:@"gutterWidth"];
41 | [self setValue:[NSNumber numberWithInteger:[[SMLDefaults valueForKey:@"EncodingsPopUp"] integerValue]] forKey:@"encoding"];
42 | }
43 |
44 |
45 |
46 | @end
47 |
--------------------------------------------------------------------------------
/Syntax Definitions/eiffel.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | beginCommand
6 |
7 | endCommand
8 |
9 | beginInstruction
10 |
11 | endInstruction
12 |
13 | beginVariable
14 |
15 | endVariable
16 |
17 | firstString
18 | "
19 | secondString
20 | '
21 | firstSingleLineComment
22 | --
23 | secondSingleLineComment
24 |
25 | beginFirstMultiLineComment
26 |
27 | endFirstMultiLineComment
28 |
29 | beginSecondMultiLineComment
30 |
31 | endSecondMultiLineComment
32 |
33 | functionDefinition
34 |
35 | removeFromFunction
36 |
37 | keywordsCaseSensitive
38 |
39 | recolourKeywordIfAlreadyColoured
40 |
41 | keywords
42 |
43 | indexing
44 | class
45 | inherit
46 | creation
47 | feature
48 | rename
49 | redefine
50 | undefine
51 | select
52 | export
53 | local
54 | deferred
55 | do
56 | is
57 | once
58 | alias
59 | external
60 | rescue
61 | debug
62 | if
63 | inspect
64 | from
65 | else
66 | elseif
67 | when
68 | until
69 | loop
70 | then
71 | obsolete
72 | end
73 | check
74 | ensure
75 | require
76 | variant
77 | invariant
78 | create
79 |
80 | autocompleteWords
81 |
82 |
83 |
84 |
85 |
--------------------------------------------------------------------------------
/ICU/NSStringICUAdditions.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSStringICUAdditions.h
3 | // CocoaICU
4 | //
5 | // Created by Aaron Evans on 11/19/06.
6 | // Copyright 2006 Aaron Evans. All rights reserved.
7 | //
8 |
9 | #import
10 | @class ICUPattern;
11 |
12 | @interface NSString (NSStringICUAdditions)
13 |
14 | /*!
15 | @method nativeUTF16Encoding
16 | @abstract The native UTF16 encoding on the given machine.
17 | @discussion The native UTF16 encoding on the given machine.
18 | */
19 | +(NSStringEncoding)nativeUTF16Encoding;
20 |
21 |
22 |
23 | /*!
24 | @method UTF16String
25 | @abstract Returns a UTF16 encoded string in the native encoding.
26 | @discussion This string has a retain policy equivalent to UTF8String. In
27 | other words, if you want to keep this string around beyond the given autorelease
28 | context, you need to copy the returned string.
29 | */
30 | -(void *)UTF16String;
31 |
32 |
33 | /*!
34 | @method copyUTF16String
35 | @abstract returns a copy
36 | @discussion Returns a UTF16 encoded string in the native encoding. The returned
37 | buffer must eventually be freed.
38 | */
39 | -(void *)copyUTF16String;
40 |
41 | /*!
42 | @method findPattern:
43 | @abstract Finds the given expression and and groups.
44 | @discussion Returns the match and any grouped matches in the returned
45 | array. The first element of the array is the entire match and subsequent
46 | elements are the groups in the order the matches occur.
47 | */
48 | -(NSArray *)findPattern:(NSString *)aRegex;
49 |
50 | /*!
51 | @method componentsSeparatedByPattern:
52 | @abstract Returns the components separated by the given pattern.
53 | @discussion Break a string into components where components separated
54 | by occurrences of the given pattern.
55 | */
56 | -(NSArray *)componentsSeparatedByPattern:(NSString *)aRegex;
57 |
58 | /*!
59 | @method replaceOccurrencesOfPattern:withString:
60 | @abstract Replace occurrences of the pattern with the replacement text.
61 | @discussion Replace occurrences of the pattern with the replacement text.
62 | The replacement text may contain backrerferences.
63 | */
64 | -(NSString *)replaceOccurrencesOfPattern:(NSString *)aPattern withString:(NSString *)replacementText;
65 |
66 | /*!
67 | @method matchesPattern:
68 | @abstract Returns YES if the string matches the entire pattern.
69 | @discussion Returns YES if the string matches the entire pattern.
70 | */
71 | -(BOOL)matchesPattern:(NSString *)aRegex;
72 |
73 | @end
74 |
--------------------------------------------------------------------------------
/Classes/SMLPreferencesController.h:
--------------------------------------------------------------------------------
1 | /*
2 | Textron
3 | Based on Smultron Written by Peter Borg, pgw3@mac.com
4 | Find the latest version at http://vijaykiran.com/textron
5 |
6 | Copyright 2004-2009 Peter Borg
7 |
8 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
13 | */
14 |
15 | #import
16 |
17 | @interface SMLPreferencesController : NSObject
18 | {
19 | NSToolbar *preferencesToolbar;
20 |
21 | IBOutlet NSWindow *preferencesWindow;
22 | IBOutlet NSView *generalView;
23 | IBOutlet NSView *appearanceView;
24 | IBOutlet NSView *openSaveView;
25 | IBOutlet NSView *advancedView;
26 | IBOutlet NSArrayController *syntaxDefinitionsArrayController;
27 |
28 | IBOutlet NSTextField *noUpdateAvailableTextField;
29 | IBOutlet NSPopUpButton *encodingsPopUp;
30 | IBOutlet NSPopUpButton *syntaxColouringPopUp;
31 | IBOutlet NSPopUpButton *lastSavedFormatPopUp;
32 |
33 | IBOutlet NSArrayController *encodingsArrayController;
34 |
35 | IBOutlet NSTableView *syntaxDefinitionsTableView;
36 | IBOutlet NSTableView *encodingsTableView;
37 |
38 | BOOL hasPreparedAdvancedInterface;
39 |
40 | NSView *currentView;
41 | }
42 |
43 | @property (readonly) IBOutlet NSArrayController *encodingsArrayController;
44 | @property (readonly) IBOutlet NSArrayController *syntaxDefinitionsArrayController;
45 | @property (readonly) IBOutlet NSPopUpButton *encodingsPopUp;
46 | @property (readonly) IBOutlet NSWindow *preferencesWindow;
47 |
48 |
49 | + (SMLPreferencesController *)sharedInstance;
50 |
51 | - (void)setDefaults;
52 |
53 | - (void)showPreferencesWindow;
54 |
55 | - (NSRect)getRectForView:(NSView *)view;
56 | - (CGFloat)toolbarHeight;
57 |
58 | - (IBAction)setFontAction:(id)sender;
59 | - (IBAction)checkNowAction:(id)sender;
60 |
61 | - (NSTextField *)noUpdateAvailableTextField;
62 |
63 | - (IBAction)revertToStandardSettingsAction:(id)sender;
64 | - (void)buildEncodingsMenu;
65 |
66 | - (IBAction)openSetFolderAction:(id)sender;
67 | - (IBAction)saveAsSetFolderAction:(id)sender;
68 |
69 |
70 |
71 | - (NSManagedObjectContext *)managedObjectContext;
72 |
73 | @end
74 |
--------------------------------------------------------------------------------
/Classes/SMLAdvancedFindController.h:
--------------------------------------------------------------------------------
1 | /*
2 | Textron
3 | Based on Smultron Written by Peter Borg, pgw3@mac.com
4 | Find the latest version at http://vijaykiran.com/textron
5 |
6 | Copyright 2004-2009 Peter Borg
7 |
8 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
13 | */
14 |
15 | #import
16 |
17 |
18 | @interface SMLAdvancedFindController : NSObject
19 | {
20 | IBOutlet NSWindow *advancedFindWindow;
21 | IBOutlet NSSearchField *findSearchField;
22 | IBOutlet NSSearchField *replaceSearchField;
23 | IBOutlet NSTextField *findResultTextField;
24 | IBOutlet NSOutlineView *findResultsOutlineView;
25 | IBOutlet NSView *resultDocumentContentView;
26 | IBOutlet NSTreeController *findResultsTreeController;
27 |
28 | IBOutlet NSSplitView *advancedFindSplitView;
29 |
30 | IBOutlet NSButton *currentDocumentScope;
31 | IBOutlet NSButton *currentProjectScope;
32 | IBOutlet NSButton *allDocumentsScope;
33 |
34 | id currentlyDisplayedDocumentInAdvancedFind;
35 | }
36 |
37 | @property (assign) id currentlyDisplayedDocumentInAdvancedFind;
38 | @property (readonly) IBOutlet NSWindow *advancedFindWindow;
39 | @property (readonly) IBOutlet NSOutlineView *findResultsOutlineView;
40 |
41 | + (SMLAdvancedFindController *)sharedInstance;
42 |
43 | - (IBAction)findAction:(id)sender;
44 | - (IBAction)replaceAction:(id)sender;
45 |
46 | - (void)performNumberOfReplaces:(NSInteger)numberOfReplaces;
47 |
48 | - (void)showAdvancedFindWindow;
49 |
50 | - (NSEnumerator *)scopeEnumerator;
51 |
52 | - (void)removeCurrentlyDisplayedDocumentInAdvancedFind;
53 |
54 | - (NSView *)resultDocumentContentView;
55 |
56 | - (NSManagedObjectContext *)managedObjectContext;
57 |
58 | - (NSMutableDictionary *)preparedResultDictionaryFromString:(NSString *)completeString searchStringLength:(NSInteger)searchStringLength range:(NSRange)foundRange lineNumber:(NSInteger)lineNumber document:(id)document;
59 |
60 | - (void)alertThatThisIsNotAValidRegularExpression:(NSString *)string;
61 |
62 | - (void)searchScopeChanged:(id)sender;
63 |
64 | - (IBAction)showRegularExpressionsHelpPanelAction:(id)sender;
65 |
66 | @end
67 |
--------------------------------------------------------------------------------
/Classes/SMLFullScreenWindow.m:
--------------------------------------------------------------------------------
1 | /*
2 | Textron
3 | Based on Smultron Written by Peter Borg, pgw3@mac.com
4 | Find the latest version at http://vijaykiran.com/textron
5 |
6 | Copyright 2004-2009 Peter Borg
7 |
8 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
13 | */
14 |
15 |
16 | #import "SMLStandardHeader.h"
17 |
18 | #import "SMLFullScreenWindow.h"
19 | #import "SMLInterfacePerformer.h"
20 |
21 | @implementation SMLFullScreenWindow
22 |
23 | - (BOOL)canBecomeKeyWindow
24 | {
25 | return YES;
26 | }
27 |
28 |
29 | - (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)styleMask backing:(NSBackingStoreType)bufferingType defer:(BOOL)flag
30 | {
31 | if (self = [super initWithContentRect:contentRect styleMask:NSBorderlessWindowMask backing:bufferingType defer:flag]) {
32 | [self setAlphaValue:0];
33 | [self setOpaque:NO];
34 | [self setHasShadow:NO];
35 | [self setBackgroundColor:[NSColor blackColor]];
36 |
37 | return self;
38 | }
39 |
40 | return nil;
41 | }
42 |
43 |
44 | - (void)enterFullScreen
45 | {
46 | SetSystemUIMode(kUIModeAllHidden, kUIOptionAutoShowMenuBar);
47 | fullScreenTimer = [NSTimer scheduledTimerWithTimeInterval:0.02 target:self selector:@selector(fadeIn) userInfo:nil repeats:YES];
48 | }
49 |
50 |
51 | - (void)fadeIn
52 | {
53 | if ([self alphaValue] < 1.0) {
54 | [self setAlphaValue:([self alphaValue] + 0.05)];
55 | } else {
56 | if (fullScreenTimer != nil) {
57 | [fullScreenTimer invalidate];
58 | fullScreenTimer = nil;
59 | }
60 |
61 | [SMLInterface insertDocumentIntoFullScreenWindow];
62 | }
63 | }
64 |
65 |
66 | - (void)returnFromFullScreen
67 | {
68 | fullScreenTimer = [NSTimer scheduledTimerWithTimeInterval:0.01 target:self selector:@selector(fadeOut) userInfo:nil repeats:YES];
69 |
70 | }
71 |
72 |
73 | - (void)fadeOut
74 | {
75 | if ([self alphaValue] > 0) {
76 | [self setAlphaValue:([self alphaValue] - 0.05)];
77 | } else {
78 | if (fullScreenTimer != nil) {
79 | [fullScreenTimer invalidate];
80 | fullScreenTimer = nil;
81 | }
82 |
83 | [SMLInterface returnFromFullScreen];
84 | }
85 | }
86 |
87 | @end
88 |
--------------------------------------------------------------------------------
/Syntax Definitions/batch.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | beginCommand
6 | @
7 | endCommand
8 |
9 | beginInstruction
10 |
11 | endInstruction
12 |
13 | beginVariable
14 | %
15 | endVariable
16 | \.\=\\\"
17 | firstString
18 | "
19 | secondString
20 |
21 | firstSingleLineComment
22 | ::
23 | secondSingleLineComment
24 |
25 | beginFirstMultiLineComment
26 |
27 | endFirstMultiLineComment
28 |
29 | beginSecondMultiLineComment
30 |
31 | endSecondMultiLineComment
32 |
33 | functionDefinition
34 |
35 | removeFromFunction
36 |
37 | keyWordsCaseSensitive
38 |
39 | recolourKeyWordIfAlreadyColoured
40 |
41 | keywords
42 |
43 | assoc
44 | call
45 | cd
46 | chdir
47 | cls
48 | cmd
49 | color
50 | copy
51 | date
52 | defined
53 | del
54 | dir
55 | dpath
56 | echo
57 | else
58 | endlocal
59 | erase
60 | errorlevel
61 | exit
62 | exist
63 | for
64 | ftype
65 | goto
66 | if
67 | md
68 | mkdir
69 | move
70 | not
71 | path
72 | pause
73 | popd
74 | prompt
75 | pushd
76 | rd
77 | rem
78 | rename
79 | ren
80 | rmdir
81 | set
82 | setlocal
83 | shift
84 | start
85 | time
86 | title
87 | type
88 | ver
89 |
90 | autocompleteWords
91 |
92 |
93 |
94 |
--------------------------------------------------------------------------------
/Syntax Definitions/scala.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | beginCommand
6 |
7 | endCommand
8 |
9 | beginInstruction
10 |
11 | endInstruction
12 |
13 | beginVariable
14 |
15 | endVariable
16 |
17 | firstString
18 | "
19 | secondString
20 | '
21 | firstSingleLineComment
22 | //
23 | secondSingleLineComment
24 |
25 | beginFirstMultiLineComment
26 | /*
27 | endFirstMultiLineComment
28 | */
29 | beginSecondMultiLineComment
30 |
31 | endSecondMultiLineComment
32 |
33 | functionDefinition
34 | def
35 | removeFromFunction
36 |
37 | keywordsCaseSensitive
38 |
39 | recolourKeywordIfAlreadyColoured
40 |
41 | keywords
42 |
43 | abstract
44 | case
45 | catch
46 | class
47 | def
48 | do
49 | else
50 | extends
51 | false
52 | final
53 | finally
54 | for
55 | if
56 | implicit
57 | import
58 | match
59 | new
60 | null
61 | object
62 | override
63 | package
64 | private
65 | protected
66 | requires
67 | return
68 | sealed
69 | super
70 | this
71 | throw
72 | trait
73 | try
74 | true
75 | type
76 | val
77 | var
78 | while
79 | with
80 | yield
81 |
82 | autocompleteWords
83 |
84 |
85 |
86 |
87 |
--------------------------------------------------------------------------------
/Classes/SMLInterfacePerformer.h:
--------------------------------------------------------------------------------
1 | /*
2 | Textron
3 | Based on Smultron Written by Peter Borg, pgw3@mac.com
4 | Find the latest version at http://vijaykiran.com/textron
5 |
6 | Copyright 2004-2009 Peter Borg
7 |
8 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
13 | */
14 |
15 | #import
16 |
17 | @class SMLFullScreenWindow;
18 |
19 | @interface SMLInterfacePerformer : NSObject {
20 |
21 | NSString *statusBarBetweenString;
22 | NSString *statusBarLastSavedString;
23 | NSString *statusBarSelectionLengthString;
24 | NSString *statusBarLineString;
25 | NSString *statusBarColumnString;
26 | NSString *statusBarSyntaxDefinitionString;
27 | NSString *statusBarEncodingString;
28 |
29 | SMLFullScreenWindow *fullScreenWindow;
30 | id fullScreenDocument;
31 | NSMenu *savedMainMenu;
32 | NSRect fullScreenRect;
33 |
34 | NSImage *defaultIcon;
35 | NSImage *defaultUnsavedIcon;
36 | }
37 |
38 | @property (readonly) SMLFullScreenWindow *fullScreenWindow;
39 | @property (readonly) id fullScreenDocument;
40 |
41 | @property (retain) NSImage *defaultIcon;
42 | @property (retain) NSImage *defaultUnsavedIcon;
43 |
44 |
45 | + (SMLInterfacePerformer *)sharedInstance;
46 |
47 | - (void)goToFunctionOnLine:(id)sender;
48 | - (void)createFirstViewForDocument:(id)document;
49 | - (void)insertDocumentIntoSecondContentView:(id)document;
50 | - (void)insertDocumentIntoThirdContentView:(id)document orderFront:(BOOL)orderFront;
51 | - (void)insertDocumentIntoFourthContentView:(id)document;
52 |
53 | - (void)updateStatusBar;
54 | - (void)clearStatusBar;
55 |
56 | - (NSString *)whichDirectoryForOpen;
57 | - (NSString *)whichDirectoryForSave;
58 |
59 | - (void)removeAllSubviewsFromView:(NSView *)view;
60 | - (void)enterFullScreenForDocument:(id)document;
61 | - (void)insertDocumentIntoFullScreenWindow;
62 | - (void)returnFromFullScreen;
63 |
64 | - (void)insertAllFunctionsIntoMenu:(NSMenu *)menu;
65 | - (NSArray *)allFunctions;
66 | - (NSInteger)currentLineNumber;
67 | - (NSInteger)currentFunctionIndexForFunctions:(NSArray *)functions;
68 |
69 | - (void)removeAllTabBarObjectsForTabView:(NSTabView *)tabView;
70 |
71 | - (void)changeViewWithAnimationForWindow:(NSWindow *)window oldView:(NSView *)oldView newView:(NSView *)newView newRect:(NSRect)newRect;
72 |
73 | @end
74 |
--------------------------------------------------------------------------------
/Classes/SMLCommandsController.h:
--------------------------------------------------------------------------------
1 | /*
2 | Textron
3 | Based on Smultron Written by Peter Borg, pgw3@mac.com
4 | Find the latest version at http://vijaykiran.com/textron
5 |
6 | Copyright 2004-2009 Peter Borg
7 |
8 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
13 | */
14 |
15 | #import
16 |
17 | @class SMLTableView;
18 |
19 | @interface SMLCommandsController : NSObject {
20 |
21 | IBOutlet NSArrayController *commandCollectionsArrayController;
22 | IBOutlet NSTableView *commandCollectionsTableView;
23 | IBOutlet NSArrayController *commandsArrayController;
24 | IBOutlet NSTableView *commandsTableView;
25 | IBOutlet NSWindow *commandsWindow;
26 | IBOutlet NSTextView *commandsTextView;
27 | IBOutlet NSView *commandsFilterView;
28 |
29 | BOOL currentCommandShouldBeInsertedInline;
30 | BOOL isCommandRunning;
31 | NSTimer *checkIfTemporaryFilesCanBeDeletedTimer;
32 | NSMutableArray *temporaryFilesArray;
33 |
34 | }
35 |
36 | @property (readonly) IBOutlet NSTextView *commandsTextView;
37 | @property (readonly) IBOutlet NSWindow *commandsWindow;
38 | @property (readonly) IBOutlet NSArrayController *commandCollectionsArrayController;
39 | @property (readonly) IBOutlet NSTableView *commandCollectionsTableView;
40 | @property (readonly) IBOutlet NSArrayController *commandsArrayController;
41 | @property (readonly) IBOutlet NSTableView *commandsTableView;
42 |
43 | + (SMLCommandsController *)sharedInstance;
44 |
45 | - (void)openCommandsWindow;
46 |
47 | - (IBAction)newCollectionAction:(id)sender;
48 | - (IBAction)newCommandAction:(id)sender;
49 |
50 | - (id)performInsertNewCommand;
51 |
52 | - (void)performDeleteCollection;
53 |
54 | - (void)importCommands;
55 | - (void)performCommandsImportWithPath:(NSString *)path;
56 | - (void)exportCommands;
57 |
58 | - (NSManagedObjectContext *)managedObjectContext;
59 |
60 |
61 | - (IBAction)runAction:(id)sender;
62 |
63 | - (IBAction)insertPathAction:(id)sender;
64 | - (IBAction)insertDirectoryAction:(id)sender;
65 |
66 | - (NSString *)commandToRunFromString:(NSString *)string;
67 |
68 | - (void)runCommand:(id)command;
69 |
70 | - (BOOL)currentCommandShouldBeInsertedInline;
71 |
72 | - (void)setCommandRunning:(BOOL)flag;
73 |
74 | - (void)clearAnyTemporaryFiles;
75 |
76 |
77 |
78 |
79 | @end
80 |
--------------------------------------------------------------------------------
/Classes/SMLExtraInterfaceController.h:
--------------------------------------------------------------------------------
1 | /*
2 | Textron
3 | Based on Smultron Written by Peter Borg, pgw3@mac.com
4 | Find the latest version at http://vijaykiran.com/textron
5 |
6 | Copyright 2004-2009 Peter Borg
7 |
8 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
13 | */
14 |
15 | #import
16 |
17 |
18 | @interface SMLExtraInterfaceController : NSObject {
19 |
20 | IBOutlet NSTextField *spacesTextFieldEntabWindow;
21 | IBOutlet NSTextField *spacesTextFieldDetabWindow;
22 | IBOutlet NSTextField *lineTextFieldGoToLineWindow;
23 | IBOutlet NSWindow *entabWindow;
24 | IBOutlet NSWindow *detabWindow;
25 | IBOutlet NSWindow *goToLineWindow;
26 |
27 | IBOutlet NSView *openPanelAccessoryView;
28 | IBOutlet NSPopUpButton *openPanelEncodingsPopUp;
29 | //IBOutlet NSView *printAccessoryView;
30 |
31 | IBOutlet NSWindow *commandResultWindow;
32 | IBOutlet NSTextView *commandResultTextView;
33 |
34 | IBOutlet NSWindow *newProjectWindow;
35 | IBOutlet NSPanel *regularExpressionsHelpPanel;
36 | }
37 |
38 |
39 | @property (readonly) IBOutlet NSView *openPanelAccessoryView;
40 | @property (readonly) IBOutlet NSPopUpButton *openPanelEncodingsPopUp;
41 | //@property (readonly) IBOutlet NSView *printAccessoryView;
42 | @property (readonly) IBOutlet NSWindow *commandResultWindow;
43 | @property (readonly) IBOutlet NSTextView *commandResultTextView;
44 | @property (readonly) IBOutlet NSWindow *newProjectWindow;
45 |
46 | + (SMLExtraInterfaceController *)sharedInstance;
47 |
48 | - (void)displayEntab;
49 | - (void)displayDetab;
50 | - (IBAction)entabButtonEntabWindowAction:(id)sender;
51 | - (IBAction)detabButtonDetabWindowAction:(id)sender;
52 | - (IBAction)cancelButtonEntabDetabGoToLineWindowsAction:(id)sender;
53 | - (void)displayGoToLine;
54 | - (IBAction)goButtonGoToLineWindowAction:(id)sender;
55 |
56 | //- (IBAction)setPrintFontAction:(id)sender;
57 |
58 | - (NSPopUpButton *)openPanelEncodingsPopUp;
59 | - (NSView *)openPanelAccessoryView;
60 | //- (NSView *)printAccessoryView;
61 | - (NSWindow *)commandResultWindow;
62 | -(NSTextView *)commandResultTextView;
63 | - (NSWindow *)newProjectWindow;
64 |
65 | - (void)showCommandResultWindow;
66 |
67 |
68 | - (IBAction)createNewProjectAction:(id)sender;
69 |
70 | - (void)showRegularExpressionsHelpPanel;
71 |
72 | @end
73 |
--------------------------------------------------------------------------------
/Syntax Definitions/erl.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | beginCommand
6 |
7 | endCommand
8 |
9 | beginInstruction
10 |
11 | endInstruction
12 |
13 | beginVariable
14 |
15 | endVariable
16 |
17 | firstString
18 | "
19 | secondString
20 | '
21 | firstSingleLineComment
22 | %
23 | secondSingleLineComment
24 | %
25 | beginFirstMultiLineComment
26 | %
27 | endFirstMultiLineComment
28 | %
29 | beginSecondMultiLineComment
30 | %
31 | endSecondMultiLineComment
32 | %
33 | functionDefinition
34 | ^[a-z]+.*\(.*\)\s*->
35 | removeFromFunction
36 |
37 | keywordsCaseSensitive
38 |
39 | recolourKeywordIfAlreadyColoured
40 |
41 | keywords
42 |
43 | module
44 | include
45 | compile
46 | author
47 | vsn
48 | behavior
49 | behaviour
50 | define
51 | record
52 | after
53 | and
54 | andalso
55 | band
56 | begin
57 | bnot
58 | bor
59 | bsi
60 | bsr
61 | case
62 | catch
63 | cond
64 | div
65 | end
66 | fun
67 | if
68 | let
69 | not
70 | of
71 | or
72 | orelse
73 | query
74 | receive
75 | rem
76 | try
77 | when
78 | xor
79 |
80 | autocompleteWords
81 |
82 |
83 |
84 |
--------------------------------------------------------------------------------
/Classes/SMLSingleDocumentWindowDelegate.m:
--------------------------------------------------------------------------------
1 | /*
2 | Textron
3 | Based on Smultron Written by Peter Borg, pgw3@mac.com
4 | Find the latest version at http://vijaykiran.com/textron
5 |
6 | Copyright 2004-2009 Peter Borg
7 |
8 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
13 | */
14 |
15 | #import "SMLStandardHeader.h"
16 |
17 | #import "SMLSingleDocumentWindowDelegate.h"
18 | #import "SMLBasicPerformer.h"
19 | #import "SMLSyntaxColouring.h"
20 | #import "SMLLineNumbers.h"
21 |
22 | @implementation SMLSingleDocumentWindowDelegate
23 |
24 | static id sharedInstance = nil;
25 |
26 | + (SMLSingleDocumentWindowDelegate *)sharedInstance
27 | {
28 | if (sharedInstance == nil) {
29 | sharedInstance = [[self alloc] init];
30 | }
31 |
32 | return sharedInstance;
33 | }
34 |
35 |
36 | - (id)init
37 | {
38 | if (sharedInstance == nil) {
39 | sharedInstance = [super init];
40 | }
41 | return sharedInstance;
42 | }
43 |
44 |
45 | - (void)windowDidResize:(NSNotification *)aNotification
46 | {
47 | NSWindow *window = [aNotification object];
48 | NSArray *array = [SMLBasic fetchAll:@"Document"];
49 | id document;
50 | for (document in array) {
51 | if ([document valueForKey:@"singleDocumentWindow"] == window) {
52 | break;
53 | }
54 | }
55 |
56 | if (document == nil) {
57 | return;
58 | }
59 |
60 | array = [[window contentView] subviews];
61 | for (id view in array) {
62 | if (view == [document valueForKey:@"thirdTextScrollView"]) {
63 | [[document valueForKey:@"lineNumbers"] updateLineNumbersForClipView:[view contentView] checkWidth:NO recolour:YES];
64 | }
65 | }
66 |
67 | [SMLDefaults setValue:NSStringFromRect([window frame]) forKey:@"SingleDocumentWindow"];
68 | }
69 |
70 |
71 | - (BOOL)windowShouldClose:(id)sender
72 | {
73 | NSArray *array = [SMLBasic fetchAll:@"Document"];
74 | for (id item in array) {
75 | if ([item valueForKey:@"singleDocumentWindow"] == sender) {
76 | [item setValue:nil forKey:@"singleDocumentWindow"];
77 | [item setValue:nil forKey:@"singleDocumentWindow"];
78 | [item setValue:nil forKey:@"thirdTextView"];
79 | [[item valueForKey:@"syntaxColouring"] setThirdLayoutManager:nil];
80 | break;
81 | }
82 | }
83 |
84 | [SMLDefaults setValue:NSStringFromRect([sender frame]) forKey:@"SingleDocumentWindow"];
85 |
86 | return YES;
87 | }
88 |
89 | @end
90 |
--------------------------------------------------------------------------------
/Syntax Definitions/c.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | beginCommand
6 |
7 | endCommand
8 |
9 | beginInstruction
10 |
11 | endInstruction
12 |
13 | beginVariable
14 |
15 | endVariable
16 |
17 | firstString
18 | "
19 | secondString
20 | '
21 | firstSingleLineComment
22 | //
23 | secondSingleLineComment
24 |
25 | beginFirstMultiLineComment
26 | /*
27 | endFirstMultiLineComment
28 | */
29 | beginSecondMultiLineComment
30 |
31 | endSecondMultiLineComment
32 |
33 | functionDefinition
34 | ^\s*.*\(.*\)\n?\s*\{
35 | removeFromFunction
36 |
37 | keywordsCaseSensitive
38 |
39 | recolourKeywordIfAlreadyColoured
40 |
41 | keywords
42 |
43 | char
44 | double
45 | enum
46 | float
47 | int
48 | long
49 | short
50 | signed
51 | struct
52 | typedef
53 | union
54 | unsigned
55 | void
56 | auto
57 | const
58 | extern
59 | register
60 | static
61 | volatile
62 | break
63 | case
64 | continue
65 | default
66 | do
67 | else
68 | for
69 | goto
70 | if
71 | return
72 | sizeof
73 | switch
74 | while
75 | asm
76 | asmlinkage
77 | far
78 | huge
79 | inline
80 | near
81 | pascal
82 | true
83 | false
84 | NULL
85 | #include
86 | #define
87 | #warning
88 | #error
89 | #ifdef
90 | #ifndef
91 | #endif
92 | #else
93 |
94 | autocompleteWords
95 |
96 |
97 |
98 |
--------------------------------------------------------------------------------
/ICU/NSStringICUAdditions.m:
--------------------------------------------------------------------------------
1 | //
2 | // NSStringICUAdditions.m
3 | // CocoaICU
4 | //
5 | // Created by Aaron Evans on 11/19/06.
6 | // Copyright 2006 Aaron Evans. All rights reserved.
7 | //
8 |
9 | #import "NSStringICUAdditions.h"
10 | #import "ICUPattern.h"
11 | #import "ICUMatcher.h"
12 |
13 | struct URegularExpression;
14 | /**
15 | * Structure represeting a compiled regular rexpression, plus the results
16 | * of a match operation.
17 | * @draft ICU 3.0
18 | */
19 | typedef struct URegularExpression URegularExpression;
20 |
21 | #define U_HIDE_DRAFT_API 1
22 | #define U_DISABLE_RENAMING 1
23 | #import
24 |
25 | @interface NSString (NSStringICUPrivateAdditions)
26 |
27 | @end
28 |
29 | @implementation NSString (NSStringICUAdditions)
30 |
31 | -(NSString *)replaceOccurrencesOfPattern:(NSString *)aPattern withString:(NSString *)replacementText {
32 | ICUPattern *p = [ICUPattern patternWithString:aPattern];
33 | ICUMatcher *m = [ICUMatcher matcherWithPattern:p overString:self];
34 | return [m replaceAllWithString:replacementText];
35 | }
36 |
37 | -(BOOL)matchesPattern:(NSString *)aRegex {
38 | ICUPattern *p = [ICUPattern patternWithString:aRegex];
39 | ICUMatcher *m = [ICUMatcher matcherWithPattern:p overString:self];
40 | return [m matches];
41 | }
42 |
43 | -(NSArray *)findPattern:(NSString *)aRegex {
44 | ICUPattern *p = [ICUPattern patternWithString:aRegex];
45 | ICUMatcher *matcher = [ICUMatcher matcherWithPattern:p overString:self];
46 | NSMutableArray *foundGroups = [NSMutableArray array];
47 |
48 | [matcher findFromIndex:0];
49 | int i;
50 | for(i=0;i<=[matcher numberOfGroups];i++)
51 | [foundGroups addObject:[matcher groupAtIndex:i]];
52 |
53 | return [NSArray arrayWithArray:foundGroups];
54 | }
55 |
56 | -(NSArray *)componentsSeparatedByPattern:(NSString *)aRegex {
57 | ICUPattern *p = [ICUPattern patternWithString:aRegex];
58 | return [p componentsSplitFromString:self];
59 | }
60 |
61 |
62 | +(NSStringEncoding)nativeUTF16Encoding {
63 | CFStringEncoding stringEncoding;
64 | #if __BIG_ENDIAN__
65 | stringEncoding = kCFStringEncodingUTF16BE;
66 | #elif __LITTLE_ENDIAN__
67 | stringEncoding = kCFStringEncodingUTF16LE;
68 | #endif
69 |
70 | return CFStringConvertEncodingToNSStringEncoding(stringEncoding);
71 | }
72 |
73 | -(void *)UTF16String {
74 | UChar *ret = (UChar *)[self cStringUsingEncoding:[NSString nativeUTF16Encoding]];
75 |
76 | // for some reason, the null-terminator doesn't always show up at the right place and this
77 | // causes extra characters to be created in the unicode string. We remove them here by force.
78 | unsigned int len = [self length];
79 | ret[len] = '\0';
80 | return ret;
81 | }
82 |
83 | -(void *)copyUTF16String {
84 | unsigned int length = [self length];
85 | UChar *utf16String = malloc((length+1)*sizeof(UChar));
86 | [self getCharacters: utf16String];
87 | utf16String[length] = 0;
88 | return utf16String;
89 | }
90 |
91 | @end
92 |
--------------------------------------------------------------------------------
/Classes/SMLVariousPerformer.h:
--------------------------------------------------------------------------------
1 | /*
2 | Textron
3 | Based on Smultron Written by Peter Borg, pgw3@mac.com
4 | Find the latest version at http://vijaykiran.com/textron
5 |
6 | Copyright 2004-2009 Peter Borg
7 |
8 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
13 | */
14 |
15 | #import
16 |
17 | @class SMLFullScreenWindow;
18 | @class SMLPrintTextView;
19 |
20 | @interface SMLVariousPerformer : NSObject {
21 |
22 | NSInteger untitledNumber;
23 |
24 | NSString *separatorString;
25 |
26 | NSTimer *checkIfAnotherApplicationHasChangedDocumentsTimer;
27 |
28 | BOOL isChangingSyntaxDefinitionsProgrammatically;
29 | NSTask *asynchronousTask;
30 | NSMutableString *asynchronousTaskResult;
31 | }
32 |
33 | + (SMLVariousPerformer *)sharedInstance;
34 |
35 | - (void)updateCheckIfAnotherApplicationHasChangedDocumentsTimer;
36 |
37 | - (void)insertTextEncodings;
38 | - (void)insertSyntaxDefinitions;
39 | - (void)insertDefaultSnippets;
40 |
41 | - (void)insertDefaultCommands;
42 | - (void)standardAlertSheetWithTitle:(NSString *)title message:(NSString *)message window:(NSWindow *)window;
43 | - (void)stopModalLoop;
44 | - (void)sendModifiedEventToExternalDocument:(id)document path:(NSString *)path;
45 | - (void)sendClosedEventToExternalDocument:(id)document;
46 |
47 | - (NSInteger)alertWithMessage:(NSString *)message informativeText:(NSString *)informativeText defaultButton:(NSString *)defaultButton alternateButton:(NSString *)alternateButton otherButton:(NSString *)otherButton;
48 |
49 | - (void)checkIfDocumentsHaveBeenUpdatedByAnotherApplication;
50 | - (void)sheetDidFinish:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo;
51 | - (NSString *)performCommand:(NSString *)command;
52 | - (void)performCommandAsynchronously:(NSString *)command;
53 | - (void)asynchronousTaskCompleted;
54 |
55 | - (BOOL)isChangingSyntaxDefinitionsProgrammatically;
56 |
57 | - (void)setUnsavedAsLastSavedDateForDocument:(id)document;
58 | - (void)setLastSavedDateForDocument:(id)document date:(NSDate *)lastSavedDate;
59 | - (void)hasChangedDocument:(id)document;
60 |
61 | - (void)setNameAndPathForDocument:(id)document path:(NSString *)path;
62 |
63 |
64 | - (void)fixSortOrderNumbersForArrayController:(NSArrayController *)arrayController overIndex:(NSInteger)index;
65 | - (void)resetSortOrderNumbersForArrayController:(NSArrayController *)arrayController;
66 |
67 |
68 | - (void)insertIconsInBackground:(id)array;
69 |
70 | //- (SMLPrintTextView *)printView;
71 | @end
72 |
--------------------------------------------------------------------------------
/PSMTabBar/PSMOverflowPopUpButton.m:
--------------------------------------------------------------------------------
1 | //
2 | // PSMOverflowPopUpButton.m
3 | // PSMTabBarControl
4 | //
5 | // Created by John Pannell on 11/4/05.
6 | // Copyright 2005 Positive Spin Media. All rights reserved.
7 | //
8 |
9 | #import "PSMOverflowPopUpButton.h"
10 | #import "PSMTabBarControl.h"
11 |
12 | @implementation PSMOverflowPopUpButton
13 |
14 | - (id)initWithFrame:(NSRect)frameRect pullsDown:(BOOL)flag
15 | {
16 | self=[super initWithFrame:frameRect pullsDown:YES];
17 | if (self) {
18 | [self setBezelStyle:NSRegularSquareBezelStyle];
19 | [self setBordered:NO];
20 | [self setTitle:@""];
21 | [self setPreferredEdge:NSMaxXEdge];
22 |
23 | _PSMTabBarOverflowPopUpImage = [[NSImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"SMLTabBarOverflow" ofType:@"pdf" inDirectory:@"Tab Bar"]];
24 | _PSMTabBarOverflowDownPopUpImage = [[NSImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"SMLTabBarOverflowPressed" ofType:@"pdf" inDirectory:@"Tab Bar"]];
25 | }
26 | return self;
27 | }
28 |
29 |
30 |
31 | - (void)drawRect:(NSRect)rect
32 | {
33 | if(_PSMTabBarOverflowPopUpImage == nil){
34 | [super drawRect:rect];
35 | return;
36 | }
37 |
38 | NSImage *image = (_down) ? _PSMTabBarOverflowDownPopUpImage : _PSMTabBarOverflowPopUpImage;
39 | NSSize imageSize = [image size];
40 | rect.origin.x = NSMidX(rect) - (imageSize.width * 0.5);
41 | rect.origin.y = NSMidY(rect) - (imageSize.height * 0.5);
42 | if([self isFlipped]) {
43 | rect.origin.y += imageSize.height;
44 | }
45 | [image compositeToPoint:rect.origin operation:NSCompositeSourceOver];
46 | }
47 |
48 | - (void)mouseDown:(NSEvent *)event
49 | {
50 | _down = YES;
51 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(notificationReceived:) name:NSMenuDidEndTrackingNotification object:[self menu]];
52 | [self setNeedsDisplay:YES];
53 | [super mouseDown:event];
54 | }
55 |
56 | - (void)notificationReceived:(NSNotification *)notification
57 | {
58 | _down = NO;
59 | [self setNeedsDisplay:YES];
60 | [[NSNotificationCenter defaultCenter] removeObserver:self];
61 | }
62 |
63 | #pragma mark -
64 | #pragma mark Archiving
65 |
66 | - (void)encodeWithCoder:(NSCoder *)aCoder {
67 | [super encodeWithCoder:aCoder];
68 | if ([aCoder allowsKeyedCoding]) {
69 | [aCoder encodeObject:_PSMTabBarOverflowPopUpImage forKey:@"PSMTabBarOverflowPopUpImage"];
70 | [aCoder encodeObject:_PSMTabBarOverflowDownPopUpImage forKey:@"PSMTabBarOverflowDownPopUpImage"];
71 | }
72 | }
73 |
74 | - (id)initWithCoder:(NSCoder *)aDecoder {
75 | self = [super initWithCoder:aDecoder];
76 | if (self) {
77 | if ([aDecoder allowsKeyedCoding]) {
78 | _PSMTabBarOverflowPopUpImage = [aDecoder decodeObjectForKey:@"PSMTabBarOverflowPopUpImage"];
79 | _PSMTabBarOverflowDownPopUpImage = [aDecoder decodeObjectForKey:@"PSMTabBarOverflowDownPopUpImage"];
80 | }
81 | }
82 | return self;
83 | }
84 |
85 | @end
86 |
--------------------------------------------------------------------------------
/Syntax Definitions/objectivecaml.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | beginCommand
6 |
7 | endCommand
8 |
9 | beginInstruction
10 |
11 | endInstruction
12 |
13 | beginVariable
14 |
15 | endVariable
16 |
17 | firstString
18 | "
19 | secondString
20 |
21 | firstSingleLineComment
22 |
23 | secondSingleLineComment
24 |
25 | beginFirstMultiLineComment
26 | (*
27 | endFirstMultiLineComment
28 | *)
29 | beginSecondMultiLineComment
30 |
31 | endSecondMultiLineComment
32 |
33 | functionDefinition
34 |
35 | removeFromFunction
36 |
37 | keywordsCaseSensitive
38 |
39 | recolourKeywordIfAlreadyColoured
40 |
41 | keywords
42 |
43 | and
44 | as
45 | assert
46 | asr
47 | begin
48 | class
49 | constraint
50 | do
51 | done
52 | downto
53 | else
54 | end
55 | exception
56 | external
57 | false
58 | for
59 | fun
60 | function
61 | functor
62 | if
63 | in
64 | include
65 | inherit
66 | initializer
67 | land
68 | lazy
69 | let
70 | lor
71 | lsl
72 | lsr
73 | lxor
74 | match
75 | method
76 | mod
77 | module
78 | mutable
79 | new
80 | object
81 | of
82 | open
83 | or
84 | private
85 | rec
86 | sig
87 | struct
88 | then
89 | to
90 | true
91 | try
92 | type
93 | val
94 | virtual
95 | when
96 | while
97 | with
98 |
99 | autocompleteWords
100 |
101 |
102 |
103 |
104 |
--------------------------------------------------------------------------------
/Syntax Definitions/java.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | beginCommand
6 |
7 | endCommand
8 |
9 | beginInstruction
10 |
11 | endInstruction
12 |
13 | beginVariable
14 |
15 | endVariable
16 |
17 | firstString
18 | "
19 | secondString
20 | '
21 | firstSingleLineComment
22 | //
23 | secondSingleLineComment
24 |
25 | beginFirstMultiLineComment
26 | /*
27 | endFirstMultiLineComment
28 | */
29 | beginSecondMultiLineComment
30 |
31 | endSecondMultiLineComment
32 |
33 | functionDefinition
34 | ^\s*(static|public|private|protected|internal).*\(.*\).*\n?\s*\{
35 | removeFromFunction
36 |
37 | keywordsCaseSensitive
38 |
39 | recolourKeywordIfAlreadyColoured
40 |
41 | keywords
42 |
43 | abstract
44 | break
45 | case
46 | catch
47 | continue
48 | default
49 | do
50 | else
51 | extends
52 | final
53 | finally
54 | for
55 | if
56 | implements
57 | instanceof
58 | native
59 | new
60 | private
61 | protected
62 | public
63 | return
64 | static
65 | switch
66 | synchronized
67 | throw
68 | throws
69 | transient
70 | try
71 | volatile
72 | while
73 | package
74 | import
75 | boolean
76 | byte
77 | char
78 | class
79 | double
80 | float
81 | int
82 | interface
83 | long
84 | short
85 | void
86 | assert
87 | strictfp
88 | false
89 | null
90 | super
91 | this
92 | true
93 | goto
94 | const
95 | enum
96 |
97 | autocompleteWords
98 |
99 |
100 |
101 |
--------------------------------------------------------------------------------
/Syntax Definitions/sml.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | beginCommand
6 |
7 | endCommand
8 |
9 | beginInstruction
10 |
11 | endInstruction
12 |
13 | beginVariable
14 |
15 | endVariable
16 |
17 | firstString
18 | "
19 | secondString
20 | '
21 | firstSingleLineComment
22 |
23 | secondSingleLineComment
24 |
25 | beginFirstMultiLineComment
26 | (*
27 | endFirstMultiLineComment
28 | *)
29 | beginSecondMultiLineComment
30 |
31 | endSecondMultiLineComment
32 |
33 | functionDefinition
34 |
35 | removeFromFunction
36 |
37 | keywordsCaseSensitive
38 |
39 | recolourKeywordIfAlreadyColoured
40 |
41 | keywords
42 |
43 | abstype
44 | and
45 | andalso
46 | as
47 | case
48 | do
49 | datatype
50 | else
51 | end
52 | eqtype
53 | exception
54 | false
55 | fn
56 | fun
57 | functor
58 | handle
59 | if
60 | in
61 | include
62 | infix
63 | infixr
64 | let
65 | local
66 | nonfix
67 | of
68 | op
69 | open
70 | orelse
71 | raise
72 | rec
73 | sharing
74 | sig
75 | signature
76 | struct
77 | structure
78 | then
79 | true
80 | type
81 | val
82 | where
83 | with
84 | withtype
85 | while
86 | unit
87 | int
88 | real
89 | char
90 | string
91 | substring
92 | word
93 | ref
94 | array
95 | vector
96 | bool
97 | list
98 | option
99 | order
100 |
101 | autocompleteWords
102 |
103 |
104 |
105 |
--------------------------------------------------------------------------------
/Syntax Definitions/javafx.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | beginCommand
6 |
7 | endCommand
8 |
9 | beginInstruction
10 |
11 | endInstruction
12 |
13 | beginVariable
14 |
15 | endVariable
16 |
17 | firstString
18 | "
19 | secondString
20 | '
21 | firstSingleLineComment
22 | //
23 | secondSingleLineComment
24 |
25 | beginFirstMultiLineComment
26 | /*
27 | endFirstMultiLineComment
28 | */
29 | beginSecondMultiLineComment
30 |
31 | endSecondMultiLineComment
32 |
33 | functionDefinition
34 |
35 | removeFromFunction
36 |
37 | keywordsCaseSensitive
38 |
39 | recolourKeywordIfAlreadyColoured
40 |
41 | keywords
42 |
43 | after
44 | as
45 | attribute
46 | before
47 | bind
48 | Boolean
49 | break
50 | catch
51 | class
52 | continue
53 | delete
54 | do
55 | else
56 | extends
57 | finally
58 | first
59 | for
60 | foreach
61 | format
62 | from
63 | function
64 | import
65 | if
66 | in
67 | indexof
68 | insert
69 | instanceof
70 | Integer
71 | into
72 | inverse
73 | last
74 | later
75 | lazy
76 | new
77 | Number
78 | on
79 | operation
80 | return
81 | reverse
82 | select
83 | sizeof
84 | String
85 | then
86 | this
87 | throw
88 | trigger
89 | try
90 | var
91 | where
92 | while
93 |
94 | autocompleteWords
95 |
96 |
97 |
98 |
--------------------------------------------------------------------------------
/PSMTabBar/PSMTabDragAssistant.h:
--------------------------------------------------------------------------------
1 | //
2 | // PSMTabDragAssistant.h
3 | // PSMTabBarControl
4 | //
5 | // Created by John Pannell on 4/10/06.
6 | // Copyright 2006 Positive Spin Media. All rights reserved.
7 | //
8 |
9 | /*
10 | This class is a sigleton that manages the details of a tab drag and drop. The details were beginning to overwhelm me when keeping all of this in the control and cells :-)
11 | */
12 |
13 | #import
14 | #import "PSMTabBarControl.h"
15 | @class PSMTabBarCell;
16 | @class PSMTabDragWindow;
17 |
18 | #define kPSMTabDragAnimationSteps 8
19 | #define PI 3.1417
20 |
21 | @interface PSMTabDragAssistant : NSObject {
22 | PSMTabBarControl *_sourceTabBar;
23 | PSMTabBarControl *_destinationTabBar;
24 | NSMutableSet *_participatingTabBars;
25 | PSMTabBarCell *_draggedCell;
26 | int _draggedCellIndex; // for snap back
27 | BOOL _isDragging;
28 |
29 | // Animation
30 | NSTimer *_animationTimer;
31 | NSMutableArray *_sineCurveWidths;
32 | NSPoint _currentMouseLoc;
33 | PSMTabBarCell *_targetCell;
34 | }
35 |
36 | // Creation/destruction
37 | + (PSMTabDragAssistant *)sharedDragAssistant;
38 |
39 | // Accessors
40 | - (PSMTabBarControl *)sourceTabBar;
41 | - (void)setSourceTabBar:(PSMTabBarControl *)tabBar;
42 | - (PSMTabBarControl *)destinationTabBar;
43 | - (void)setDestinationTabBar:(PSMTabBarControl *)tabBar;
44 | - (PSMTabBarCell *)draggedCell;
45 | - (void)setDraggedCell:(PSMTabBarCell *)cell;
46 | - (int)draggedCellIndex;
47 | - (void)setDraggedCellIndex:(int)value;
48 | - (BOOL)isDragging;
49 | - (void)setIsDragging:(BOOL)value;
50 | - (NSPoint)currentMouseLoc;
51 | - (void)setCurrentMouseLoc:(NSPoint)point;
52 | - (PSMTabBarCell *)targetCell;
53 | - (void)setTargetCell:(PSMTabBarCell *)cell;
54 |
55 | // Functionality
56 | - (void)startDraggingCell:(PSMTabBarCell *)cell fromTabBar:(PSMTabBarControl *)control withMouseDownEvent:(NSEvent *)event;
57 | - (void)draggingEnteredTabBar:(PSMTabBarControl *)control atPoint:(NSPoint)mouseLoc;
58 | - (void)draggingUpdatedInTabBar:(PSMTabBarControl *)control atPoint:(NSPoint)mouseLoc;
59 | - (void)draggingExitedTabBar:(PSMTabBarControl *)control;
60 | - (void)performDragOperation;
61 | - (void)draggedImageEndedAt:(NSPoint)aPoint operation:(NSDragOperation)operation;
62 | - (void)finishDrag;
63 |
64 | // Animation
65 | - (void)animateDrag:(NSTimer *)timer;
66 | - (void)calculateDragAnimationForTabBar:(PSMTabBarControl *)control;
67 |
68 | // Placeholder
69 | - (void)distributePlaceholdersInTabBar:(PSMTabBarControl *)control withDraggedCell:(PSMTabBarCell *)cell;
70 | - (void)distributePlaceholdersInTabBar:(PSMTabBarControl *)control;
71 | - (void)removeAllPlaceholdersFromTabBar:(PSMTabBarControl *)control;
72 |
73 | @end
74 |
75 | @interface PSMTabBarControl (DragAccessors)
76 |
77 | - (id)style;
78 | - (NSMutableArray *)cells;
79 | - (void)setControlView:(id)view;
80 | - (id)cellForPoint:(NSPoint)point cellFrame:(NSRectPointer)outFrame;
81 | - (PSMTabBarCell *)lastVisibleTab;
82 | - (int)numberOfVisibleTabs;
83 |
84 | @end
85 |
--------------------------------------------------------------------------------
/Other/DefaultCommands.plist:
--------------------------------------------------------------------------------
1 | {
2 | List = (
3 | {
4 | name = "Current path";
5 | text = "/bin/ls -AlFkhe %%p";
6 | },
7 | {
8 | name = "Current directory";
9 | text = "/bin/ls -AlFkhe %%d";
10 | },
11 | {
12 | name = "Home directory";
13 | text = "/bin/ls -AlFkhe ~";
14 | },
15 | {
16 | name = Desktop;
17 | text = "/bin/ls -AlFkhe ~/Desktop";
18 | },
19 | {
20 | name = "Spotlight path";
21 | text = "/usr/bin/mdls %%p";
22 | },
23 | );
24 | Convert = (
25 | {
26 | name = "Document to HTML";
27 | text = "/usr/bin/textutil -convert html -stdout -inputencoding 5 -encoding 5 %%p";
28 | inline = YES;
29 | },
30 | {
31 | name = "Document to plain text";
32 | text = "/usr/bin/textutil -convert txt -stdout -inputencoding 5 -encoding 5 %%p";
33 | inline = YES;
34 | },
35 | {
36 | name = "Selection to HTML entities";
37 | text = "#!/usr/bin/php\n";
38 | inline = YES;
39 | interpreter = "/usr/bin/php";
40 | },
41 | {
42 | name = "Selection from HTML entities to normal characters";
43 | text = "#!/usr/bin/php\n";
44 | inline = YES;
45 | },
46 | {
47 | name = "From binary plist to XML";
48 | text = "#!/bin/sh\n\ntempFile=/tmp/TextronTempFile.`/bin/date +%H%M%S`.$$\n\n/usr/bin/plutil -convert xml1 -o $tempFile %%p\n/bin/cat $tempFile\n/bin/rm -f $tempFile";
49 | },
50 | {
51 | name = "From XML plist to binary";
52 | text = "#!/bin/sh\n\ntempFile=/tmp/TextronTempFile.`/bin/date +%H%M%S`.$$\n\n/usr/bin/plutil -convert binary1 -o $tempFile %%p\n/bin/cat $tempFile\n/bin/rm -f $tempFile";
53 | },
54 | );
55 | Validate = (
56 | {
57 | name = HTML;
58 | text = "/usr/bin/tidy -errors %%p";
59 | },
60 | {
61 | name = "HTML accessibility";
62 | text = "/usr/bin/tidy -access 3 %%p";
63 | },
64 | {
65 | name = plist;
66 | text = "/usr/bin/plutil %%p";
67 | },
68 | {
69 | name = XML;
70 | text = "/usr/bin/xmllint -noout %%p";
71 | },
72 | );
73 | Other = (
74 | {
75 | name = "Run path";
76 | text = "/bin/sh %%p";
77 | },
78 | {
79 | name = "Show last log items";
80 | text = "/usr/bin/tail /var/log/system.log";
81 | },
82 | {
83 | name = "Insert current date";
84 | text = "/bin/date '+%Y-%m-%d %H:%M'";
85 | inline = YES;
86 | },
87 | {
88 | name = "Sort selected lines ascending";
89 | text = "#!/bin/sh\n\n/usr/bin/sort -f %%s";
90 | inline = YES;
91 | },
92 | {
93 | name = "Sort selected lines descending";
94 | text = "#!/bin/sh\n\n/usr/bin/sort -fr %%s";
95 | inline = YES;
96 | },
97 | {
98 | name = "Remove duplicate lines";
99 | text = "#!/bin/sh\n\n/usr/bin/uniq -u %%s";
100 | inline = YES;
101 | },
102 | {
103 | name = "Compile Java";
104 | text = "/usr/bin/javac %%p";
105 | },
106 | {
107 | name = "Make executable";
108 | text = "/bin/chmod u+x %%p";
109 | },
110 | );
111 | }
--------------------------------------------------------------------------------
/Classes/SMLPrintViewController.m:
--------------------------------------------------------------------------------
1 | /*
2 | Textron
3 | Based on Smultron Written by Peter Borg, pgw3@mac.com
4 | Find the latest version at http://vijaykiran.com/textron
5 |
6 | Copyright 2004-2009 Peter Borg
7 |
8 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
13 | */
14 |
15 | #import "SMLPrintViewController.h"
16 |
17 | #import "SMLStandardHeader.h"
18 |
19 |
20 | @implementation SMLPrintViewController
21 |
22 | @synthesize dummyValue;
23 |
24 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
25 | {
26 | return [super initWithNibName:@"SMLPrintAccessoryView" bundle:nibBundleOrNil];
27 | }
28 |
29 |
30 | - (void)awakeFromNib
31 | {
32 | [self setView:printAccessoryView];
33 |
34 | NSUserDefaultsController *defaultsController = [NSUserDefaultsController sharedUserDefaultsController];
35 |
36 | [defaultsController addObserver:self forKeyPath:@"values.PrintHeader" options:NSKeyValueObservingOptionNew context:@"PrinterSettingsChanged"];
37 | [defaultsController addObserver:self forKeyPath:@"values.PrintSyntaxColours" options:NSKeyValueObservingOptionNew context:@"PrinterSettingsChanged"];
38 | [defaultsController addObserver:self forKeyPath:@"values.OnlyPrintSelection" options:NSKeyValueObservingOptionNew context:@"PrinterSettingsChanged"];
39 | [defaultsController addObserver:self forKeyPath:@"values.MarginsMin" options:NSKeyValueObservingOptionNew context:@"PrinterSettingsChanged"];
40 | [defaultsController addObserver:self forKeyPath:@"values.PrintFont" options:NSKeyValueObservingOptionNew context:@"PrinterSettingsChanged"];
41 |
42 | [self performSelector:@selector(hackToMakeDisplayUpdateDirectly) withObject:nil afterDelay:0.0];
43 | }
44 |
45 |
46 | - (void)hackToMakeDisplayUpdateDirectly
47 | {
48 | [self setDummyValue:!dummyValue];
49 | }
50 |
51 |
52 | - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
53 | {
54 | if ([(NSString *)context isEqualToString:@"PrinterSettingsChanged"]) {
55 | [self setDummyValue:!dummyValue];
56 |
57 | } else {
58 | [super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
59 | }
60 |
61 | }
62 |
63 |
64 | - (NSSet *)keyPathsForValuesAffectingPreview
65 | {
66 | return [NSSet setWithObject:@"dummyValue"];
67 | }
68 |
69 |
70 | - (NSArray *)localizedSummaryItems
71 | {
72 | return [NSArray arrayWithObject:[NSDictionary dictionary]];
73 | }
74 |
75 |
76 | - (IBAction)setPrintFontAction:(id)sender
77 | {
78 | NSFontManager *fontManager = [NSFontManager sharedFontManager];
79 | [fontManager setSelectedFont:[NSUnarchiver unarchiveObjectWithData:[SMLDefaults valueForKey:@"PrintFont"]] isMultiple:NO];
80 | [fontManager orderFrontFontPanel:nil];
81 | }
82 |
83 | @end
84 |
--------------------------------------------------------------------------------
/Classes/NSToolbarItem+Textron.m:
--------------------------------------------------------------------------------
1 | /*
2 | Textron
3 | Based on Smultron Written by Peter Borg, pgw3@mac.com
4 | Find the latest version at http://vijaykiran.com/textron
5 |
6 | Copyright 2004-2009 Peter Borg
7 |
8 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
13 | */
14 |
15 | #import "NSToolbarItem+Textron.h"
16 |
17 |
18 | @implementation NSToolbarItem (NSToolbarItemTextron)
19 |
20 |
21 | + (NSToolbarItem *)createToolbarItemWithIdentifier:(NSString *)itemIdentifier name:(NSString *)name image:(NSImage *)image action:(SEL)selector tag:(NSInteger)tag target:(id)target
22 | {
23 | NSToolbarItem *toolbarItem = [[NSToolbarItem alloc] initWithItemIdentifier:itemIdentifier];
24 |
25 | // [toolbarItem setLabel:name];
26 | // [toolbarItem setPaletteLabel:name];
27 | // [toolbarItem setToolTip:name];
28 | // [toolbarItem setTag:tag];
29 | //
30 | // [toolbarItem setImage:image];
31 | // [toolbarItem setTarget:target];
32 | // [toolbarItem setAction:selector];
33 |
34 | NSRect toolbarItemRect = NSMakeRect(0.0, 0.0, 28.0, 27.0);
35 |
36 | NSView *view = [[NSView alloc] initWithFrame:toolbarItemRect];
37 | NSButton *button = [[NSButton alloc] initWithFrame:toolbarItemRect];
38 | [button setBezelStyle:NSTexturedRoundedBezelStyle];
39 | [button setTitle:@""];
40 | [button setImage:image];
41 | [button setTarget:target];
42 | [button setAction:selector];
43 | [[button cell] setImageScaling:NSImageScaleProportionallyDown];
44 | [button setImagePosition:NSImageOnly];
45 |
46 | [toolbarItem setLabel:name];
47 | [toolbarItem setPaletteLabel:name];
48 | [toolbarItem setToolTip:name];
49 |
50 | [view addSubview:button];
51 |
52 | [toolbarItem setTag:tag];
53 | [toolbarItem setView:view];
54 |
55 | return toolbarItem;
56 | }
57 |
58 |
59 | + (NSToolbarItem *)createPreferencesToolbarItemWithIdentifier:(NSString *)itemIdentifier name:(NSString *)name image:(NSImage *)image action:(SEL)selector target:(id)target
60 | {
61 | NSToolbarItem *toolbarItem = [[NSToolbarItem alloc] initWithItemIdentifier:itemIdentifier];
62 |
63 | [toolbarItem setLabel:name];
64 | [toolbarItem setPaletteLabel:name];
65 | [toolbarItem setToolTip:name];
66 |
67 | [toolbarItem setImage:image];
68 | [toolbarItem setTarget:target];
69 | [toolbarItem setAction:selector];
70 |
71 | return toolbarItem;
72 | }
73 |
74 |
75 | + (NSToolbarItem *)createSeachFieldToolbarItemWithIdentifier:(NSString *)itemIdentifier name:(NSString *)name view:(NSView *)view
76 | {
77 | NSToolbarItem *toolbarItem = [[NSToolbarItem alloc] initWithItemIdentifier:itemIdentifier];
78 | [toolbarItem setLabel:name];
79 | [toolbarItem setToolTip:name];
80 | [toolbarItem setPaletteLabel:name];
81 | [toolbarItem setView:view];
82 | [toolbarItem setMinSize:NSMakeSize(70, 32)];
83 | [toolbarItem setMaxSize:NSMakeSize(200, 32)];
84 |
85 | return toolbarItem;
86 | }
87 | @end
88 |
--------------------------------------------------------------------------------
/Syntax Definitions/dylan.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | beginCommand
6 |
7 | endCommand
8 |
9 | beginInstruction
10 |
11 | endInstruction
12 |
13 | beginVariable
14 | <
15 | endVariable
16 | >
17 | firstString
18 | "
19 | secondString
20 | '
21 | firstSingleLineComment
22 | //
23 | secondSingleLineComment
24 |
25 | beginFirstMultiLineComment
26 | /*
27 | endFirstMultiLineComment
28 | */
29 | beginSecondMultiLineComment
30 |
31 | endSecondMultiLineComment
32 |
33 | functionDefinition
34 |
35 | removeFromFunction
36 |
37 | keywordsCaseSensitive
38 |
39 | recolourKeywordIfAlreadyColoured
40 |
41 | keywords
42 |
43 | afterwards
44 | above
45 | abstract
46 | below
47 | begin
48 | block
49 | by
50 | case
51 | class
52 | cleanup
53 | concrete
54 | constant
55 | create
56 | define
57 | domain
58 | else
59 | elseif
60 | end
61 | exception
62 | exclude
63 | export
64 | finally
65 | for
66 | from
67 | function
68 | functional
69 | generic
70 | handler
71 | if
72 | import
73 | in
74 | inherited
75 | inline
76 | instance
77 | interface
78 | library
79 | let
80 | local
81 | macro
82 | method
83 | open
84 | otherwise
85 | primary
86 | rename
87 | sealed
88 | select
89 | sideways
90 | signal
91 | singleton
92 | slot
93 | subclass
94 | then
95 | to
96 | unless
97 | until
98 | use
99 | variable
100 | virtual
101 | when
102 | while
103 |
104 | autocompleteWords
105 |
106 |
107 |
108 |
109 |
--------------------------------------------------------------------------------
/Syntax Definitions/vb.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | beginCommand
6 |
7 | endCommand
8 |
9 | beginInstruction
10 |
11 | endInstruction
12 |
13 | beginVariable
14 |
15 | endVariable
16 |
17 | firstString
18 | "
19 | secondString
20 |
21 | firstSingleLineComment
22 | '
23 | secondSingleLineComment
24 |
25 | beginFirstMultiLineComment
26 |
27 | endFirstMultiLineComment
28 |
29 | beginSecondMultiLineComment
30 |
31 | endSecondMultiLineComment
32 |
33 | functionDefinition
34 | ^\s*\w*(function|sub)\s+.*
35 | removeFromFunction
36 | function
37 | keywordsCaseSensitive
38 |
39 | recolourKeywordIfAlreadyColoured
40 |
41 | keywords
42 |
43 | if
44 | then
45 | else
46 | elseif
47 | select
48 | case
49 | for
50 | to
51 | step
52 | next
53 | each
54 | in
55 | do
56 | while
57 | until
58 | loop
59 | wend
60 | exit
61 | end
62 | function
63 | sub
64 | class
65 | property
66 | get
67 | let
68 | set
69 | byval
70 | byref
71 | const
72 | dim
73 | redim
74 | preserve
75 | as
76 | set
77 | with
78 | new
79 | public
80 | default
81 | private
82 | rem
83 | call
84 | execute
85 | eval
86 | on
87 | error
88 | goto
89 | resume
90 | option
91 | explicit
92 | erase
93 | randomize
94 | is
95 | mod
96 | and
97 | or
98 | not
99 | xor
100 | imp
101 | false
102 | true
103 | empty
104 | nothing
105 | null
106 |
107 | autocompleteWords
108 |
109 |
110 |
111 |
112 |
--------------------------------------------------------------------------------
/ICU/icu/unicode/parseerr.h:
--------------------------------------------------------------------------------
1 | /*
2 | **********************************************************************
3 | * Copyright (C) 1999-2004, International Business Machines
4 | * Corporation and others. All Rights Reserved.
5 | **********************************************************************
6 | * Date Name Description
7 | * 03/14/00 aliu Creation.
8 | * 06/27/00 aliu Change from C++ class to C struct
9 | **********************************************************************
10 | */
11 | #ifndef PARSEERR_H
12 | #define PARSEERR_H
13 |
14 | #include "unicode/utypes.h"
15 |
16 |
17 | /**
18 | * The capacity of the context strings in UParseError.
19 | * @stable ICU 2.0
20 | */
21 | enum { U_PARSE_CONTEXT_LEN = 16 };
22 |
23 | /**
24 | * A UParseError struct is used to returned detailed information about
25 | * parsing errors. It is used by ICU parsing engines that parse long
26 | * rules, patterns, or programs, where the text being parsed is long
27 | * enough that more information than a UErrorCode is needed to
28 | * localize the error.
29 | *
30 | * The line, offset, and context fields are optional; parsing
31 | * engines may choose not to use to use them.
32 | *
33 | *
The preContext and postContext strings include some part of the
34 | * context surrounding the error. If the source text is "let for=7"
35 | * and "for" is the error (e.g., because it is a reserved word), then
36 | * some examples of what a parser might produce are the following:
37 | *
38 | *
39 | * preContext postContext
40 | * "" "" The parser does not support context
41 | * "let " "=7" Pre- and post-context only
42 | * "let " "for=7" Pre- and post-context and error text
43 | * "" "for" Error text only
44 | *
45 | *
46 | * Examples of engines which use UParseError (or may use it in the
47 | * future) are Transliterator, RuleBasedBreakIterator, and
48 | * RegexPattern.
49 | *
50 | * @stable ICU 2.0
51 | */
52 | typedef struct UParseError {
53 |
54 | /**
55 | * The line on which the error occured. If the parser uses this
56 | * field, it sets it to the line number of the source text line on
57 | * which the error appears, which will be be a value >= 1. If the
58 | * parse does not support line numbers, the value will be <= 0.
59 | * @stable ICU 2.0
60 | */
61 | int32_t line;
62 |
63 | /**
64 | * The character offset to the error. If the line field is >= 1,
65 | * then this is the offset from the start of the line. Otherwise,
66 | * this is the offset from the start of the text. If the parser
67 | * does not support this field, it will have a value < 0.
68 | * @stable ICU 2.0
69 | */
70 | int32_t offset;
71 |
72 | /**
73 | * Textual context before the error. Null-terminated. The empty
74 | * string if not supported by parser.
75 | * @stable ICU 2.0
76 | */
77 | UChar preContext[U_PARSE_CONTEXT_LEN];
78 |
79 | /**
80 | * The error itself and/or textual context after the error.
81 | * Null-terminated. The empty string if not supported by parser.
82 | * @stable ICU 2.0
83 | */
84 | UChar postContext[U_PARSE_CONTEXT_LEN];
85 |
86 | } UParseError;
87 |
88 | #endif
89 |
--------------------------------------------------------------------------------
/Classes/SMLGutterTextView.m:
--------------------------------------------------------------------------------
1 | /*
2 | Textron
3 | Based on Smultron Written by Peter Borg, pgw3@mac.com
4 | Find the latest version at http://vijaykiran.com/textron
5 |
6 | Copyright 2004-2009 Peter Borg
7 |
8 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
13 | */
14 |
15 | #import "SMLStandardHeader.h"
16 |
17 | #import "SMLGutterTextView.h"
18 |
19 | @implementation SMLGutterTextView
20 |
21 | - (id)initWithFrame:(NSRect)frame
22 | {
23 | if (self = [super initWithFrame:frame]) {
24 |
25 | [self setContinuousSpellCheckingEnabled:NO];
26 | [self setAllowsUndo:NO];
27 | [self setAllowsDocumentBackgroundColorChange:NO];
28 | [self setRichText:NO];
29 | [self setUsesFindPanel:NO];
30 | [self setUsesFontPanel:NO];
31 | [self setAlignment:NSRightTextAlignment];
32 | [self setEditable:NO];
33 | [self setSelectable:NO];
34 | [[self textContainer] setContainerSize:NSMakeSize([[SMLDefaults valueForKey:@"GutterWidth"] integerValue], FLT_MAX)];
35 | [self setVerticallyResizable:YES];
36 | [self setHorizontallyResizable:YES];
37 | [self setAutoresizingMask:NSViewHeightSizable];
38 |
39 | [self setFont:[NSUnarchiver unarchiveObjectWithData:[SMLDefaults valueForKey:@"TextFont"]]];
40 | [self setTextColor:[NSColor textColor]];//[NSUnarchiver unarchiveObjectWithData:[SMLDefaults valueForKey:@"TextColourWell"]]];
41 | [self setInsertionPointColor:[NSColor textColor]];//[NSUnarchiver unarchiveObjectWithData:[SMLDefaults valueForKey:@"TextColourWell"]]];
42 | [self setBackgroundColor:[NSColor colorWithCalibratedWhite:0.94 alpha:1.0]];
43 |
44 | NSUserDefaultsController *defaultsController = [NSUserDefaultsController sharedUserDefaultsController];
45 | [defaultsController addObserver:self forKeyPath:@"values.TextFont" options:NSKeyValueObservingOptionNew context:@"TextFontChanged"];
46 | }
47 | return self;
48 | }
49 |
50 |
51 | - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
52 | {
53 | if ([(NSString *)context isEqualToString:@"TextFontChanged"]) {
54 | [self setFont:[NSUnarchiver unarchiveObjectWithData:[SMLDefaults valueForKey:@"TextFont"]]];
55 | } else {
56 | [super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
57 | }
58 | }
59 |
60 |
61 | - (void)drawRect:(NSRect)rect
62 | {
63 | [super drawRect:rect];
64 |
65 | NSRect bounds = [self bounds];
66 | if ([self needsToDrawRect:NSMakeRect(bounds.size.width - 1, 0, 1, bounds.size.height)] == YES) {
67 | [[NSColor lightGrayColor] set];
68 | NSBezierPath *dottedLine = [NSBezierPath bezierPathWithRect:NSMakeRect(bounds.size.width, 0, 0, bounds.size.height)];
69 | CGFloat dash[2];
70 | dash[0] = 1.0;
71 | dash[1] = 2.0;
72 | [dottedLine setLineDash:dash count:2 phase:1.0];
73 | [dottedLine stroke];
74 | }
75 |
76 | }
77 |
78 |
79 | - (BOOL)isOpaque
80 | {
81 | return YES;
82 | }
83 |
84 | @end
85 |
--------------------------------------------------------------------------------
/PSMTabBar/PSMTabBarCell.h:
--------------------------------------------------------------------------------
1 | //
2 | // PSMTabBarCell.h
3 | // PSMTabBarControl
4 | //
5 | // Created by John Pannell on 10/13/05.
6 | // Copyright 2005 Positive Spin Media. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "PSMTabBarControl.h"
11 |
12 | @class PSMTabBarControl;
13 |
14 |
15 | @interface PSMTabBarCell : NSActionCell {
16 | // sizing
17 | NSRect _frame;
18 | NSSize _stringSize;
19 | int _currentStep;
20 | BOOL _isPlaceholder;
21 |
22 | // state
23 | int _tabState;
24 | NSTrackingRectTag _closeButtonTrackingTag; // left side tracking, if dragging
25 | NSTrackingRectTag _cellTrackingTag; // right side tracking, if dragging
26 | BOOL _closeButtonOver;
27 | BOOL _closeButtonPressed;
28 | NSProgressIndicator *_indicator;
29 | BOOL _isInOverflowMenu;
30 | BOOL _hasCloseButton;
31 | BOOL _isCloseButtonSuppressed;
32 | BOOL _hasIcon;
33 | int _count;
34 | }
35 |
36 | // creation/destruction
37 | - (id)initWithControlView:(PSMTabBarControl *)controlView;
38 | - (id)initPlaceholderWithFrame:(NSRect)frame expanded:(BOOL)value inControlView:(PSMTabBarControl *)controlView;
39 |
40 | // accessors
41 | - (id)controlView;
42 | - (void)setControlView:(id)view;
43 | - (NSTrackingRectTag)closeButtonTrackingTag;
44 | - (void)setCloseButtonTrackingTag:(NSTrackingRectTag)tag;
45 | - (NSTrackingRectTag)cellTrackingTag;
46 | - (void)setCellTrackingTag:(NSTrackingRectTag)tag;
47 | - (float)width;
48 | - (NSRect)frame;
49 | - (void)setFrame:(NSRect)rect;
50 | - (void)setStringValue:(NSString *)aString;
51 | - (NSSize)stringSize;
52 | - (NSAttributedString *)attributedStringValue;
53 | - (int)tabState;
54 | - (void)setTabState:(int)state;
55 | - (NSProgressIndicator *)indicator;
56 | - (BOOL)isInOverflowMenu;
57 | - (void)setIsInOverflowMenu:(BOOL)value;
58 | - (BOOL)closeButtonPressed;
59 | - (void)setCloseButtonPressed:(BOOL)value;
60 | - (BOOL)closeButtonOver;
61 | - (void)setCloseButtonOver:(BOOL)value;
62 | - (BOOL)hasCloseButton;
63 | - (void)setHasCloseButton:(BOOL)set;
64 | - (void)setCloseButtonSuppressed:(BOOL)suppress;
65 | - (BOOL)isCloseButtonSuppressed;
66 | - (BOOL)hasIcon;
67 | - (void)setHasIcon:(BOOL)value;
68 | - (int)count;
69 | - (void)setCount:(int)value;
70 | - (BOOL)isPlaceholder;
71 | - (void)setIsPlaceholder:(BOOL)value;
72 | - (int)currentStep;
73 | - (void)setCurrentStep:(int)value;
74 |
75 | // component attributes
76 | - (NSRect)indicatorRectForFrame:(NSRect)cellFrame;
77 | - (NSRect)closeButtonRectForFrame:(NSRect)cellFrame;
78 | - (float)minimumWidthOfCell;
79 | - (float)desiredWidthOfCell;
80 |
81 | // drawing
82 | - (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView;
83 |
84 | // tracking the mouse
85 | - (void)mouseEntered:(NSEvent *)theEvent;
86 | - (void)mouseExited:(NSEvent *)theEvent;
87 |
88 | // drag support
89 | - (NSImage*)dragImageForRect:(NSRect)cellFrame;
90 |
91 | // archiving
92 | - (void)encodeWithCoder:(NSCoder *)aCoder;
93 | - (id)initWithCoder:(NSCoder *)aDecoder;
94 |
95 | @end
96 |
97 | @interface PSMTabBarControl (CellAccessors)
98 |
99 | - (id)style;
100 |
101 | @end
102 |
--------------------------------------------------------------------------------