Skip to content

Commit 9da0dfe

Browse files
committedMar 15, 2011
fix 10.5 compatibility
git-svn-id: https://svn.r-project.org/R-packages/trunk/Mac-GUI@5708 694ef91d-65df-0310-b7bb-92e67a308ead
1 parent b9452bc commit 9da0dfe

27 files changed

+82
-82
lines changed
 

‎CCComp.h

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* CCComp.h - Common Cocoa Compatibility
3+
* R
4+
*
5+
* Include in all files instead of Cocoa, it provides compatibility work-arounds.
6+
*
7+
* Created by Simon Urbanek on 3/15/11.
8+
* Copyright 2011 Simon Urbanek. All rights reserved.
9+
*
10+
*/
11+
12+
#import <Cocoa/Cocoa.h>
13+
#import <Availability.h>
14+
15+
/* the following protocols are new in 10.6 (and useful) so for older OS X we have to define them */
16+
#ifndef MAC_OS_X_VERSION_10_6
17+
#define MAC_OS_X_VERSION_10_6 1060
18+
#endif
19+
#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6
20+
@protocol NSTextStorageDelegate <NSObject>
21+
@optional
22+
- (void)textStorageWillProcessEditing:(NSNotification *)notification; /* Delegate can change the characters or attributes */
23+
- (void)textStorageDidProcessEditing:(NSNotification *)notification; /* Delegate can change the attributes */
24+
@end
25+
@protocol NSToolbarDelegate <NSObject>
26+
@optional
27+
- (NSToolbarItem *)toolbar:(NSToolbar *)toolbar itemForItemIdentifier:(NSString *)itemIdentifier willBeInsertedIntoToolbar:(BOOL)flag;
28+
- (NSArray *)toolbarDefaultItemIdentifiers:(NSToolbar*)toolbar;
29+
- (NSArray *)toolbarAllowedItemIdentifiers:(NSToolbar*)toolbar;
30+
- (NSArray *)toolbarSelectableItemIdentifiers:(NSToolbar *)toolbar;
31+
- (void)toolbarWillAddItem: (NSNotification *)notification;
32+
- (void)toolbarDidRemoveItem: (NSNotification *)notification;
33+
@end
34+
#endif
35+
36+
/* for pre-10.5 compatibility */
37+
#ifndef NSINTEGER_DEFINED
38+
#if __LP64__ || NS_BUILD_32_LIKE_64
39+
typedef long NSInteger;
40+
typedef unsigned long NSUInteger;
41+
#else
42+
typedef int NSInteger;
43+
typedef unsigned int NSUInteger;
44+
#endif
45+
#define NSINTEGER_DEFINED 1
46+
#endif

‎DataManager.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
/* DataManager */
3131

32-
#import <Cocoa/Cocoa.h>
32+
#import "CCComp.h"
3333
#import "Tools/SortableDataSource.h"
3434

3535
@interface DataManager : NSObject

‎HelpManager.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
/* HelpManager */
3131

32-
#import <Cocoa/Cocoa.h>
32+
#import "CCComp.h"
3333
#import <WebKit/WebKit.h>
3434
#import <WebKit/WebFrame.h>
3535

‎PackageInstaller.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
#define kBinary 1
4747
#define kSource 0
4848

49-
#import <Cocoa/Cocoa.h>
49+
#import "CCComp.h"
5050

5151
@interface PackageEntry : NSObject {
5252
NSString *name;

‎PackageInstaller.m

-12
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,6 @@
4747
@".libPaths()[1]"
4848
};
4949

50-
/* for pre-10.5 compatibility */
51-
#ifndef NSINTEGER_DEFINED
52-
#if __LP64__ || NS_BUILD_32_LIKE_64
53-
typedef long NSInteger;
54-
typedef unsigned long NSUInteger;
55-
#else
56-
typedef int NSInteger;
57-
typedef unsigned int NSUInteger;
58-
#endif
59-
#define NSINTEGER_DEFINED 1
60-
#endif
61-
6250
@interface PackageEntry (PrivateMethods)
6351
- (NSString*) name;
6452
- (NSString*) iver;

‎PackageManager.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
/* PackageManager */
3131

32-
#import <Cocoa/Cocoa.h>
32+
#import "CCComp.h"
3333

3434
// structure holding all available data about a package
3535
typedef struct pkgManagerEntry {

‎Preferences.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
* Create by Simon Urbanek on 12/5/2004
3030
*/
3131

32-
#import <Cocoa/Cocoa.h>
32+
#import "CCComp.h"
3333

3434
@protocol PreferencesDependent
3535
- (void) updatePreferences;

‎R.xcodeproj/project.pbxproj

+5-2
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@
135135
6807116E0EB0CD4200436993 /* InfoPlist.h in Headers */ = {isa = PBXBuildFile; fileRef = 6807116D0EB0CD4200436993 /* InfoPlist.h */; };
136136
6807E645080EAE4100A03223 /* GlobalExHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 6807E643080EAE4100A03223 /* GlobalExHandler.h */; };
137137
6807E646080EAE4100A03223 /* GlobalExHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 6807E644080EAE4100A03223 /* GlobalExHandler.m */; };
138+
6825104D132F337800367C93 /* CCComp.h in Headers */ = {isa = PBXBuildFile; fileRef = 6825104C132F337800367C93 /* CCComp.h */; };
138139
6828383907804DFC004617B7 /* ExceptionHandling.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6828383807804DFC004617B7 /* ExceptionHandling.framework */; };
139140
684D008507BD72BE0047EEF6 /* SyntaxColorsPrefPane.h in Headers */ = {isa = PBXBuildFile; fileRef = 684D008307BD72BE0047EEF6 /* SyntaxColorsPrefPane.h */; };
140141
684D008607BD72BE0047EEF6 /* SyntaxColorsPrefPane.m in Sources */ = {isa = PBXBuildFile; fileRef = 684D008407BD72BE0047EEF6 /* SyntaxColorsPrefPane.m */; };
@@ -361,6 +362,7 @@
361362
6807E644080EAE4100A03223 /* GlobalExHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GlobalExHandler.m; sourceTree = "<group>"; };
362363
6812EC9E07BA6A360000B6A8 /* de */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = de; path = de.lproj/EditorPrefPane.nib; sourceTree = "<group>"; };
363364
681D40BE081D653B0019CB4C /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = fr; path = fr.lproj/Credits.rtf; sourceTree = "<group>"; };
365+
6825104C132F337800367C93 /* CCComp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCComp.h; sourceTree = "<group>"; };
364366
6828383807804DFC004617B7 /* ExceptionHandling.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ExceptionHandling.framework; path = /System/Library/Frameworks/ExceptionHandling.framework; sourceTree = "<absolute>"; };
365367
684D008307BD72BE0047EEF6 /* SyntaxColorsPrefPane.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SyntaxColorsPrefPane.h; sourceTree = "<group>"; };
366368
684D008407BD72BE0047EEF6 /* SyntaxColorsPrefPane.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SyntaxColorsPrefPane.m; sourceTree = "<group>"; };
@@ -725,6 +727,7 @@
725727
isa = PBXGroup;
726728
children = (
727729
68F84C6109ABB2BF0098D772 /* privateR.h */,
730+
6825104C132F337800367C93 /* CCComp.h */,
728731
32CA4F630368D1EE00C91783 /* R_Prefix.pch */,
729732
6855194007B8FDDF00F3A57C /* RGUI.h */,
730733
29B97316FDCFA39411CA2CEA /* main.m */,
@@ -887,6 +890,7 @@
887890
BC12B313130A65CE009F7D3F /* RScriptEditorTextView.h in Headers */,
888891
BCCE4A38130AB3C6003325EB /* RScriptEditorTokens.h in Headers */,
889892
BC12DC4A130EC12900FB39CE /* NoodleLineNumberView.h in Headers */,
893+
6825104D132F337800367C93 /* CCComp.h in Headers */,
890894
);
891895
runOnlyForDeploymentPostprocessing = 0;
892896
};
@@ -938,7 +942,6 @@
938942
isa = PBXProject;
939943
buildConfigurationList = 680F0B3A0997CE66009CDBE8 /* Build configuration list for PBXProject "R" */;
940944
compatibilityVersion = "Xcode 2.4";
941-
developmentRegion = English;
942945
hasScannedForEncodings = 1;
943946
knownRegions = (
944947
English,
@@ -1780,8 +1783,8 @@
17801783
INFOPLIST_PREFIX_HEADER = InfoPlist.h;
17811784
INFOPLIST_PREPROCESS = YES;
17821785
INFOPLIST_PREPROCESSOR_DEFINITIONS = "DEBUG_CFG=1";
1783-
STRIP_INSTALLED_PRODUCT = NO;
17841786
STRINGS_FILE_OUTPUT_ENCODING = "UTF-8";
1787+
STRIP_INSTALLED_PRODUCT = NO;
17851788
};
17861789
name = Debug;
17871790
};

‎RController.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
#include <R_ext/eventloop.h>
3838
#import <sys/types.h>
3939

40-
#import <Cocoa/Cocoa.h>
40+
#import "CCComp.h"
4141
#import <WebKit/WebKit.h>
4242

4343
#import "Tools/History.h"

‎RDocument.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,8 @@
2828
*/
2929

3030

31-
#import <Cocoa/Cocoa.h>
31+
#import "CCComp.h"
3232
#import "Preferences.h"
33-
//#import "RDocumentWinCtrl.h"
3433

3534
@class RDocumentWinCtrl;
3635

‎RDocumentController.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
/* RDocumentController */
3131

32-
#import <Cocoa/Cocoa.h>
32+
#import "CCComp.h"
3333
#import "Preferences.h"
3434
#import "RDocument.h"
3535

‎RDocumentWinCtrl.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
* Created by Simon Urbanek on 1/11/05.
3030
*/
3131

32-
#import <Cocoa/Cocoa.h>
32+
#import "CCComp.h"
3333
#import "Preferences.h"
3434
#import "RDocument.h"
3535
#import "RScriptEditorTextView.h"

‎REditor.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
/* REditor */
3131

32-
#import <Cocoa/Cocoa.h>
32+
#import "CCComp.h"
3333

3434
#define DataEditorToolbarIdentifier @"DataEditor Toolbar Identifier"
3535
#define AddColToolbarItemIdentifier @"Add Column"

‎REditor.m

-12
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,6 @@
3838
#include <Rinternals.h>
3939
#include <Rversion.h>
4040

41-
/* for pre-10.5 compatibility */
42-
#ifndef NSINTEGER_DEFINED
43-
#if __LP64__ || NS_BUILD_32_LIKE_64
44-
typedef long NSInteger;
45-
typedef unsigned long NSUInteger;
46-
#else
47-
typedef int NSInteger;
48-
typedef unsigned int NSUInteger;
49-
#endif
50-
#define NSINTEGER_DEFINED 1
51-
#endif
52-
5341
#ifndef max
5442
#define max(x,y) x<y?y:x;
5543
#endif

‎REditorTextStorage.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
* Created by Simon Urbanek on 1/11/05.
3030
*/
3131

32-
#import <Cocoa/Cocoa.h>
32+
#import "CCComp.h"
3333
#import "Preferences.h"
3434

3535
@interface REditorTextStorage : NSTextStorage <PreferencesDependent> {

‎REditorToolbar.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
* Created by Simon Urbanek on 4/1/05.
3333
*/
3434

35-
#import <Cocoa/Cocoa.h>
35+
#import "CCComp.h"
3636
#import "RDocumentWinCtrl.h"
3737

3838
#define RETI_Save @"RETI Save Document"

‎RRulerView.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* inspired by LineNumbering example authored by Koen van der Drift.
3232
*/
3333

34-
#import <Cocoa/Cocoa.h>
34+
#import "CCComp.h"
3535
#import "PreferenceKeys.h"
3636
#import "Preferences.h"
3737

‎RScriptEditorTextView.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
*
3333
*/
3434

35-
#import <Cocoa/Cocoa.h>
35+
#import "CCComp.h"
3636
#import "RTextView.h"
3737
#import "Preferences.h"
3838
#import "PreferenceKeys.h"

‎RTextView.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
* $Id$
3131
*/
3232

33-
#import <Cocoa/Cocoa.h>
33+
#import "CCComp.h"
3434

3535
/* RTextView is a subclass of NSTextView with some additional properties:
3636
- responds to <Ctrl><.> by sending complete: to self

‎SearchTable.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
/* SearchTable */
3131

32-
#import <Cocoa/Cocoa.h>
32+
#import "CCComp.h"
3333
#import <WebKit/WebKit.h>
3434
#import <WebKit/WebFrame.h>
3535
#import "Tools/SortableDataSource.h"

‎SelectList.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
/* SelectList */
3131

32-
#import <Cocoa/Cocoa.h>
32+
#import "CCComp.h"
3333

3434
@interface SelectList : NSObject
3535
{

‎SelectList.m

-12
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,6 @@
3030
#import "RGUI.h"
3131
#import "SelectList.h"
3232

33-
/* for pre-10.5 compatibility */
34-
#ifndef NSINTEGER_DEFINED
35-
#if __LP64__ || NS_BUILD_32_LIKE_64
36-
typedef long NSInteger;
37-
typedef unsigned long NSUInteger;
38-
#else
39-
typedef int NSInteger;
40-
typedef unsigned int NSUInteger;
41-
#endif
42-
#define NSINTEGER_DEFINED 1
43-
#endif
44-
4533
static SelectList *sharedController = nil;
4634

4735
@implementation SelectList

‎Tools/SortableDataSource.h

+12
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,18 @@ typedef unsigned int NSUInteger;
4141
#define NSINTEGER_DEFINED 1
4242
#endif
4343

44+
@protocol NSTableViewDataSource <NSObject>
45+
- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView;
46+
- (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row;
47+
@optional
48+
- (void)tableView:(NSTableView *)tableView setObjectValue:(id)object forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row;
49+
- (void)tableView:(NSTableView *)tableView sortDescriptorsDidChange:(NSArray *)oldDescriptors;
50+
- (BOOL)tableView:(NSTableView *)tableView writeRowsWithIndexes:(NSIndexSet *)rowIndexes toPasteboard:(NSPasteboard *)pboard;
51+
- (NSDragOperation)tableView:(NSTableView *)tableView validateDrop:(id <NSDraggingInfo>)info proposedRow:(NSInteger)row proposedDropOperation:(NSTableViewDropOperation)dropOperation;
52+
- (BOOL)tableView:(NSTableView *)tableView acceptDrop:(id <NSDraggingInfo>)info row:(NSInteger)row dropOperation:(NSTableViewDropOperation)dropOperation;
53+
- (NSArray *)tableView:(NSTableView *)tableView namesOfPromisedFilesDroppedAtDestination:(NSURL *)dropDestination forDraggedRowsWithIndexes:(NSIndexSet *)indexSet;
54+
@end
55+
4456
@interface SortableDataSource : NSObject <NSTableViewDataSource> {
4557
NSMutableArray *col;
4658
NSMutableArray *colNames;

‎VignettesController.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* VignettesController */
22

3-
#import <Cocoa/Cocoa.h>
43
#import "RGUI.h"
4+
#import "CCComp.h"
55
#import "Tools/SortableDataSource.h"
66
#import "Tools/PDFImageView.h"
77

‎VignettesController.m

-12
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,6 @@
33
#import "REngine/REngine.h"
44
#import "REngine/RSEXP.h"
55

6-
/* for pre-10.5 compatibility */
7-
#ifndef NSINTEGER_DEFINED
8-
#if __LP64__ || NS_BUILD_32_LIKE_64
9-
typedef long NSInteger;
10-
typedef unsigned long NSUInteger;
11-
#else
12-
typedef int NSInteger;
13-
typedef unsigned int NSUInteger;
14-
#endif
15-
#define NSINTEGER_DEFINED 1
16-
#endif
17-
186
@implementation VignettesController
197

208
static VignettesController *vignettesSharedController = nil;

‎WSBrowser.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
/* WSBrowser */
3131

32-
#import <Cocoa/Cocoa.h>
32+
#import "CCComp.h"
3333

3434
#define WorkSpaceBrowserToolbarIdentifier @"WorkSpaceBrowser Toolbar Identifier"
3535

‎WSBrowser.m

-12
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,6 @@
5353
#define PROP_KEY @"property"
5454
#define CHILD_KEY @"children"
5555

56-
/* for pre-10.5 compatibility */
57-
#ifndef NSINTEGER_DEFINED
58-
#if __LP64__ || NS_BUILD_32_LIKE_64
59-
typedef long NSInteger;
60-
typedef unsigned long NSUInteger;
61-
#else
62-
typedef int NSInteger;
63-
typedef unsigned int NSUInteger;
64-
#endif
65-
#define NSINTEGER_DEFINED 1
66-
#endif
67-
6856
@implementation WSBrowser
6957

7058

0 commit comments

Comments
 (0)
Please sign in to comment.