Skip to content

Commit

Permalink
fix 10.5 compatibility
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.r-project.org/R-packages/trunk/Mac-GUI@5708 694ef91d-65df-0310-b7bb-92e67a308ead
  • Loading branch information
s-u committed Mar 15, 2011
1 parent b9452bc commit 9da0dfe
Show file tree
Hide file tree
Showing 27 changed files with 82 additions and 82 deletions.
46 changes: 46 additions & 0 deletions CCComp.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* CCComp.h - Common Cocoa Compatibility
* R
*
* Include in all files instead of Cocoa, it provides compatibility work-arounds.
*
* Created by Simon Urbanek on 3/15/11.
* Copyright 2011 Simon Urbanek. All rights reserved.
*
*/

#import <Cocoa/Cocoa.h>
#import <Availability.h>

/* the following protocols are new in 10.6 (and useful) so for older OS X we have to define them */
#ifndef MAC_OS_X_VERSION_10_6
#define MAC_OS_X_VERSION_10_6 1060
#endif
#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6
@protocol NSTextStorageDelegate <NSObject>
@optional
- (void)textStorageWillProcessEditing:(NSNotification *)notification; /* Delegate can change the characters or attributes */
- (void)textStorageDidProcessEditing:(NSNotification *)notification; /* Delegate can change the attributes */
@end
@protocol NSToolbarDelegate <NSObject>
@optional
- (NSToolbarItem *)toolbar:(NSToolbar *)toolbar itemForItemIdentifier:(NSString *)itemIdentifier willBeInsertedIntoToolbar:(BOOL)flag;
- (NSArray *)toolbarDefaultItemIdentifiers:(NSToolbar*)toolbar;
- (NSArray *)toolbarAllowedItemIdentifiers:(NSToolbar*)toolbar;
- (NSArray *)toolbarSelectableItemIdentifiers:(NSToolbar *)toolbar;
- (void)toolbarWillAddItem: (NSNotification *)notification;
- (void)toolbarDidRemoveItem: (NSNotification *)notification;
@end
#endif

/* for pre-10.5 compatibility */
#ifndef NSINTEGER_DEFINED
#if __LP64__ || NS_BUILD_32_LIKE_64
typedef long NSInteger;
typedef unsigned long NSUInteger;
#else
typedef int NSInteger;
typedef unsigned int NSUInteger;
#endif
#define NSINTEGER_DEFINED 1
#endif
2 changes: 1 addition & 1 deletion DataManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

/* DataManager */

#import <Cocoa/Cocoa.h>
#import "CCComp.h"
#import "Tools/SortableDataSource.h"

@interface DataManager : NSObject
Expand Down
2 changes: 1 addition & 1 deletion HelpManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

/* HelpManager */

#import <Cocoa/Cocoa.h>
#import "CCComp.h"
#import <WebKit/WebKit.h>
#import <WebKit/WebFrame.h>

Expand Down
2 changes: 1 addition & 1 deletion PackageInstaller.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
#define kBinary 1
#define kSource 0

#import <Cocoa/Cocoa.h>
#import "CCComp.h"

@interface PackageEntry : NSObject {
NSString *name;
Expand Down
12 changes: 0 additions & 12 deletions PackageInstaller.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,6 @@
@".libPaths()[1]"
};

/* for pre-10.5 compatibility */
#ifndef NSINTEGER_DEFINED
#if __LP64__ || NS_BUILD_32_LIKE_64
typedef long NSInteger;
typedef unsigned long NSUInteger;
#else
typedef int NSInteger;
typedef unsigned int NSUInteger;
#endif
#define NSINTEGER_DEFINED 1
#endif

@interface PackageEntry (PrivateMethods)
- (NSString*) name;
- (NSString*) iver;
Expand Down
2 changes: 1 addition & 1 deletion PackageManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

/* PackageManager */

#import <Cocoa/Cocoa.h>
#import "CCComp.h"

// structure holding all available data about a package
typedef struct pkgManagerEntry {
Expand Down
2 changes: 1 addition & 1 deletion Preferences.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* Create by Simon Urbanek on 12/5/2004
*/

#import <Cocoa/Cocoa.h>
#import "CCComp.h"

@protocol PreferencesDependent
- (void) updatePreferences;
Expand Down
7 changes: 5 additions & 2 deletions R.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@
6807116E0EB0CD4200436993 /* InfoPlist.h in Headers */ = {isa = PBXBuildFile; fileRef = 6807116D0EB0CD4200436993 /* InfoPlist.h */; };
6807E645080EAE4100A03223 /* GlobalExHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 6807E643080EAE4100A03223 /* GlobalExHandler.h */; };
6807E646080EAE4100A03223 /* GlobalExHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 6807E644080EAE4100A03223 /* GlobalExHandler.m */; };
6825104D132F337800367C93 /* CCComp.h in Headers */ = {isa = PBXBuildFile; fileRef = 6825104C132F337800367C93 /* CCComp.h */; };
6828383907804DFC004617B7 /* ExceptionHandling.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6828383807804DFC004617B7 /* ExceptionHandling.framework */; };
684D008507BD72BE0047EEF6 /* SyntaxColorsPrefPane.h in Headers */ = {isa = PBXBuildFile; fileRef = 684D008307BD72BE0047EEF6 /* SyntaxColorsPrefPane.h */; };
684D008607BD72BE0047EEF6 /* SyntaxColorsPrefPane.m in Sources */ = {isa = PBXBuildFile; fileRef = 684D008407BD72BE0047EEF6 /* SyntaxColorsPrefPane.m */; };
Expand Down Expand Up @@ -361,6 +362,7 @@
6807E644080EAE4100A03223 /* GlobalExHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GlobalExHandler.m; sourceTree = "<group>"; };
6812EC9E07BA6A360000B6A8 /* de */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = de; path = de.lproj/EditorPrefPane.nib; sourceTree = "<group>"; };
681D40BE081D653B0019CB4C /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = fr; path = fr.lproj/Credits.rtf; sourceTree = "<group>"; };
6825104C132F337800367C93 /* CCComp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCComp.h; sourceTree = "<group>"; };
6828383807804DFC004617B7 /* ExceptionHandling.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ExceptionHandling.framework; path = /System/Library/Frameworks/ExceptionHandling.framework; sourceTree = "<absolute>"; };
684D008307BD72BE0047EEF6 /* SyntaxColorsPrefPane.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SyntaxColorsPrefPane.h; sourceTree = "<group>"; };
684D008407BD72BE0047EEF6 /* SyntaxColorsPrefPane.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SyntaxColorsPrefPane.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -725,6 +727,7 @@
isa = PBXGroup;
children = (
68F84C6109ABB2BF0098D772 /* privateR.h */,
6825104C132F337800367C93 /* CCComp.h */,
32CA4F630368D1EE00C91783 /* R_Prefix.pch */,
6855194007B8FDDF00F3A57C /* RGUI.h */,
29B97316FDCFA39411CA2CEA /* main.m */,
Expand Down Expand Up @@ -887,6 +890,7 @@
BC12B313130A65CE009F7D3F /* RScriptEditorTextView.h in Headers */,
BCCE4A38130AB3C6003325EB /* RScriptEditorTokens.h in Headers */,
BC12DC4A130EC12900FB39CE /* NoodleLineNumberView.h in Headers */,
6825104D132F337800367C93 /* CCComp.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -938,7 +942,6 @@
isa = PBXProject;
buildConfigurationList = 680F0B3A0997CE66009CDBE8 /* Build configuration list for PBXProject "R" */;
compatibilityVersion = "Xcode 2.4";
developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
English,
Expand Down Expand Up @@ -1780,8 +1783,8 @@
INFOPLIST_PREFIX_HEADER = InfoPlist.h;
INFOPLIST_PREPROCESS = YES;
INFOPLIST_PREPROCESSOR_DEFINITIONS = "DEBUG_CFG=1";
STRIP_INSTALLED_PRODUCT = NO;
STRINGS_FILE_OUTPUT_ENCODING = "UTF-8";
STRIP_INSTALLED_PRODUCT = NO;
};
name = Debug;
};
Expand Down
2 changes: 1 addition & 1 deletion RController.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#include <R_ext/eventloop.h>
#import <sys/types.h>

#import <Cocoa/Cocoa.h>
#import "CCComp.h"
#import <WebKit/WebKit.h>

#import "Tools/History.h"
Expand Down
3 changes: 1 addition & 2 deletions RDocument.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@
*/


#import <Cocoa/Cocoa.h>
#import "CCComp.h"
#import "Preferences.h"
//#import "RDocumentWinCtrl.h"

@class RDocumentWinCtrl;

Expand Down
2 changes: 1 addition & 1 deletion RDocumentController.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

/* RDocumentController */

#import <Cocoa/Cocoa.h>
#import "CCComp.h"
#import "Preferences.h"
#import "RDocument.h"

Expand Down
2 changes: 1 addition & 1 deletion RDocumentWinCtrl.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* Created by Simon Urbanek on 1/11/05.
*/

#import <Cocoa/Cocoa.h>
#import "CCComp.h"
#import "Preferences.h"
#import "RDocument.h"
#import "RScriptEditorTextView.h"
Expand Down
2 changes: 1 addition & 1 deletion REditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

/* REditor */

#import <Cocoa/Cocoa.h>
#import "CCComp.h"

#define DataEditorToolbarIdentifier @"DataEditor Toolbar Identifier"
#define AddColToolbarItemIdentifier @"Add Column"
Expand Down
12 changes: 0 additions & 12 deletions REditor.m
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,6 @@
#include <Rinternals.h>
#include <Rversion.h>

/* for pre-10.5 compatibility */
#ifndef NSINTEGER_DEFINED
#if __LP64__ || NS_BUILD_32_LIKE_64
typedef long NSInteger;
typedef unsigned long NSUInteger;
#else
typedef int NSInteger;
typedef unsigned int NSUInteger;
#endif
#define NSINTEGER_DEFINED 1
#endif

#ifndef max
#define max(x,y) x<y?y:x;
#endif
Expand Down
2 changes: 1 addition & 1 deletion REditorTextStorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* Created by Simon Urbanek on 1/11/05.
*/

#import <Cocoa/Cocoa.h>
#import "CCComp.h"
#import "Preferences.h"

@interface REditorTextStorage : NSTextStorage <PreferencesDependent> {
Expand Down
2 changes: 1 addition & 1 deletion REditorToolbar.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* Created by Simon Urbanek on 4/1/05.
*/

#import <Cocoa/Cocoa.h>
#import "CCComp.h"
#import "RDocumentWinCtrl.h"

#define RETI_Save @"RETI Save Document"
Expand Down
2 changes: 1 addition & 1 deletion RRulerView.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
* inspired by LineNumbering example authored by Koen van der Drift.
*/

#import <Cocoa/Cocoa.h>
#import "CCComp.h"
#import "PreferenceKeys.h"
#import "Preferences.h"

Expand Down
2 changes: 1 addition & 1 deletion RScriptEditorTextView.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
*
*/

#import <Cocoa/Cocoa.h>
#import "CCComp.h"
#import "RTextView.h"
#import "Preferences.h"
#import "PreferenceKeys.h"
Expand Down
2 changes: 1 addition & 1 deletion RTextView.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* $Id$
*/

#import <Cocoa/Cocoa.h>
#import "CCComp.h"

/* RTextView is a subclass of NSTextView with some additional properties:
- responds to <Ctrl><.> by sending complete: to self
Expand Down
2 changes: 1 addition & 1 deletion SearchTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

/* SearchTable */

#import <Cocoa/Cocoa.h>
#import "CCComp.h"
#import <WebKit/WebKit.h>
#import <WebKit/WebFrame.h>
#import "Tools/SortableDataSource.h"
Expand Down
2 changes: 1 addition & 1 deletion SelectList.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

/* SelectList */

#import <Cocoa/Cocoa.h>
#import "CCComp.h"

@interface SelectList : NSObject
{
Expand Down
12 changes: 0 additions & 12 deletions SelectList.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,6 @@
#import "RGUI.h"
#import "SelectList.h"

/* for pre-10.5 compatibility */
#ifndef NSINTEGER_DEFINED
#if __LP64__ || NS_BUILD_32_LIKE_64
typedef long NSInteger;
typedef unsigned long NSUInteger;
#else
typedef int NSInteger;
typedef unsigned int NSUInteger;
#endif
#define NSINTEGER_DEFINED 1
#endif

static SelectList *sharedController = nil;

@implementation SelectList
Expand Down
12 changes: 12 additions & 0 deletions Tools/SortableDataSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,18 @@ typedef unsigned int NSUInteger;
#define NSINTEGER_DEFINED 1
#endif

@protocol NSTableViewDataSource <NSObject>
- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView;
- (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row;
@optional
- (void)tableView:(NSTableView *)tableView setObjectValue:(id)object forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row;
- (void)tableView:(NSTableView *)tableView sortDescriptorsDidChange:(NSArray *)oldDescriptors;
- (BOOL)tableView:(NSTableView *)tableView writeRowsWithIndexes:(NSIndexSet *)rowIndexes toPasteboard:(NSPasteboard *)pboard;
- (NSDragOperation)tableView:(NSTableView *)tableView validateDrop:(id <NSDraggingInfo>)info proposedRow:(NSInteger)row proposedDropOperation:(NSTableViewDropOperation)dropOperation;
- (BOOL)tableView:(NSTableView *)tableView acceptDrop:(id <NSDraggingInfo>)info row:(NSInteger)row dropOperation:(NSTableViewDropOperation)dropOperation;
- (NSArray *)tableView:(NSTableView *)tableView namesOfPromisedFilesDroppedAtDestination:(NSURL *)dropDestination forDraggedRowsWithIndexes:(NSIndexSet *)indexSet;
@end

@interface SortableDataSource : NSObject <NSTableViewDataSource> {
NSMutableArray *col;
NSMutableArray *colNames;
Expand Down
2 changes: 1 addition & 1 deletion VignettesController.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* VignettesController */

#import <Cocoa/Cocoa.h>
#import "RGUI.h"
#import "CCComp.h"
#import "Tools/SortableDataSource.h"
#import "Tools/PDFImageView.h"

Expand Down
12 changes: 0 additions & 12 deletions VignettesController.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,6 @@
#import "REngine/REngine.h"
#import "REngine/RSEXP.h"

/* for pre-10.5 compatibility */
#ifndef NSINTEGER_DEFINED
#if __LP64__ || NS_BUILD_32_LIKE_64
typedef long NSInteger;
typedef unsigned long NSUInteger;
#else
typedef int NSInteger;
typedef unsigned int NSUInteger;
#endif
#define NSINTEGER_DEFINED 1
#endif

@implementation VignettesController

static VignettesController *vignettesSharedController = nil;
Expand Down
2 changes: 1 addition & 1 deletion WSBrowser.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

/* WSBrowser */

#import <Cocoa/Cocoa.h>
#import "CCComp.h"

#define WorkSpaceBrowserToolbarIdentifier @"WorkSpaceBrowser Toolbar Identifier"

Expand Down
12 changes: 0 additions & 12 deletions WSBrowser.m
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,6 @@
#define PROP_KEY @"property"
#define CHILD_KEY @"children"

/* for pre-10.5 compatibility */
#ifndef NSINTEGER_DEFINED
#if __LP64__ || NS_BUILD_32_LIKE_64
typedef long NSInteger;
typedef unsigned long NSUInteger;
#else
typedef int NSInteger;
typedef unsigned int NSUInteger;
#endif
#define NSINTEGER_DEFINED 1
#endif

@implementation WSBrowser


Expand Down

0 comments on commit 9da0dfe

Please sign in to comment.