comparison mac/dw.m @ 662:d7badd5606ca

Removed the Carbon source file, and changes to configure to build the Cocoa version. Mac GTK version should still work. Carbon was unfinished, Cocoa version is more complete.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Fri, 25 Feb 2011 15:25:54 +0000
parents eee90a788876
children ba3af8eb56f1
comparison
equal deleted inserted replaced
661:eee90a788876 662:d7badd5606ca
557 -(void)setUserdata:(void *)input; 557 -(void)setUserdata:(void *)input;
558 -(void)addColumn:(NSTableColumn *)input andType:(int)type; 558 -(void)addColumn:(NSTableColumn *)input andType:(int)type;
559 -(int)addRow:(NSArray *)input; 559 -(int)addRow:(NSArray *)input;
560 -(int)addRows:(int)number; 560 -(int)addRows:(int)number;
561 -(void)editCell:(id)input at:(int)row and:(int)col; 561 -(void)editCell:(id)input at:(int)row and:(int)col;
562 -(int)cellType:(int)col; 562 -(void)removeRow:(int)row;
563 -(void)setRow:(int)row title:(void *)input; 563 -(void)setRow:(int)row title:(void *)input;
564 -(void *)getRowTitle:(int)row; 564 -(void *)getRowTitle:(int)row;
565 -(int)cellType:(int)col;
565 -(int)lastAddPoint; 566 -(int)lastAddPoint;
566 -(void)clear; 567 -(void)clear;
567 -(void)setup; 568 -(void)setup;
568 -(void)selectionChanged:(id)sender; 569 -(void)selectionChanged:(id)sender;
569 -(NSMenu *)menuForEvent:(NSEvent *)event; 570 -(NSMenu *)menuForEvent:(NSEvent *)event;
659 { 660 {
660 int index = (row * [tvcols count]) + col; 661 int index = (row * [tvcols count]) + col;
661 [data replaceObjectAtIndex:index withObject:input]; 662 [data replaceObjectAtIndex:index withObject:input];
662 } 663 }
663 } 664 }
664 -(int)cellType:(int)col { return [[types objectAtIndex:col] intValue]; } 665 -(void)removeRow:(int)row
666 {
667 if(tvcols)
668 {
669 int z, start, end;
670 int count = [tvcols count];
671
672 start = count * row;
673 end = start + count;
674
675 for(z=start;z<end;z++)
676 {
677 [data removeObjectAtIndex:z];
678 }
679 [titles removePointerAtIndex:row];
680 if(lastAddPoint > 0 && lastAddPoint < row)
681 {
682 lastAddPoint--;
683 }
684 }
685 }
665 -(void)setRow:(int)row title:(void *)input { if(titles && input) { [titles replacePointerAtIndex:row withPointer:input]; } } 686 -(void)setRow:(int)row title:(void *)input { if(titles && input) { [titles replacePointerAtIndex:row withPointer:input]; } }
666 -(void *)getRowTitle:(int)row { if(titles) { return [titles pointerAtIndex:row]; } return NULL; } 687 -(void *)getRowTitle:(int)row { if(titles) { return [titles pointerAtIndex:row]; } return NULL; }
688 -(int)cellType:(int)col { return [[types objectAtIndex:col] intValue]; }
667 -(int)lastAddPoint { return lastAddPoint; } 689 -(int)lastAddPoint { return lastAddPoint; }
668 -(void)clear { if(data) { [data removeAllObjects]; while([titles count]) { [titles removePointerAtIndex:0]; } } lastAddPoint = 0; } 690 -(void)clear { if(data) { [data removeAllObjects]; while([titles count]) { [titles removePointerAtIndex:0]; } } lastAddPoint = 0; }
669 -(void)setup 691 -(void)setup
670 { 692 {
671 tvcols = [[NSMutableArray alloc] init]; 693 tvcols = [[NSMutableArray alloc] init];
2753 [image lockFocusIfCanDraw]; 2775 [image lockFocusIfCanDraw];
2754 _DWLastDrawable = handle; 2776 _DWLastDrawable = handle;
2755 } 2777 }
2756 NSBezierPath* aPath = [NSBezierPath bezierPath]; 2778 NSBezierPath* aPath = [NSBezierPath bezierPath];
2757 [aPath setLineWidth: 0.5]; 2779 [aPath setLineWidth: 0.5];
2780 [[NSColor colorWithDeviceRed: DW_RED_VALUE(_foreground)/255.0 green: DW_GREEN_VALUE(_foreground)/255.0 blue: DW_BLUE_VALUE(_foreground)/255.0 alpha: 1] set];
2758 2781
2759 [aPath moveToPoint:NSMakePoint(x1, y1)]; 2782 [aPath moveToPoint:NSMakePoint(x1, y1)];
2760 [aPath lineToPoint:NSMakePoint(x2, y2)]; 2783 [aPath lineToPoint:NSMakePoint(x2, y2)];
2761 [aPath stroke]; 2784 [aPath stroke];
2762 2785
2778 if(image) 2801 if(image)
2779 { 2802 {
2780 if([image isMemberOfClass:[NSView class]]) 2803 if([image isMemberOfClass:[NSView class]])
2781 { 2804 {
2782 [image lockFocusIfCanDraw]; 2805 [image lockFocusIfCanDraw];
2806 [[NSColor colorWithDeviceRed: DW_RED_VALUE(_foreground)/255.0 green: DW_GREEN_VALUE(_foreground)/255.0 blue: DW_BLUE_VALUE(_foreground)/255.0 alpha: 1] set];
2783 NSDictionary *dict = [[NSDictionary alloc] init]; 2807 NSDictionary *dict = [[NSDictionary alloc] init];
2784 [nstr drawAtPoint:NSMakePoint(x, y) withAttributes:dict]; 2808 [nstr drawAtPoint:NSMakePoint(x, y) withAttributes:dict];
2785 [image unlockFocus]; 2809 [image unlockFocus];
2786 } 2810 }
2787 _DWLastDrawable = handle; 2811 _DWLastDrawable = handle;
2788 } 2812 }
2789 if(pixmap) 2813 if(pixmap)
2790 { 2814 {
2791 image = (id)pixmap->handle; 2815 image = (id)pixmap->handle;
2792 [image lockFocus]; 2816 [image lockFocus];
2817 [[NSColor colorWithDeviceRed: DW_RED_VALUE(_foreground)/255.0 green: DW_GREEN_VALUE(_foreground)/255.0 blue: DW_BLUE_VALUE(_foreground)/255.0 alpha: 1] set];
2793 NSDictionary *dict = [[NSDictionary alloc] init]; 2818 NSDictionary *dict = [[NSDictionary alloc] init];
2794 [nstr drawAtPoint:NSMakePoint(x, y) withAttributes:dict]; 2819 [nstr drawAtPoint:NSMakePoint(x, y) withAttributes:dict];
2795 [image unlockFocus]; 2820 [image unlockFocus];
2796 } 2821 }
2797 } 2822 }
2854 [image lockFocusIfCanDraw]; 2879 [image lockFocusIfCanDraw];
2855 _DWLastDrawable = handle; 2880 _DWLastDrawable = handle;
2856 } 2881 }
2857 NSBezierPath* aPath = [NSBezierPath bezierPath]; 2882 NSBezierPath* aPath = [NSBezierPath bezierPath];
2858 [aPath setLineWidth: 0.5]; 2883 [aPath setLineWidth: 0.5];
2884 [[NSColor colorWithDeviceRed: DW_RED_VALUE(_foreground)/255.0 green: DW_GREEN_VALUE(_foreground)/255.0 blue: DW_BLUE_VALUE(_foreground)/255.0 alpha: 1] set];
2859 2885
2860 [aPath moveToPoint:NSMakePoint(*x, *y)]; 2886 [aPath moveToPoint:NSMakePoint(*x, *y)];
2861 for(z=1;z<npoints;z++) 2887 for(z=1;z<npoints;z++)
2862 { 2888 {
2863 [aPath lineToPoint:NSMakePoint(x[z], y[z])]; 2889 [aPath lineToPoint:NSMakePoint(x[z], y[z])];