- Dirk Theisen added NSFileType key to attributes dictionary returned by -[NSFileManager_win32 fileAttributesAtPath:traverseLink:]

- Added axial shaders via CGShading/CGFunction interface

- Added clipping to path

- Added ApplicationServices project for header compatibility if you use CoreGraphics

- Fixed problem with nib connections which do not have : at end

- Fixed problem with system images not appearing in check boxes loaded from nib
This commit is contained in:
Christopher Lloyd 2007-03-23 21:20:59 +00:00
parent 9d9ccbe544
commit b83f6593fc
39 changed files with 1062 additions and 142 deletions

View File

@ -473,7 +473,7 @@
6EC4AC6A0A35D47800E8D6CA /* NSCustomObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 6EC4AC680A35D47800E8D6CA /* NSCustomObject.m */; };
6EC4ACFD0A36613800E8D6CA /* NSWindowTemplate.h in Headers */ = {isa = PBXBuildFile; fileRef = 6EC4ACFB0A36613800E8D6CA /* NSWindowTemplate.h */; };
6EC4ACFE0A36613800E8D6CA /* NSWindowTemplate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6EC4ACFC0A36613800E8D6CA /* NSWindowTemplate.m */; };
6EC4ADE60A37294300E8D6CA /* NSButtonImageSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 6EC4ADE40A37294300E8D6CA /* NSButtonImageSource.h */; };
6EC4ADE60A37294300E8D6CA /* NSButtonImageSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 6EC4ADE40A37294300E8D6CA /* NSButtonImageSource.h */; settings = {ATTRIBUTES = (Private, ); }; };
6EC4ADE70A37294300E8D6CA /* NSButtonImageSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 6EC4ADE50A37294300E8D6CA /* NSButtonImageSource.m */; };
6ECABDF90A3FA2B700AD7F7B /* NSCustomView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6ECABDF70A3FA2B700AD7F7B /* NSCustomView.h */; };
6ECABDFA0A3FA2B700AD7F7B /* NSCustomView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6ECABDF80A3FA2B700AD7F7B /* NSCustomView.m */; };
@ -573,13 +573,13 @@
FE56BA050B1221330046B7D9 /* NSMutableAttributedString.m in Sources */ = {isa = PBXBuildFile; fileRef = FE56BA030B1221330046B7D9 /* NSMutableAttributedString.m */; };
FE6466E30B2C611D00B302B0 /* NSMutableParagraphStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = FE6466E10B2C611D00B302B0 /* NSMutableParagraphStyle.h */; settings = {ATTRIBUTES = (Public, ); }; };
FE6466E40B2C611D00B302B0 /* NSMutableParagraphStyle.m in Sources */ = {isa = PBXBuildFile; fileRef = FE6466E20B2C611D00B302B0 /* NSMutableParagraphStyle.m */; };
FE64B8E10B81239D007EE513 /* KGColorSpace.h in Headers */ = {isa = PBXBuildFile; fileRef = FE64B8A70B81239D007EE513 /* KGColorSpace.h */; };
FE64B8E10B81239D007EE513 /* KGColorSpace.h in Headers */ = {isa = PBXBuildFile; fileRef = FE64B8A70B81239D007EE513 /* KGColorSpace.h */; settings = {ATTRIBUTES = (Private, ); }; };
FE64B8E20B81239D007EE513 /* KGColorSpace.m in Sources */ = {isa = PBXBuildFile; fileRef = FE64B8A80B81239D007EE513 /* KGColorSpace.m */; };
FE64B8E30B81239D007EE513 /* KGContext.h in Headers */ = {isa = PBXBuildFile; fileRef = FE64B8A90B81239D007EE513 /* KGContext.h */; settings = {ATTRIBUTES = (Private, ); }; };
FE64B8E40B81239D007EE513 /* KGContext.m in Sources */ = {isa = PBXBuildFile; fileRef = FE64B8AA0B81239D007EE513 /* KGContext.m */; };
FE64B8E50B81239D007EE513 /* KGDataProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = FE64B8AB0B81239D007EE513 /* KGDataProvider.h */; };
FE64B8E60B81239D007EE513 /* KGDataProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = FE64B8AC0B81239D007EE513 /* KGDataProvider.m */; };
FE64B8E70B81239D007EE513 /* KGFunction.h in Headers */ = {isa = PBXBuildFile; fileRef = FE64B8AD0B81239D007EE513 /* KGFunction.h */; };
FE64B8E70B81239D007EE513 /* KGFunction.h in Headers */ = {isa = PBXBuildFile; fileRef = FE64B8AD0B81239D007EE513 /* KGFunction.h */; settings = {ATTRIBUTES = (Private, ); }; };
FE64B8E80B81239D007EE513 /* KGFunction.m in Sources */ = {isa = PBXBuildFile; fileRef = FE64B8AE0B81239D007EE513 /* KGFunction.m */; };
FE64B8E90B81239D007EE513 /* KGImage.h in Headers */ = {isa = PBXBuildFile; fileRef = FE64B8AF0B81239D007EE513 /* KGImage.h */; settings = {ATTRIBUTES = (Private, ); }; };
FE64B8EA0B81239D007EE513 /* KGImage.m in Sources */ = {isa = PBXBuildFile; fileRef = FE64B8B00B81239D007EE513 /* KGImage.m */; };
@ -629,7 +629,7 @@
FE64B9160B81239D007EE513 /* KGPDFxref.m in Sources */ = {isa = PBXBuildFile; fileRef = FE64B8DC0B81239D007EE513 /* KGPDFxref.m */; };
FE64B9170B81239D007EE513 /* KGPDFxrefEntry.h in Headers */ = {isa = PBXBuildFile; fileRef = FE64B8DD0B81239D007EE513 /* KGPDFxrefEntry.h */; };
FE64B9180B81239D007EE513 /* KGPDFxrefEntry.m in Sources */ = {isa = PBXBuildFile; fileRef = FE64B8DE0B81239D007EE513 /* KGPDFxrefEntry.m */; };
FE64B9190B81239D007EE513 /* KGShading.h in Headers */ = {isa = PBXBuildFile; fileRef = FE64B8DF0B81239D007EE513 /* KGShading.h */; };
FE64B9190B81239D007EE513 /* KGShading.h in Headers */ = {isa = PBXBuildFile; fileRef = FE64B8DF0B81239D007EE513 /* KGShading.h */; settings = {ATTRIBUTES = (Private, ); }; };
FE64B91A0B81239D007EE513 /* KGShading.m in Sources */ = {isa = PBXBuildFile; fileRef = FE64B8E00B81239D007EE513 /* KGShading.m */; };
FE64B9220B8123F1007EE513 /* CGImage.h in Headers */ = {isa = PBXBuildFile; fileRef = FE64B9200B8123F1007EE513 /* CGImage.h */; settings = {ATTRIBUTES = (Public, ); }; };
FE64B9230B8123F1007EE513 /* CGImage.m in Sources */ = {isa = PBXBuildFile; fileRef = FE64B9210B8123F1007EE513 /* CGImage.m */; };

View File

@ -7,7 +7,19 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#import <Foundation/NSObject.h>
#import <AppKit/AppKitExport.h>
@class KGFunction;
typedef KGFunction *CGFunctionRef;
typedef struct {
unsigned version;
void (*evaluate)(void *,const float *,float *);
void (*releaseInfo)(void *);
} CGFunctionCallbacks;
APPKIT_EXPORT CGFunctionRef CGFunctionRetain(CGFunctionRef self);
APPKIT_EXPORT void CGFunctionRelease(CGFunctionRef self);
APPKIT_EXPORT CGFunctionRef CGFunctionCreate(void *info,unsigned numberOfInputs,const float *inputBounds,unsigned numberOfOutputs,const float *outputBounds,const CGFunctionCallbacks *callbacks);

View File

@ -8,3 +8,15 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
#import <AppKit/CGFunction.h>
#import "KGFunction.h"
CGFunctionRef CGFunctionRetain(CGFunctionRef self) {
[self retain];
}
void CGFunctionRelease(CGFunctionRef self) {
[self release];
}
CGFunctionRef CGFunctionCreate(void *info,unsigned numberOfInputs,const float *inputBounds,unsigned numberOfOutputs,const float *outputBounds,const CGFunctionCallbacks *callbacks) {
return [[KGFunction alloc] initWithInfo:info domainCount:numberOfInputs*2 domain:inputBounds rangeCount:numberOfOutputs*2 range:outputBounds callbacks:callbacks];
}

View File

@ -16,3 +16,6 @@ static inline CGRect CGRectMake(float x, float y, float width, float height) {
return NSMakeRect(x,y,width,height);
}
static inline CGPoint CGPointMake(float x,float y){
return NSMakePoint(x,y);
}

View File

@ -7,7 +7,16 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#import <Foundation/NSObject.h>
#import <AppKit/AppKitExport.h>
#import <AppKit/CGGeometry.h>
#import <AppKit/CGColorSpace.h>
#import <AppKit/CGFunction.h>
@class KGShading;
typedef KGShading *CGShadingRef;
APPKIT_EXPORT CGShadingRef CGShadingRetain(CGShadingRef self);
APPKIT_EXPORT void CGShadingRelease(CGShadingRef self);
APPKIT_EXPORT CGShadingRef CGShadingCreateAxial(CGColorSpaceRef colorSpace,CGPoint startPoint,CGPoint endPoint,CGFunctionRef function,BOOL extendStart,BOOL extendEnd);

View File

@ -8,3 +8,15 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
#import <AppKit/CGShading.h>
#import "KGShading.h"
CGShadingRef CGShadingRetain(CGShadingRef self) {
return [self retain];
}
void CGShadingRelease(CGShadingRef self) {
[self release];
}
CGShadingRef CGShadingCreateAxial(CGColorSpaceRef colorSpace,CGPoint startPoint,CGPoint endPoint,CGFunctionRef function,BOOL extendStart,BOOL extendEnd) {
return [[KGShading alloc] initWithColorSpace:colorSpace startPoint:startPoint endPoint:endPoint function:function extendStart:extendStart extendEnd:extendEnd];
}

View File

@ -8,6 +8,18 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
#import <Foundation/Foundation.h>
#import <AppKit/CGContext.h>
#import <AppKit/CGGeometry.h>
#import <AppKit/CGAffineTransform.h>
#import <AppKit/CGBitmapContext.h>
#import <AppKit/CGColor.h>
#import <AppKit/CGColorSpace.h>
#import <AppKit/CGContext.h>
#import <AppKit/CGDataProvider.h>
#import <AppKit/CGFont.h>
#import <AppKit/CGFunction.h>
#import <AppKit/CGGeometry.h>
#import <AppKit/CGImage.h>
#import <AppKit/CGLayer.h>
#import <AppKit/CGPath.h>
#import <AppKit/CGPattern.h>
#import <AppKit/CGPDFPage.h>
#import <AppKit/CGShading.h>

View File

@ -27,6 +27,8 @@ typedef enum {
KGColorSpaceType _type;
}
-(KGColorSpaceType)type;
-initWithDeviceGray;
-initWithDeviceRGB;
-initWithDeviceCMYK;

View File

@ -35,6 +35,10 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
return [self retain];
}
-(KGColorSpaceType)type {
return _type;
}
-(unsigned)numberOfComponents {
switch(_type){
case KGColorSpaceDeviceGray: return 1;

View File

@ -6,20 +6,29 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#import "KGPDFObject.h"
#import <Foundation/NSObject.h>
#import <AppKit/CGFunction.h>
@class KGPDFArray;
@interface KGFunction : NSObject {
unsigned _domainCount;
float *_domain;
unsigned _rangeCount;
float *_range;
void *_info;
unsigned _domainCount;
float *_domain;
unsigned _rangeCount;
float *_range;
CGFunctionCallbacks _callbacks;
}
-initWithDomain:(KGPDFArray *)domain range:(KGPDFArray *)range;
-initWithInfo:(void *)info domainCount:(unsigned)domainCount domain:(const float *)domain rangeCount:(unsigned)rangeCount range:(const float *)range callbacks:(const CGFunctionCallbacks *)callbacks;
-(unsigned)domainCount;
-(const float *)domain;
-(unsigned)rangeCount;
-(const float *)range;
-(BOOL)isLinear;
// FIX, only works for one input value
-(void)evaluateInput:(float)x output:(float *)outp;

View File

@ -24,19 +24,85 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
return self;
}
-initWithInfo:(void *)info domainCount:(unsigned)domainCount domain:(const float *)domain rangeCount:(unsigned)rangeCount range:(const float *)range callbacks:(const CGFunctionCallbacks *)callbacks {
int i;
_info=info;
_domainCount=domainCount;
_domain=NSZoneMalloc(NULL,sizeof(float)*_domainCount);
if(domain==NULL){
for(i=0;i<_domainCount;i++)
_domain[i]=i%2;
}
else {
for(i=0;i<_domainCount;i++)
_domain[i]=domain[i];
}
_rangeCount=rangeCount;
_range=NSZoneMalloc(NULL,sizeof(float)*_rangeCount);
if(range==NULL){
for(i=0;i<_rangeCount;i++)
_range[i]=i%2;
}
else {
for(i=0;i<_rangeCount;i++)
_range[i]=range[i];
}
_callbacks=*callbacks;
return self;
}
-(void)dealloc {
if(_domain!=NULL)
NSZoneFree(NULL,_domain);
if(_range!=NULL)
NSZoneFree(NULL,_range);
if(_callbacks.releaseInfo!=NULL)
_callbacks.releaseInfo(_info);
[super dealloc];
}
-(unsigned)domainCount {
return _domainCount;
}
-(const float *)domain {
return _domain;
}
-(unsigned)rangeCount {
return _rangeCount;
}
-(const float *)range {
return _range;
}
-(BOOL)isLinear {
return NO;
}
-(void)evaluateInput:(float)x output:(float *)output {
float inputs[1];
int i;
if(x<_domain[0])
x=_domain[0];
else if(x>_domain[1])
x=_domain[1];
inputs[0]=x;
_callbacks.evaluate(_info,inputs,output);
for(i=0;i<_rangeCount/2;i++){
if(output[i]<_range[i*2])
output[i]=_range[i*2];
else if(output[i]>_range[i*2+1])
output[i]=_range[i*2+1];
}
}
@end

View File

@ -121,9 +121,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
}
-(void)clipToPath:(KGPath *)path {
[_renderingContext clipToDeviceSpacePath:path];
}
-(void)evenOddClipToPath:(KGPath *)path {
[_renderingContext evenOddClipToDeviceSpacePath:path];
}
-(void)clipToMask:(KGImage *)image inRect:(NSRect)rect {
@ -455,7 +457,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
}
-(void)drawShading:(KGShading *)shading {
NSUnimplementedMethod();
[_renderingContext drawInUserSpace:_ctm shading:shading];
}
-(void)drawImage:(KGImage *)image inRect:(NSRect)rect {

View File

@ -7,6 +7,7 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#import "KGFunction.h"
#import "KGPDFObject.h"
@interface KGPDFFunction_Type2 : KGFunction {
unsigned _C0Count;

View File

@ -15,10 +15,30 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
@implementation KGPDFFunction_Type2
static void evaluate(void *info,const float *input,float *output) {
KGPDFFunction_Type2 *self=info;
float x=input[0];
int i;
if(self->_N==1.0){
for(i=0;i<self->_C0Count;i++){
output[i]=self->_C0[i]+x*(self->_C1[i]-self->_C0[i]);
}
}
else {
for(i=0;i<self->_C0Count;i++){
output[i]=self->_C0[i]+pow(x,self->_N)*(self->_C1[i]-self->_C0[i]);
}
}
}
-initWithDomain:(KGPDFArray *)domain range:(KGPDFArray *)range C0:(KGPDFArray *)C0 C1:(KGPDFArray *)C1 N:(KGPDFReal)N {
if([super initWithDomain:domain range:range]==nil)
return nil;
_info=self;
_callbacks.evaluate=evaluate;
[C0 getNumbers:&_C0 count:&_C0Count];
[C1 getNumbers:&_C1 count:&_C1Count];
if(_C0Count!=_C1Count){
@ -55,19 +75,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
[super dealloc];
}
-(void)evaluateInput:(float)x output:(float *)output {
int j;
if(_N==1.0){
for(j=0;j<_C0Count;j++){
output[j]=_C0[j]+x*(_C1[j]-_C0[j]);
}
}
else {
for(j=0;j<_C0Count;j++){
output[j]=_C0[j]+pow(x,_N)*(_C1[j]-_C0[j]);
}
}
-(BOOL)isLinear {
return (_N==1.0)?YES:NO;
}
@end

View File

@ -7,6 +7,7 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#import "KGFunction.h"
#import "KGPDFObject.h"
@class NSArray;

View File

@ -14,12 +14,39 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
@implementation KGPDFFunction_Type3
static void evaluate(void *info,const float *input,float *output) {
KGPDFFunction_Type3 *self=info;
float x=input[0];
float bounds[2],encode[2];
int i;
for(i=0;i<self->_boundsCount;i++){
if(x<self->_bounds[i])
break;
}
bounds[0]=(i==0)?self->_domain[0]:self->_bounds[i-1];
bounds[1]=(i==self->_boundsCount)?self->_domain[self->_domainCount-1]:self->_bounds[i];
encode[0]=self->_encode[i*2];
encode[1]=self->_encode[i*2+1];
x-=bounds[0];
x=(bounds[1]-bounds[0])/x;
x=(encode[1]-encode[0])/x;
x+=encode[0];
[self->_functions[i] evaluateInput:x output:output];
}
-initWithDomain:(KGPDFArray *)domain range:(KGPDFArray *)range functions:(NSArray *)functions bounds:(KGPDFArray *)bounds encode:(KGPDFArray *)encode {
int i;
if([super initWithDomain:domain range:range]==nil)
return nil;
_info=self;
_callbacks.evaluate=evaluate;
if((_functionCount=[functions count])==0){
[self dealloc];
return nil;
@ -74,26 +101,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
[super dealloc];
}
-(void)evaluateInput:(float)x output:(float *)output {
float bounds[2],encode[2];
int i;
for(i=0;i<_boundsCount;i++){
if(x<_bounds[i])
break;
}
-(BOOL)isLinear {
if(_functionCount==1)
return [_functions[0] isLinear];
bounds[0]=(i==0)?_domain[0]:_bounds[i-1];
bounds[1]=(i==_boundsCount)?_domain[_domainCount-1]:_bounds[i];
encode[0]=_encode[i*2];
encode[1]=_encode[i*2+1];
x-=bounds[0];
x=(bounds[1]-bounds[0])/x;
x=(encode[1]-encode[0])/x;
x+=encode[0];
[_functions[i] evaluateInput:x output:output];
return NO;
}
@end

View File

@ -89,11 +89,12 @@ BOOL KGPDFGetPageArrayForKey(KGPDFPage *page,const char *key,KGPDFArray **arrayp
return NO;
if(!KGPDFGetPageArrayForKey(self,string,&array))
return NO;
NSLog(@"array=%@",array);
if(![array getNumbers:&numbers count:&count])
return NO;
if(count==4){
if(count!=4){
NSZoneFree(NULL,numbers);
return NO;
}
@ -102,6 +103,7 @@ BOOL KGPDFGetPageArrayForKey(KGPDFPage *page,const char *key,KGPDFArray **arrayp
rect->origin.y=numbers[1];
rect->size.width=numbers[2];
rect->size.height=numbers[3];
NSLog(@"rect=%@",NSStringFromRect(*rect));
NSZoneFree(NULL,numbers);
@ -117,7 +119,7 @@ BOOL KGPDFGetPageArrayForKey(KGPDFPage *page,const char *key,KGPDFArray **arrayp
CGAffineTransform result=CGAffineTransformIdentity;
NSRect boxRect;
if([self getRect:&boxRect forBox:box]){
if([self getRect:&boxRect forBox:box]){
result=CGAffineTransformTranslate(result,-boxRect.origin.x,-boxRect.origin.y);
result=CGAffineTransformScale(result,rect.size.width/boxRect.size.width,rect.size.height/boxRect.size.height);
}

View File

@ -10,7 +10,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
#import <AppKit/CGAffineTransform.h>
#import <AppKit/CGFont.h>
@class KGContext,KGColor,KGPath,KGImage,KGLayer;
@class KGContext,KGColor,KGPath,KGImage,KGLayer,KGShading;
@interface KGRenderingContext : NSObject
@ -31,6 +31,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
-(void)restoreDeviceState:(id)state;
-(void)clipInUserSpace:(CGAffineTransform)ctm rects:(const NSRect *)rect count:(unsigned)count;
-(void)clipToDeviceSpacePath:(KGPath *)path;
-(void)evenOddClipToDeviceSpacePath:(KGPath *)path;
-(void)fillInUserSpace:(CGAffineTransform)ctm rects:(const NSRect *)rects count:(unsigned)count color:(KGColor *)color;
@ -47,4 +49,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
-(void)drawLayer:(KGLayer *)layer inRect:(NSRect)rect ctm:(CGAffineTransform)ctm;
-(void)drawInUserSpace:(CGAffineTransform)matrix shading:(KGShading *)shading;
@end

View File

@ -56,6 +56,14 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
NSInvalidAbstractInvocation();
}
-(void)clipToDeviceSpacePath:(KGPath *)path {
NSInvalidAbstractInvocation();
}
-(void)evenOddClipToDeviceSpacePath:(KGPath *)path {
NSInvalidAbstractInvocation();
}
-(void)fillInUserSpace:(CGAffineTransform)ctm rects:(const NSRect *)rects count:(unsigned)count color:(KGColor *)color {
NSInvalidAbstractInvocation();
}
@ -88,5 +96,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
NSInvalidAbstractInvocation();
}
-(void)drawInUserSpace:(CGAffineTransform)matrix shading:(KGShading *)shading {
NSInvalidAbstractInvocation();
}
@end

View File

@ -27,4 +27,16 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
-initWithColorSpace:(KGColorSpace *)colorSpace startPoint:(NSPoint)startPoint startRadius:(float)startRadius endPoint:(NSPoint)endPoint endRadius:(float)endRadius function:(KGFunction *)function extendStart:(BOOL)extendStart extendEnd:(BOOL)extendEnd;
-(KGColorSpace *)colorSpace;
-(NSPoint)startPoint;
-(NSPoint)endPoint;
-(BOOL)extendStart;
-(BOOL)extendEnd;
-(KGFunction *)function;
-(BOOL)isAxial;
@end

View File

@ -43,4 +43,32 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
[super dealloc];
}
-(KGColorSpace *)colorSpace {
return _colorSpace;
}
-(NSPoint)startPoint {
return _startPoint;
}
-(NSPoint)endPoint {
return _endPoint;
}
-(BOOL)extendStart {
return _extendStart;
}
-(BOOL)extendEnd {
return _extendEnd;
}
-(KGFunction *)function {
return _function;
}
-(BOOL)isAxial {
return _isRadial?NO:YES;
}
@end

View File

@ -23,6 +23,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
#import <AppKit/NSControl.h>
#import <AppKit/NSMatrix.h>
#import <AppKit/NSNibKeyedUnarchiver.h>
#import <AppKit/NSButtonImageSource.h>
@implementation NSButtonCell
@ -47,6 +48,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
NSNibKeyedUnarchiver *keyed=(NSNibKeyedUnarchiver *)coder;
unsigned flags=[keyed decodeIntForKey:@"NSButtonFlags"];
unsigned flags2=[keyed decodeIntForKey:@"NSButtonFlags2"];
id check;
_title=[[keyed decodeObjectForKey:@"NSContents"] retain];
_alternateTitle=[[keyed decodeObjectForKey:@"NSAlternateContents"] retain];
@ -84,7 +86,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
_highlightsBy|=NSChangeGrayCellMask;
_isBordered=(flags&0x00800000)?YES:NO; // err, this flag is in NSCell too
switch(flags2&0x37){
case 1: _bezelStyle=NSRoundedBezelStyle; break;
case 2: _bezelStyle=NSRegularSquareBezelStyle; break;
@ -107,11 +109,15 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
_isTransparent=(flags&0x00008000)?YES:NO;
_imageDimsWhenDisabled=(flags&0x00002000)?NO:YES;
_alternateImage=[[keyed decodeObjectForKey:@"NSAlternateImage"] retain];
if(![_alternateImage isKindOfClass:[NSImage class]]){
[_alternateImage release];
_alternateImage=nil;
check=[keyed decodeObjectForKey:@"NSAlternateImage"];
if([check isKindOfClass:[NSImage class]])
_alternateImage=[check retain];
else if([check isKindOfClass:[NSButtonImageSource class]]){
[_image release];
_image=[[check normalImage] retain];
_alternateImage=[[check alternateImage] retain];
}
_keyEquivalent=[[keyed decodeObjectForKey:@"NSKeyEquivalent"] retain];
_keyEquivalentModifierMask=flags2>>8;
}

View File

@ -47,7 +47,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
NSNibKeyedUnarchiver *keyed=(NSNibKeyedUnarchiver *)coder;
int flags=[keyed decodeIntForKey:@"NSCellFlags"];
int flags2=[keyed decodeIntForKey:@"NSCellFlags2"];
id check;
_state=(flags&0x8000000)?YES:NO;
_isHighlighted=(flags&0x40000000)?YES:NO;
_isEnabled=(flags&0x20000000)?NO:YES;
@ -64,20 +65,18 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
_isContinuous=(flags&0x00080100)?YES:NO;
_textAlignment=(flags2&0x1c000000)>>26;
_objectValue=[[keyed decodeObjectForKey:@"NSContents"] retain];
_image=[[keyed decodeObjectForKey:@"NSNormalImage"] retain];
if([_image isKindOfClass:[NSFont class]]){
_font=(NSFont *)_image;
_image=nil;
}
else {
_font=[[keyed decodeObjectForKey:@"NSSupport"] retain];
if(![_font isKindOfClass:[NSFont class]]){
[_font release];
_font=nil;
}
if(_font==nil)
_font=[[NSFont userFontOfSize:0] retain]; // ?
}
check=[keyed decodeObjectForKey:@"NSNormalImage"];
if([check isKindOfClass:[NSImage class]])
_image=[check retain];
else if([check isKindOfClass:[NSFont class]])
_font=[check retain];
check=[keyed decodeObjectForKey:@"NSSupport"];
if([check isKindOfClass:[NSFont class]])
_font=[check retain];
if(_font==nil)
_font=[[NSFont userFontOfSize:0] retain]; // ?
}
else {
_state=[coder decodeIntForKey:@"NSCell state"];

View File

@ -11,7 +11,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
typedef int NSOpenGLPixelFormatAttribute;
@interface NSOpenGLPixelFormat : NSObject {
NSOpenGLPixelFormatAttribute *_attributes;
}
-initWithAttributes:(NSOpenGLPixelFormatAttribute *)attributes;

View File

@ -13,12 +13,26 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
@implementation NSOpenGLPixelFormat
-initWithAttributes:(NSOpenGLPixelFormatAttribute *)attributes {
NSUnimplementedMethod();
int count;
for(count=0;attributes[count]!=0;count++)
;
_attributes=NSZoneMalloc(NULL,sizeof(NSOpenGLPixelFormatAttribute)*(count+1));
for(count=0;(_attributes[count]=attributes[count])!=0;count++)
;
return self;
}
-(void)dealloc {
NSZoneFree(NULL,_attributes);
[super dealloc];
}
-(void *)CGLPixelFormatObj {
NSUnimplementedMethod();
}
-(int)numberOfVirtualScreens {
NSUnimplementedMethod();
}

View File

@ -11,7 +11,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
@class NSOpenGLPixelFormat,NSOpenGLContext;
@interface NSOpenGLView : NSView {
NSOpenGLPixelFormat *_pixelFormat;
NSOpenGLContext *_context;
}
+(NSOpenGLPixelFormat *)defaultPixelFormat;

View File

@ -8,52 +8,93 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
// Original - Christopher Lloyd <cjwl@objc.net>
#import <AppKit/NSOpenGLView.h>
#import <AppKit/NSOpenGLContext.h>
#import <AppKit/NSOpenGLPixelFormat.h>
#import <Foundation/NSRaise.h>
@implementation NSOpenGLView
+(NSOpenGLPixelFormat *)defaultPixelFormat {
NSUnimplementedMethod();
return nil;
NSOpenGLPixelFormatAttribute attributes[]={
0
};
return [[[NSOpenGLPixelFormat alloc] initWithAttributes:attributes] autorelease];
}
-initWithFrame:(NSRect)frame pixelFormat:(NSOpenGLPixelFormat *)pixelFormat {
NSUnimplementedMethod();
_pixelFormat=[pixelFormat retain];
_context=nil;
return self;
}
-initWithFrame:(NSRect)frame {
return [self initWithFrame:frame pixelFormat:[isa defaultPixelFormat]];
}
-(void)dealloc {
[_pixelFormat release];
[_context release];
[super dealloc];
}
-(NSOpenGLPixelFormat *)pixelFormat {
NSUnimplementedMethod();
return nil;
return _pixelFormat;
}
-(NSOpenGLContext *)openGLContext {
NSUnimplementedMethod();
return nil;
if(_context==nil){
// _context=[[NSOpenGLContext alloc] initWithPixel:_pixelFormat shareContext:];
}
return _context;
}
-(void)setPixelFormat:(NSOpenGLPixelFormat *)pixelFormat {
NSUnimplementedMethod();
pixelFormat=[pixelFormat retain];
[_pixelFormat release];
_pixelFormat=pixelFormat;
}
-(void)setOpenGLContext:(NSOpenGLContext *)context {
NSUnimplementedMethod();
context=[context retain];
[_context release];
_context=context;
}
-(void)update {
NSUnimplementedMethod();
[_context update];
}
-(void)reshape {
NSUnimplementedMethod();
// do nothing
}
-(void)prepareOpenGL {
NSUnimplementedMethod();
// do nothing?
}
-(void)lockFocus {
[super lockFocus];
[[self openGLContext] makeCurrenContext];
[self prepareOpenGL];
}
-(void)clearGLContext {
NSUnimplementedMethod();
[_context clearDrawable];
[_context release];
_context=nil;
}
-(void)resizeSubviewsWithOldSize:(NSSize)oldSize {
[self update];
}
-(void)setBounds:(NSRect)bounds {
[super setBounds:bounds];
[self reshape];
}
@end

View File

@ -15,7 +15,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
@interface Win32DeviceContext : KGRenderingContext {
HDC _dc;
BOOL _isAdvanced;
Win32Font *_font;
}

View File

@ -18,8 +18,15 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
#import <AppKit/KGImage.h>
#import <AppKit/KGGraphicsState.h>
#import <AppKit/KGLayer.h>
#import <AppKit/KGShading.h>
#import <AppKit/KGContext.h>
#import <AppKit/KGFunction.h>
#import <AppKit/KGColorSpace.h>
static inline int float2int(float coord){
return lround(coord);
}
static COLORREF RGBFromColor(KGColor *color){
int count=[color numberOfComponents];
float *components=[color components];
@ -66,6 +73,8 @@ static inline NSRect transformRect(CGAffineTransform matrix,NSRect rect) {
-initWithDC:(HDC)dc {
_dc=dc;
_isAdvanced=(SetGraphicsMode(_dc,GM_ADVANCED)!=0)?YES:NO;
if(SetMapMode(_dc,MM_ANISOTROPIC)==0)
NSLog(@"SetMapMode failed");
@ -74,10 +83,6 @@ static inline NSRect transformRect(CGAffineTransform matrix,NSRect rect) {
SetBkMode(_dc,TRANSPARENT);
SetTextAlign(_dc,TA_BASELINE);
#if 0
if(SetGraphicsMode(_dc,GM_ADVANCED)==0)
NSLog(@"SetGraphicsMode(_dc,GM_ADVANCED) failed");
#endif
_font=nil;
return self;
@ -205,10 +210,10 @@ static RECT NSRectToRECT(NSRect rect) {
if(rect.size.width<0)
rect=NSZeroRect;
result.top=rect.origin.y;
result.left=rect.origin.x;
result.bottom=rect.origin.y+rect.size.height;
result.right=rect.origin.x+rect.size.width;
result.top=float2int(rect.origin.y);
result.left=float2int(rect.origin.x);
result.bottom=float2int(rect.origin.y+rect.size.height);
result.right=float2int(rect.origin.x+rect.size.width);
return result;
}
@ -283,15 +288,14 @@ static RECT NSRectToRECT(NSRect rect) {
ExtTextOutW(dc,point.x,point.y,ETO_GLYPH_INDEX,NULL,(void *)glyphs,count,NULL);
}
-(void)drawPathInDeviceSpace:(KGPath *)path drawingMode:(int)mode ctm:(CGAffineTransform)ctm lineWidth:(float)lineWidth fillColor:(KGColor *)fillColor strokeColor:(KGColor *)strokeColor {
HDC dc=_dc;
-(void)establishDeviceSpacePath:(KGPath *)path {
unsigned opCount=[path numberOfOperators];
const unsigned char *operators=[path operators];
unsigned pointCount=[path numberOfPoints];
const NSPoint *points=[path points];
unsigned i,pointIndex;
BeginPath(dc);
BeginPath(_dc);
pointIndex=0;
for(i=0;i<opCount;i++){
@ -300,14 +304,14 @@ static RECT NSRectToRECT(NSRect rect) {
case KGPathOperatorMoveToPoint:{
NSPoint point=points[pointIndex++];
MoveToEx(dc,point.x,point.y,NULL);
MoveToEx(_dc,float2int(point.x),float2int(point.y),NULL);
}
break;
case KGPathOperatorLineToPoint:{
NSPoint point=points[pointIndex++];
LineTo(dc,point.x,point.y);
LineTo(_dc,float2int(point.x),float2int(point.y));
}
break;
@ -316,12 +320,12 @@ static RECT NSRectToRECT(NSRect rect) {
NSPoint cp2=points[pointIndex++];
NSPoint end=points[pointIndex++];
POINT points[3]={
{ cp1.x, cp1.y },
{ cp2.x, cp2.y },
{ end.x, end.y },
{ float2int(cp1.x), float2int(cp1.y) },
{ float2int(cp2.x), float2int(cp2.y) },
{ float2int(end.x), float2int(end.y) },
};
PolyBezierTo(dc,points,3);
PolyBezierTo(_dc,points,3);
}
break;
@ -330,33 +334,39 @@ static RECT NSRectToRECT(NSRect rect) {
NSPoint cp2=points[pointIndex++];
NSPoint end=cp2;
POINT points[3]={
{ cp1.x, cp1.y },
{ cp2.x, cp2.y },
{ end.x, end.y },
{ float2int(cp1.x), float2int(cp1.y) },
{ float2int(cp2.x), float2int(cp2.y) },
{ float2int(end.x), float2int(end.y) },
};
PolyBezierTo(dc,points,3);
PolyBezierTo(_dc,points,3);
}
break;
case KGPathOperatorCloseSubpath:
CloseFigure(dc);
CloseFigure(_dc);
break;
}
}
EndPath(dc);
EndPath(_dc);
}
-(void)drawPathInDeviceSpace:(KGPath *)path drawingMode:(int)mode ctm:(CGAffineTransform)ctm lineWidth:(float)lineWidth fillColor:(KGColor *)fillColor strokeColor:(KGColor *)strokeColor {
[self establishDeviceSpacePath:path];
{
HBRUSH fillBrush=CreateSolidBrush(RGBFromColor(fillColor));
SelectObject(dc,fillBrush);
SelectObject(_dc,fillBrush);
if(mode==KGPathFill || mode==KGPathFillStroke){
SetPolyFillMode(dc,WINDING);
FillPath(dc);
SetPolyFillMode(_dc,WINDING);
FillPath(_dc);
}
if(mode==KGPathEOFill || mode==KGPathEOFillStroke){
SetPolyFillMode(dc,ALTERNATE);
FillPath(dc);
SetPolyFillMode(_dc,ALTERNATE);
FillPath(_dc);
}
DeleteObject(fillBrush);
}
@ -364,13 +374,27 @@ static RECT NSRectToRECT(NSRect rect) {
if(mode==KGPathStroke || mode==KGPathFillStroke || mode==KGPathEOFillStroke){
NSSize lineSize=CGSizeApplyAffineTransform(NSMakeSize(lineWidth,lineWidth),ctm);
HPEN pen=CreatePen(PS_SOLID,(lineSize.width+lineSize.height)/2,RGBFromColor(strokeColor));
HPEN oldpen=SelectObject(dc,pen);
HPEN oldpen=SelectObject(_dc,pen);
StrokePath(dc);
SelectObject(dc,oldpen);
StrokePath(_dc);
SelectObject(_dc,oldpen);
}
}
-(void)clipToDeviceSpacePath:(KGPath *)path {
[self establishDeviceSpacePath:path];
SetPolyFillMode(_dc,WINDING);
if(!SelectClipPath(_dc,RGN_AND))
NSLog(@"SelectClipPath failed");
}
-(void)evenOddClipToDeviceSpacePath:(KGPath *)path {
[self establishDeviceSpacePath:path];
SetPolyFillMode(_dc,ALTERNATE);
if(!SelectClipPath(_dc,RGN_AND))
NSLog(@"SelectClipPath failed");
}
#if 1
-(void)drawBitmapImage:(KGImage *)image inRect:(NSRect)rect ctm:(CGAffineTransform)ctm fraction:(float)fraction {
int width=[image width];
@ -544,4 +568,235 @@ static void zeroBytes(void *bytes,int size){
[other copyColorsToContext:self size:rect.size toPoint:rect.origin];
}
// The problem is that the GDI gradient fill is a linear/stitched filler and the
// Mac one is a sampling one. So to preserve color variation we stitch together a lot of samples
// we could use stitched linear PDF functions better, i.e. use the intervals
// we could decompose the rectangles further and just use fills if we don't have GradientFill
// we could test for cases where the angle is a multiple of 90 and use the _H or _V constants if we dont have transformations
// we could decompose this better to platform generalize it
static inline float bandIntervalFromMagnitude(KGFunction *function,float magnitude){
if(magnitude<1)
return 0;
if([function isLinear])
return 1;
if(magnitude<1)
return 1;
if(magnitude<4)
return magnitude;
return magnitude/4; // 4== arbitrary
}
static inline void GrayAToRGBA(float *input,float *output){
output[0]=input[0];
output[1]=input[0];
output[2]=input[0];
output[3]=input[1];
}
static inline void RGBAToRGBA(float *input,float *output){
output[0]=input[0];
output[1]=input[1];
output[2]=input[2];
output[3]=input[3];
}
static inline void CMYKAToRGBA(float *input,float *output){
float white=1-input[3];
output[0]=(input[0]>white)?0:white-input[0];
output[1]=(input[1]>white)?0:white-input[1];
output[2]=(input[2]>white)?0:white-input[2];
output[3]=input[4];
}
#ifndef GRADIENT_FILL_RECT_H
#define GRADIENT_FILL_RECT_H 0
#endif
-(void)drawInUserSpace:(CGAffineTransform)matrix axialShading:(KGShading *)shading {
KGColorSpace *colorSpace=[shading colorSpace];
KGColorSpaceType colorSpaceType=[colorSpace type];
KGFunction *function=[shading function];
const float *domain=[function domain];
const float *range=[function range];
BOOL extendStart=[shading extendStart];
BOOL extendEnd=[shading extendEnd];
NSPoint startPoint=CGPointApplyAffineTransform([shading startPoint],matrix);
NSPoint endPoint=CGPointApplyAffineTransform([shading endPoint],matrix);
NSPoint vector=NSMakePoint(endPoint.x-startPoint.x,endPoint.y-startPoint.y);
float magnitude=ceilf(sqrtf(vector.x*vector.x+vector.y*vector.y));
float angle=(magnitude==0)?0:(atanf(vector.y/vector.x)+((vector.x<0)?M_PI:0));
float bandInterval=bandIntervalFromMagnitude(function,magnitude);
int bandCount=bandInterval;
int i,rectIndex=0;
float rectWidth=(bandCount==0)?0:magnitude/bandInterval;
float domainInterval=(bandCount==0)?0:(domain[1]-domain[0])/bandInterval;
GRADIENT_RECT rect[1+bandCount+1];
int vertexIndex=0;
TRIVERTEX vertices[(1+bandCount+1)*2];
float output[[colorSpace numberOfComponents]+1];
float rgba[4];
void (*outputToRGBA)(float *,float *);
// should use something different here so we dont get huge numbers on printers, the clip bbox?
int hRes=GetDeviceCaps(_dc,HORZRES);
int vRes=GetDeviceCaps(_dc,VERTRES);
float maxHeight=MAX(hRes,vRes)*2;
typedef WINGDIAPI BOOL WINAPI (*gradientType)(HDC,PTRIVERTEX,ULONG,PVOID,ULONG,ULONG);
HANDLE library=LoadLibrary("MSIMG32");
gradientType gradientFill=(gradientType)GetProcAddress(library,"GradientFill");
if(!_isAdvanced)
return;
if(gradientFill==NULL){
NSLog(@"Unable to locate GradientFill");
return;
}
switch(colorSpaceType){
case KGColorSpaceDeviceGray:
outputToRGBA=GrayAToRGBA;
break;
case KGColorSpaceDeviceRGB:
outputToRGBA=RGBAToRGBA;
break;
case KGColorSpaceDeviceCMYK:
outputToRGBA=CMYKAToRGBA;
break;
default:
NSLog(@"can't deal with colorspace %@",colorSpace);
return;
}
if(extendStart){
[function evaluateInput:domain[0] output:output];
outputToRGBA(output,rgba);
rect[rectIndex].UpperLeft=vertexIndex;
vertices[vertexIndex].x=float2int(-maxHeight);
vertices[vertexIndex].y=float2int(-maxHeight);
vertices[vertexIndex].Red=rgba[0]*0xFFFF;
vertices[vertexIndex].Green=rgba[1]*0xFFFF;
vertices[vertexIndex].Blue=rgba[2]*0xFFFF;
vertices[vertexIndex].Alpha=rgba[3]*0xFFFF;
vertexIndex++;
rect[rectIndex].LowerRight=vertexIndex;
// the degenerative case for magnitude==0 is to fill the whole area with the extend
if(magnitude!=0)
vertices[vertexIndex].x=float2int(0);
else {
vertices[vertexIndex].x=float2int(maxHeight);
extendEnd=NO;
}
vertices[vertexIndex].y=float2int(maxHeight);
vertices[vertexIndex].Red=rgba[0]*0xFFFF;
vertices[vertexIndex].Green=rgba[1]*0xFFFF;
vertices[vertexIndex].Blue=rgba[2]*0xFFFF;
vertices[vertexIndex].Alpha=rgba[3]*0xFFFF;
vertexIndex++;
rectIndex++;
}
for(i=0;i<bandCount;i++){
float x0=domain[0]+i*domainInterval;
float x1=domain[0]+(i+1)*domainInterval;
rect[rectIndex].UpperLeft=vertexIndex;
vertices[vertexIndex].x=float2int(i*rectWidth);
vertices[vertexIndex].y=float2int(-maxHeight);
[function evaluateInput:x0 output:output];
outputToRGBA(output,rgba);
vertices[vertexIndex].Red=rgba[0]*0xFFFF;
vertices[vertexIndex].Green=rgba[1]*0xFFFF;
vertices[vertexIndex].Blue=rgba[2]*0xFFFF;
vertices[vertexIndex].Alpha=rgba[3]*0xFFFF;
vertexIndex++;
rect[rectIndex].LowerRight=vertexIndex;
vertices[vertexIndex].x=float2int((i+1)*rectWidth);
vertices[vertexIndex].y=float2int(maxHeight);
[function evaluateInput:x1 output:output];
outputToRGBA(output,rgba);
vertices[vertexIndex].Red=rgba[0]*0xFFFF;
vertices[vertexIndex].Green=rgba[1]*0xFFFF;
vertices[vertexIndex].Blue=rgba[2]*0xFFFF;
vertices[vertexIndex].Alpha=rgba[3]*0xFFFF;
vertexIndex++;
rectIndex++;
}
if(extendEnd){
[function evaluateInput:domain[1] output:output];
outputToRGBA(output,rgba);
rect[rectIndex].UpperLeft=vertexIndex;
vertices[vertexIndex].x=float2int(i*rectWidth);
vertices[vertexIndex].y=float2int(-maxHeight);
vertices[vertexIndex].Red=rgba[0]*0xFFFF;
vertices[vertexIndex].Green=rgba[1]*0xFFFF;
vertices[vertexIndex].Blue=rgba[2]*0xFFFF;
vertices[vertexIndex].Alpha=rgba[3]*0xFFFF;
vertexIndex++;
rect[rectIndex].LowerRight=vertexIndex;
vertices[vertexIndex].x=float2int(maxHeight);
vertices[vertexIndex].y=float2int(maxHeight);
vertices[vertexIndex].Red=rgba[0]*0xFFFF;
vertices[vertexIndex].Green=rgba[1]*0xFFFF;
vertices[vertexIndex].Blue=rgba[2]*0xFFFF;
vertices[vertexIndex].Alpha=rgba[3]*0xFFFF;
vertexIndex++;
rectIndex++;
}
if(rectIndex==0)
return;
{
XFORM current;
XFORM translate={1,0,0,1,startPoint.x,startPoint.y};
XFORM rotate={cos(angle),sin(angle),-sin(angle),cos(angle),0,0};
if(!GetWorldTransform(_dc,&current))
NSLog(@"GetWorldTransform failed");
if(!ModifyWorldTransform(_dc,&rotate,MWT_RIGHTMULTIPLY))
NSLog(@"ModifyWorldTransform failed");
if(!ModifyWorldTransform(_dc,&translate,MWT_RIGHTMULTIPLY))
NSLog(@"ModifyWorldTransform failed");
if(!gradientFill(_dc,vertices,vertexIndex,rect,rectIndex,GRADIENT_FILL_RECT_H))
NSLog(@"GradientFill failed");
if(!SetWorldTransform(_dc,&current))
NSLog(@"GetWorldTransform failed");
}
}
-(void)drawInUserSpace:(CGAffineTransform)matrix radialShading:(KGShading *)shading {
NSLog(@"radial shaders not supported yet");
}
-(void)drawInUserSpace:(CGAffineTransform)matrix shading:(KGShading *)shading {
if([shading isAxial])
[self drawInUserSpace:matrix axialShading:shading];
else
[self drawInUserSpace:matrix radialShading:shading];
}
@end

View File

@ -151,17 +151,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
win32Frame.origin.x, win32Frame.origin.y,
win32Frame.size.width, win32Frame.size.height,
NULL,NULL, Win32ApplicationHandle(),NULL);
#if 0
// This is how alpha is set for the whole window, unfortunately a) it's incredibly slow b) we'd have to use a Win32 window per view to get the per view alpha of OSX c) you have to set the alpha for the whole view or chromakey it, it's not as general as OSX where you can just draw with alpha in the view and it works.
{
HANDLE library=LoadLibrary("USER32");
FARPROC setLayered =GetProcAddress(library,"SetLayeredWindowAttributes");
if(setLayered!=NULL)
setLayered(_handle,RGB(0,0,0),128,2);
}
#endif
}
SetProp(_handle,"self",self);

View File

@ -8,8 +8,13 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
#import <Foundation/NSObject.h>
@class NSImage;
@interface NSButtonImageSource : NSObject {
NSString *_imageName;
}
-(NSImage *)normalImage;
-(NSImage *)alternateImage;
@end

View File

@ -7,7 +7,7 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
// Original - Christopher Lloyd <cjwl@objc.net>
#import "NSButtonImageSource.h"
#import <AppKit/NSButtonImageSource.h>
#import <Foundation/NSString.h>
#import <AppKit/NSNibKeyedUnarchiver.h>
#import <AppKit/NSImage.h>
@ -28,10 +28,13 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
[super dealloc];
}
// represents the many alternate images for state, we just return the highlighted image for now
-awakeAfterUsingCoder:(NSCoder *)coder {
-(NSImage *)normalImage {
return [NSImage imageNamed:_imageName];
}
-(NSImage *)alternateImage {
NSString *name=[@"NSHighlighted" stringByAppendingString:[_imageName substringFromIndex:2]];
return [NSImage imageNamed:name];
}

View File

@ -12,11 +12,18 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
@implementation NSNibControlConnector
-(void)establishConnection {
SEL selector=NSSelectorFromString(_label);
NSString *selectorName=_label;
unsigned length=[selectorName length];
SEL selector;
if(length>0 && [selectorName characterAtIndex:length-1]!=':')
selectorName=[selectorName stringByAppendingString:@":"];
selector=NSSelectorFromString(selectorName);
if(selector==NULL)
[NSException raise:NSInvalidArgumentException
format:@"-[%@ %s] selector %@ does not exist:",isa,SELNAME(_cmd),_label];
format:@"-[%@ %s] selector %@ does not exist:",isa,SELNAME(_cmd),selectorName];
if([_source respondsToSelector:@selector(setAction:)])
[_source performSelector:@selector(setAction:) withObject:(id)selector];

View File

@ -0,0 +1,9 @@
/* Copyright (c) 2007 Christopher J. W. Lloyd
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#import <AppKit/CoreGraphics.h>

View File

@ -0,0 +1,294 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 42;
objects = {
/* Begin PBXBuildFile section */
FE32179D0BB41C65004F000A /* ApplicationServices.h in Headers */ = {isa = PBXBuildFile; fileRef = FE32179C0BB41C65004F000A /* ApplicationServices.h */; settings = {ATTRIBUTES = (Public, ); }; };
/* End PBXBuildFile section */
/* Begin PBXBuildRule section */
FE6DC4440BA9ACDE0082AC66 /* PBXBuildRule */ = {
isa = PBXBuildRule;
compilerSpec = org.cocotron.1.0.windows.i386.gcc.4_0_3;
fileType = sourcecode.c;
isEditable = 1;
outputFiles = (
);
};
/* End PBXBuildRule section */
/* Begin PBXContainerItemProxy section */
FE3217E50BB41D2D004F000A /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = FE3217E10BB41D2D004F000A /* AppKit.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 6E2B53220976074C00DA0954;
remoteInfo = "AppKit-Windows-i386";
};
FE3217E70BB41D34004F000A /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = FE3217E10BB41D2D004F000A /* AppKit.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = 6E2B53210976074C00DA0954;
remoteInfo = "AppKit-Windows-i386";
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
0867D69BFE84028FC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
0867D6A5FE840307C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
8DC2EF5A0486A6940098B216 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
8DC2EF5B0486A6940098B216 /* ApplicationServices.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ApplicationServices.framework; sourceTree = BUILT_PRODUCTS_DIR; };
FE32179C0BB41C65004F000A /* ApplicationServices.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ApplicationServices.h; sourceTree = "<group>"; };
FE3217E10BB41D2D004F000A /* AppKit.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = AppKit.xcodeproj; path = ../AppKit/AppKit.xcodeproj; sourceTree = SOURCE_ROOT; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
8DC2EF560486A6940098B216 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
034768DFFF38A50411DB9C8B /* Products */ = {
isa = PBXGroup;
children = (
8DC2EF5B0486A6940098B216 /* ApplicationServices.framework */,
);
name = Products;
sourceTree = "<group>";
};
0867D691FE84028FC02AAC07 /* ApplicationServices */ = {
isa = PBXGroup;
children = (
FE3217E10BB41D2D004F000A /* AppKit.xcodeproj */,
08FB77AEFE84172EC02AAC07 /* Classes */,
32C88DFF0371C24200C91783 /* Other Sources */,
089C1665FE841158C02AAC07 /* Resources */,
0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */,
034768DFFF38A50411DB9C8B /* Products */,
);
name = ApplicationServices;
sourceTree = "<group>";
};
0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */ = {
isa = PBXGroup;
children = (
1058C7B0FEA5585E11CA2CBB /* Linked Frameworks */,
1058C7B2FEA5585E11CA2CBB /* Other Frameworks */,
);
name = "External Frameworks and Libraries";
sourceTree = "<group>";
};
089C1665FE841158C02AAC07 /* Resources */ = {
isa = PBXGroup;
children = (
8DC2EF5A0486A6940098B216 /* Info.plist */,
);
name = Resources;
sourceTree = "<group>";
};
08FB77AEFE84172EC02AAC07 /* Classes */ = {
isa = PBXGroup;
children = (
FE32179C0BB41C65004F000A /* ApplicationServices.h */,
);
name = Classes;
sourceTree = "<group>";
};
1058C7B0FEA5585E11CA2CBB /* Linked Frameworks */ = {
isa = PBXGroup;
children = (
);
name = "Linked Frameworks";
sourceTree = "<group>";
};
1058C7B2FEA5585E11CA2CBB /* Other Frameworks */ = {
isa = PBXGroup;
children = (
0867D6A5FE840307C02AAC07 /* AppKit.framework */,
0867D69BFE84028FC02AAC07 /* Foundation.framework */,
);
name = "Other Frameworks";
sourceTree = "<group>";
};
32C88DFF0371C24200C91783 /* Other Sources */ = {
isa = PBXGroup;
children = (
);
name = "Other Sources";
sourceTree = "<group>";
};
FE3217E20BB41D2D004F000A /* Products */ = {
isa = PBXGroup;
children = (
FE3217E60BB41D2D004F000A /* AppKit.framework */,
);
name = Products;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
8DC2EF500486A6940098B216 /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
FE32179D0BB41C65004F000A /* ApplicationServices.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
8DC2EF4F0486A6940098B216 /* ApplicationServices-Windows-i386 */ = {
isa = PBXNativeTarget;
buildConfigurationList = 1DEB91AD08733DA50010E9CD /* Build configuration list for PBXNativeTarget "ApplicationServices-Windows-i386" */;
buildPhases = (
8DC2EF500486A6940098B216 /* Headers */,
8DC2EF520486A6940098B216 /* Resources */,
8DC2EF540486A6940098B216 /* Sources */,
8DC2EF560486A6940098B216 /* Frameworks */,
);
buildRules = (
FE6DC4440BA9ACDE0082AC66 /* PBXBuildRule */,
);
dependencies = (
FE3217E80BB41D34004F000A /* PBXTargetDependency */,
);
name = "ApplicationServices-Windows-i386";
productInstallPath = "$(HOME)/Library/Frameworks";
productName = ApplicationServices;
productReference = 8DC2EF5B0486A6940098B216 /* ApplicationServices.framework */;
productType = "com.apple.product-type.framework";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
0867D690FE84028FC02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "ApplicationServices" */;
hasScannedForEncodings = 1;
mainGroup = 0867D691FE84028FC02AAC07 /* ApplicationServices */;
productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
projectDirPath = "";
projectReferences = (
{
ProductGroup = FE3217E20BB41D2D004F000A /* Products */;
ProjectRef = FE3217E10BB41D2D004F000A /* AppKit.xcodeproj */;
},
);
targets = (
8DC2EF4F0486A6940098B216 /* ApplicationServices-Windows-i386 */,
);
};
/* End PBXProject section */
/* Begin PBXReferenceProxy section */
FE3217E60BB41D2D004F000A /* AppKit.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = AppKit.framework;
remoteRef = FE3217E50BB41D2D004F000A /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
/* End PBXReferenceProxy section */
/* Begin PBXResourcesBuildPhase section */
8DC2EF520486A6940098B216 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
8DC2EF540486A6940098B216 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
FE3217E80BB41D34004F000A /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = "AppKit-Windows-i386";
targetProxy = FE3217E70BB41D34004F000A /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin XCBuildConfiguration section */
1DEB91AF08733DA50010E9CD /* Deployment */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = i386;
DEPLOYMENT_LOCATION = YES;
DSTROOT = /;
EXECUTABLE_SUFFIX = .1.0.dll;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_PRECOMPILE_PREFIX_HEADER = NO;
GCC_PREFIX_HEADER = "";
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = /Developer/Cocotron/1.0/Windows/i386/Frameworks;
OTHER_CFLAGS = (
"-DAPPLICATIONSERVICES_INSIDE_BUILD",
"-D__LITTLE_ENDIAN__",
);
OTHER_LDFLAGS = (
"-shared",
"-Wl,--enable-auto-import",
"-Wl,--export-all-symbols",
"-Wl,--out-implib,$TARGET_BUILD_DIR/$(PRODUCT_NAME).framework/lib$(PRODUCT_NAME).a",
);
PREBINDING = NO;
PRODUCT_NAME = ApplicationServices;
SYMROOT = /Developer/Cocotron/1.0/build/ApplicationServices/Windows/i386;
};
name = Deployment;
};
1DEB91B308733DA50010E9CD /* Deployment */ = {
isa = XCBuildConfiguration;
buildSettings = {
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
PREBINDING = NO;
SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
};
name = Deployment;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
1DEB91AD08733DA50010E9CD /* Build configuration list for PBXNativeTarget "ApplicationServices-Windows-i386" */ = {
isa = XCConfigurationList;
buildConfigurations = (
1DEB91AF08733DA50010E9CD /* Deployment */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Deployment;
};
1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "ApplicationServices" */ = {
isa = XCConfigurationList;
buildConfigurations = (
1DEB91B308733DA50010E9CD /* Deployment */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Deployment;
};
/* End XCConfigurationList section */
};
rootObject = 0867D690FE84028FC02AAC07 /* Project object */;
}

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>org.cocotron.ApplicationServices</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleSignature</key>
<string>OBJC</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>

View File

@ -25,6 +25,20 @@
/* End PBXBuildRule section */
/* Begin PBXContainerItemProxy section */
FE3217D80BB41D16004F000A /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = FE3217D10BB41D16004F000A /* ApplicationServices.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 8DC2EF5B0486A6940098B216;
remoteInfo = "ApplicationServices-Windows";
};
FE3217E90BB41D42004F000A /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = FE3217D10BB41D16004F000A /* ApplicationServices.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = 8DC2EF4F0486A6940098B216;
remoteInfo = "ApplicationServices-Windows";
};
FE71354E0B36427F006C9493 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = FE7135460B36427F006C9493 /* AppKit.xcodeproj */;
@ -46,6 +60,7 @@
0867D6A5FE840307C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
8DC2EF5A0486A6940098B216 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
8DC2EF5B0486A6940098B216 /* Cocoa.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Cocoa.framework; sourceTree = BUILT_PRODUCTS_DIR; };
FE3217D10BB41D16004F000A /* ApplicationServices.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = ApplicationServices.xcodeproj; path = ../ApplicationServices/ApplicationServices.xcodeproj; sourceTree = SOURCE_ROOT; };
FE7135460B36427F006C9493 /* AppKit.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = AppKit.xcodeproj; path = ../AppKit/AppKit.xcodeproj; sourceTree = SOURCE_ROOT; };
FEF3B23A0B35C74700A76FD1 /* Cocoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Cocoa.h; sourceTree = "<group>"; };
FEF3B2780B35CB9D00A76FD1 /* Cocoa.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Cocoa.m; sourceTree = "<group>"; };
@ -75,6 +90,7 @@
0867D691FE84028FC02AAC07 /* Cocoa */ = {
isa = PBXGroup;
children = (
FE3217D10BB41D16004F000A /* ApplicationServices.xcodeproj */,
FE7135460B36427F006C9493 /* AppKit.xcodeproj */,
08FB77AEFE84172EC02AAC07 /* Classes */,
32C88DFF0371C24200C91783 /* Other Sources */,
@ -134,6 +150,14 @@
name = "Other Sources";
sourceTree = "<group>";
};
FE3217D20BB41D16004F000A /* Products */ = {
isa = PBXGroup;
children = (
FE3217D90BB41D16004F000A /* ApplicationServices.framework */,
);
name = Products;
sourceTree = "<group>";
};
FE7135470B36427F006C9493 /* Products */ = {
isa = PBXGroup;
children = (
@ -170,6 +194,7 @@
);
dependencies = (
FE71355A0B3642A3006C9493 /* PBXTargetDependency */,
FE3217EA0BB41D42004F000A /* PBXTargetDependency */,
);
name = "Cocoa-Windows-i386";
productInstallPath = "$(HOME)/Library/Frameworks";
@ -192,6 +217,10 @@
ProductGroup = FE7135470B36427F006C9493 /* Products */;
ProjectRef = FE7135460B36427F006C9493 /* AppKit.xcodeproj */;
},
{
ProductGroup = FE3217D20BB41D16004F000A /* Products */;
ProjectRef = FE3217D10BB41D16004F000A /* ApplicationServices.xcodeproj */;
},
);
targets = (
8DC2EF4F0486A6940098B216 /* Cocoa-Windows-i386 */,
@ -200,6 +229,13 @@
/* End PBXProject section */
/* Begin PBXReferenceProxy section */
FE3217D90BB41D16004F000A /* ApplicationServices.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = ApplicationServices.framework;
remoteRef = FE3217D80BB41D16004F000A /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
FE71354F0B36427F006C9493 /* AppKit.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
@ -231,6 +267,11 @@
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
FE3217EA0BB41D42004F000A /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = "ApplicationServices-Windows";
targetProxy = FE3217E90BB41D42004F000A /* PBXContainerItemProxy */;
};
FE71355A0B3642A3006C9493 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = "AppKit-Windows-i386";

View File

@ -1299,15 +1299,12 @@
FE74777B0BAC4E9000829F4F /* NSDecimalNumber.h in Headers */ = {isa = PBXBuildFile; fileRef = FE74776F0BAC4E9000829F4F /* NSDecimalNumber.h */; settings = {ATTRIBUTES = (Public, ); }; };
FE74777C0BAC4E9000829F4F /* NSDecimalNumber.m in Sources */ = {isa = PBXBuildFile; fileRef = FE7477700BAC4E9000829F4F /* NSDecimalNumber.m */; };
FE74779D0BAC4F5200829F4F /* NSDistributedLock.h in Headers */ = {isa = PBXBuildFile; fileRef = FE7477990BAC4F5200829F4F /* NSDistributedLock.h */; settings = {ATTRIBUTES = (Public, ); }; };
FE74779E0BAC4F5200829F4F /* NSDistributedLock.m in Resources */ = {isa = PBXBuildFile; fileRef = FE74779A0BAC4F5200829F4F /* NSDistributedLock.m */; };
FE74779F0BAC4F5200829F4F /* NSDistributedNotificationCenter.h in Headers */ = {isa = PBXBuildFile; fileRef = FE74779B0BAC4F5200829F4F /* NSDistributedNotificationCenter.h */; settings = {ATTRIBUTES = (Public, ); }; };
FE7477A00BAC4F5200829F4F /* NSDistributedNotificationCenter.m in Sources */ = {isa = PBXBuildFile; fileRef = FE74779C0BAC4F5200829F4F /* NSDistributedNotificationCenter.m */; };
FE7477A10BAC4F5200829F4F /* NSDistributedLock.h in Headers */ = {isa = PBXBuildFile; fileRef = FE7477990BAC4F5200829F4F /* NSDistributedLock.h */; };
FE7477A20BAC4F5200829F4F /* NSDistributedLock.m in Resources */ = {isa = PBXBuildFile; fileRef = FE74779A0BAC4F5200829F4F /* NSDistributedLock.m */; };
FE7477A30BAC4F5200829F4F /* NSDistributedNotificationCenter.h in Headers */ = {isa = PBXBuildFile; fileRef = FE74779B0BAC4F5200829F4F /* NSDistributedNotificationCenter.h */; };
FE7477A40BAC4F5200829F4F /* NSDistributedNotificationCenter.m in Sources */ = {isa = PBXBuildFile; fileRef = FE74779C0BAC4F5200829F4F /* NSDistributedNotificationCenter.m */; };
FE7477A50BAC4F5200829F4F /* NSDistributedLock.h in Headers */ = {isa = PBXBuildFile; fileRef = FE7477990BAC4F5200829F4F /* NSDistributedLock.h */; };
FE7477A60BAC4F5200829F4F /* NSDistributedLock.m in Resources */ = {isa = PBXBuildFile; fileRef = FE74779A0BAC4F5200829F4F /* NSDistributedLock.m */; };
FE7477A70BAC4F5200829F4F /* NSDistributedNotificationCenter.h in Headers */ = {isa = PBXBuildFile; fileRef = FE74779B0BAC4F5200829F4F /* NSDistributedNotificationCenter.h */; };
FE7477A80BAC4F5200829F4F /* NSDistributedNotificationCenter.m in Sources */ = {isa = PBXBuildFile; fileRef = FE74779C0BAC4F5200829F4F /* NSDistributedNotificationCenter.m */; };
FE7477C00BAC507F00829F4F /* NSIndexPath.h in Headers */ = {isa = PBXBuildFile; fileRef = FE7477BE0BAC507F00829F4F /* NSIndexPath.h */; settings = {ATTRIBUTES = (Public, ); }; };
@ -1613,6 +1610,9 @@
FEB9D7050B44414000C239BB /* NSSocketPortNameServer.m in Sources */ = {isa = PBXBuildFile; fileRef = FEB9D7010B44414000C239BB /* NSSocketPortNameServer.m */; };
FEB9D7060B44414000C239BB /* NSSocketPortNameServer.h in Headers */ = {isa = PBXBuildFile; fileRef = FEB9D7000B44414000C239BB /* NSSocketPortNameServer.h */; settings = {ATTRIBUTES = (Public, ); }; };
FEB9D7070B44414000C239BB /* NSSocketPortNameServer.m in Sources */ = {isa = PBXBuildFile; fileRef = FEB9D7010B44414000C239BB /* NSSocketPortNameServer.m */; };
FEE17BA30BB43998006B4510 /* NSDistributedLock.m in Sources */ = {isa = PBXBuildFile; fileRef = FEE17BA20BB43998006B4510 /* NSDistributedLock.m */; };
FEE17BA40BB43998006B4510 /* NSDistributedLock.m in Sources */ = {isa = PBXBuildFile; fileRef = FEE17BA20BB43998006B4510 /* NSDistributedLock.m */; };
FEE17BA50BB43998006B4510 /* NSDistributedLock.m in Sources */ = {isa = PBXBuildFile; fileRef = FEE17BA20BB43998006B4510 /* NSDistributedLock.m */; };
/* End PBXBuildFile section */
/* Begin PBXBuildRule section */
@ -2210,7 +2210,6 @@
FE74776F0BAC4E9000829F4F /* NSDecimalNumber.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = NSDecimalNumber.h; sourceTree = "<group>"; };
FE7477700BAC4E9000829F4F /* NSDecimalNumber.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = NSDecimalNumber.m; sourceTree = "<group>"; };
FE7477990BAC4F5200829F4F /* NSDistributedLock.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = NSDistributedLock.h; sourceTree = "<group>"; };
FE74779A0BAC4F5200829F4F /* NSDistributedLock.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = NSDistributedLock.m; sourceTree = "<group>"; };
FE74779B0BAC4F5200829F4F /* NSDistributedNotificationCenter.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = NSDistributedNotificationCenter.h; sourceTree = "<group>"; };
FE74779C0BAC4F5200829F4F /* NSDistributedNotificationCenter.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = NSDistributedNotificationCenter.m; sourceTree = "<group>"; };
FE7477BE0BAC507F00829F4F /* NSIndexPath.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = NSIndexPath.h; sourceTree = "<group>"; };
@ -2315,6 +2314,7 @@
FEB9D6E80B4440F200C239BB /* NSMessagePortNameServer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSMessagePortNameServer.m; sourceTree = "<group>"; };
FEB9D7000B44414000C239BB /* NSSocketPortNameServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSSocketPortNameServer.h; sourceTree = "<group>"; };
FEB9D7010B44414000C239BB /* NSSocketPortNameServer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSSocketPortNameServer.m; sourceTree = "<group>"; };
FEE17BA20BB43998006B4510 /* NSDistributedLock.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = NSDistributedLock.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -2385,7 +2385,7 @@
6E2805FB09747D5800EC542B /* NSDirectoryEnumerator.h */,
6E2805FC09747D5800EC542B /* NSDirectoryEnumerator.m */,
FE7477990BAC4F5200829F4F /* NSDistributedLock.h */,
FE74779A0BAC4F5200829F4F /* NSDistributedLock.m */,
FEE17BA20BB43998006B4510 /* NSDistributedLock.m */,
FE74779B0BAC4F5200829F4F /* NSDistributedNotificationCenter.h */,
FE74779C0BAC4F5200829F4F /* NSDistributedNotificationCenter.m */,
6E2805FD09747D5800EC542B /* NSEnumerator.h */,
@ -4294,7 +4294,6 @@
6E4D93210A2642BD003D335C /* NSTimeZoneAbbreviations.plist in Resources */,
6E4D93220A2642BD003D335C /* NSTimeZoneRegions.plist in Resources */,
6E4D93230A2642BD003D335C /* NSUserDefaults.plist in Resources */,
FE7477A60BAC4F5200829F4F /* NSDistributedLock.m in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -4314,7 +4313,6 @@
6EA04A6C09E57D5F0067589C /* NSTimeZoneAbbreviations.plist in Resources */,
6EA04A6D09E57D5F0067589C /* NSTimeZoneRegions.plist in Resources */,
6EA04A6E09E57D5F0067589C /* NSUserDefaults.plist in Resources */,
FE7477A20BAC4F5200829F4F /* NSDistributedLock.m in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -4334,7 +4332,6 @@
6E2808FD09747EA900EC542B /* NSTimeZoneAbbreviations.plist in Resources */,
6E2808FE09747EA900EC542B /* NSTimeZoneRegions.plist in Resources */,
6E280B2D09747F4900EC542B /* NSUserDefaults.plist in Resources */,
FE74779E0BAC4F5200829F4F /* NSDistributedLock.m in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -4603,6 +4600,7 @@
FE74781A0BAC594600829F4F /* NSNetServiceBrowser.m in Sources */,
FE7478480BAC5A8700829F4F /* NSSortDescriptor.m in Sources */,
FE7478770BAC5EB600829F4F /* NSValueTransformer.m in Sources */,
FEE17BA50BB43998006B4510 /* NSDistributedLock.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -4868,6 +4866,7 @@
FE7478160BAC594600829F4F /* NSNetServiceBrowser.m in Sources */,
FE7478460BAC5A8700829F4F /* NSSortDescriptor.m in Sources */,
FE7478750BAC5EB600829F4F /* NSValueTransformer.m in Sources */,
FEE17BA40BB43998006B4510 /* NSDistributedLock.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -5136,6 +5135,7 @@
FE7478120BAC594600829F4F /* NSNetServiceBrowser.m in Sources */,
FE7478440BAC5A8700829F4F /* NSSortDescriptor.m in Sources */,
FE7478730BAC5EB600829F4F /* NSValueTransformer.m in Sources */,
FEE17BA30BB43998006B4510 /* NSDistributedLock.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View File

@ -170,7 +170,13 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
date=[NSDate dateWithTimeIntervalSinceReferenceDate:Win32TimeIntervalFromFileTime(fileData.ftLastWriteTime)];
[result setObject:date forKey:NSFileModificationDate];
// FIX
// dth
NSString* fileType = NSFileTypeRegular;
if (fileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
fileType = NSFileTypeDirectory;
// FIX: Support for links and other attributes needed!
[result setObject:fileType forKey:NSFileType];
[result setObject:@"USER" forKey:NSFileOwnerAccountName];
[result setObject:@"GROUP" forKey:NSFileGroupOwnerAccountName];
[result setObject:[NSNumber numberWithUnsignedLong:0666]