comparison mac/dw.m @ 665:e6bec2290f3f

Fixing warnings with Xcode 4 and switched to manual releasing in the draw functions to stop leaking.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sat, 26 Feb 2011 03:17:12 +0000
parents ba3af8eb56f1
children e426de6e6c7c
comparison
equal deleted inserted replaced
664:ba3af8eb56f1 665:e6bec2290f3f
178 void *user = NULL; 178 void *user = NULL;
179 LONG x,y; 179 LONG x,y;
180 180
181 dw_pointer_query_pos(&x, &y); 181 dw_pointer_query_pos(&x, &y);
182 182
183 return containercontextfunc(handler->window, text, x, y, handler->data, user); 183 return containercontextfunc(handler->window, text, (int)x, (int)y, handler->data, user);
184 } 184 }
185 case 12: 185 case 12:
186 { 186 {
187 int (* API treeselectfunc)(HWND, HTREEITEM, char *, void *, void *) = (int (* API)(HWND, HTREEITEM, char *, void *, void *))handler->signalfunction; 187 int (* API treeselectfunc)(HWND, HTREEITEM, char *, void *, void *) = (int (* API)(HWND, HTREEITEM, char *, void *, void *))handler->signalfunction;
188 char *text = (char *)event; 188 char *text = (char *)event;
575 @implementation DWContainer 575 @implementation DWContainer
576 -(NSInteger)numberOfRowsInTableView:(NSTableView *)aTable 576 -(NSInteger)numberOfRowsInTableView:(NSTableView *)aTable
577 { 577 {
578 if(tvcols && data) 578 if(tvcols && data)
579 { 579 {
580 int cols = [tvcols count]; 580 int cols = (int)[tvcols count];
581 if(cols) 581 if(cols)
582 { 582 {
583 return [data count] / cols; 583 return [data count] / cols;
584 } 584 }
585 } 585 }
588 -(id)tableView:(NSTableView *)aTable objectValueForTableColumn:(NSTableColumn *)aCol row:(NSInteger)aRow 588 -(id)tableView:(NSTableView *)aTable objectValueForTableColumn:(NSTableColumn *)aCol row:(NSInteger)aRow
589 { 589 {
590 if(tvcols) 590 if(tvcols)
591 { 591 {
592 int z, col = -1; 592 int z, col = -1;
593 int count = [tvcols count]; 593 int count = (int)[tvcols count];
594 594
595 for(z=0;z<count;z++) 595 for(z=0;z<count;z++)
596 { 596 {
597 if([tvcols objectAtIndex:z] == aCol) 597 if([tvcols objectAtIndex:z] == aCol)
598 { 598 {
600 break; 600 break;
601 } 601 }
602 } 602 }
603 if(col != -1) 603 if(col != -1)
604 { 604 {
605 int index = (aRow * count) + col; 605 int index = (int)(aRow * count) + col;
606 id this = [data objectAtIndex:index]; 606 id this = [data objectAtIndex:index];
607 return ([this isKindOfClass:[NSNull class]]) ? nil : this; 607 return ([this isKindOfClass:[NSNull class]]) ? nil : this;
608 } 608 }
609 } 609 }
610 return nil; 610 return nil;
612 -(void)tableView:(NSTableView *)aTableView setObjectValue:(id)anObject forTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex 612 -(void)tableView:(NSTableView *)aTableView setObjectValue:(id)anObject forTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
613 { 613 {
614 if(tvcols) 614 if(tvcols)
615 { 615 {
616 int z, col = -1; 616 int z, col = -1;
617 int count = [tvcols count]; 617 int count = (int)[tvcols count];
618 618
619 for(z=0;z<count;z++) 619 for(z=0;z<count;z++)
620 { 620 {
621 if([tvcols objectAtIndex:z] == aTableColumn) 621 if([tvcols objectAtIndex:z] == aTableColumn)
622 { 622 {
624 break; 624 break;
625 } 625 }
626 } 626 }
627 if(col != -1) 627 if(col != -1)
628 { 628 {
629 int index = (rowIndex * count) + col; 629 int index = (int)(rowIndex * count) + col;
630 [data replaceObjectAtIndex:index withObject:anObject]; 630 [data replaceObjectAtIndex:index withObject:anObject];
631 } 631 }
632 } 632 }
633 } 633 }
634 -(void *)userdata { return userdata; } 634 -(void *)userdata { return userdata; }
635 -(void)setUserdata:(void *)input { userdata = input; } 635 -(void)setUserdata:(void *)input { userdata = input; }
636 -(void)addColumn:(NSTableColumn *)input andType:(int)type { if(tvcols) { [tvcols addObject:input]; [types addObject:[NSNumber numberWithInt:type]]; } } 636 -(void)addColumn:(NSTableColumn *)input andType:(int)type { if(tvcols) { [tvcols addObject:input]; [types addObject:[NSNumber numberWithInt:type]]; } }
637 -(int)addRow:(NSArray *)input { if(data) { [data addObjectsFromArray:input]; [titles addPointer:NULL]; return [titles count]; } return 0; } 637 -(int)addRow:(NSArray *)input { if(data) { [data addObjectsFromArray:input]; [titles addPointer:NULL]; return (int)[titles count]; } return 0; }
638 -(int)addRows:(int)number 638 -(int)addRows:(int)number
639 { 639 {
640 if(tvcols) 640 if(tvcols)
641 { 641 {
642 int count = number * [tvcols count]; 642 int count = (int)number * [tvcols count];
643 int z; 643 int z;
644 644
645 lastAddPoint = [titles count]; 645 lastAddPoint = (int)[titles count];
646 646
647 for(z=0;z<count;z++) 647 for(z=0;z<count;z++)
648 { 648 {
649 [data addObject:[NSNull null]]; 649 [data addObject:[NSNull null]];
650 } 650 }
651 for(z=0;z<number;z++) 651 for(z=0;z<number;z++)
652 { 652 {
653 [titles addPointer:NULL]; 653 [titles addPointer:NULL];
654 } 654 }
655 return [titles count]; 655 return (int)[titles count];
656 } 656 }
657 return 0; 657 return 0;
658 } 658 }
659 -(void)editCell:(id)input at:(int)row and:(int)col 659 -(void)editCell:(id)input at:(int)row and:(int)col
660 { 660 {
661 if(tvcols && input) 661 if(tvcols && input)
662 { 662 {
663 int index = (row * [tvcols count]) + col; 663 int index = (int)(row * [tvcols count]) + col;
664 [data replaceObjectAtIndex:index withObject:input]; 664 [data replaceObjectAtIndex:index withObject:input];
665 } 665 }
666 } 666 }
667 -(void)removeRow:(int)row 667 -(void)removeRow:(int)row
668 { 668 {
669 if(tvcols) 669 if(tvcols)
670 { 670 {
671 int z, start, end; 671 int z, start, end;
672 int count = [tvcols count]; 672 int count = (int)[tvcols count];
673 673
674 start = count * row; 674 start = count * row;
675 end = start + count; 675 end = start + count;
676 676
677 for(z=start;z<end;z++) 677 for(z=start;z<end;z++)
698 titles = [NSPointerArray pointerArrayWithWeakObjects]; 698 titles = [NSPointerArray pointerArrayWithWeakObjects];
699 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(selectionChanged:) name:NSTableViewSelectionDidChangeNotification object:[self window]]; 699 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(selectionChanged:) name:NSTableViewSelectionDidChangeNotification object:[self window]];
700 } 700 }
701 -(void)selectionChanged:(id)sender 701 -(void)selectionChanged:(id)sender
702 { 702 {
703 _event_handler(self, (NSEvent *)[self getRowTitle:[self selectedRow]], 12); 703 _event_handler(self, (NSEvent *)[self getRowTitle:(int)[self selectedRow]], 12);
704 } 704 }
705 -(NSMenu *)menuForEvent:(NSEvent *)event 705 -(NSMenu *)menuForEvent:(NSEvent *)event
706 { 706 {
707 int row; 707 int row;
708 NSPoint where = [self convertPoint:[event locationInWindow] fromView:nil]; 708 NSPoint where = [self convertPoint:[event locationInWindow] fromView:nil];
709 row = [self rowAtPoint:where]; 709 row = (int)[self rowAtPoint:where];
710 _event_handler(self, (NSEvent *)[self getRowTitle:row], 10); 710 _event_handler(self, (NSEvent *)[self getRowTitle:row], 10);
711 return nil; 711 return nil;
712 } 712 }
713 @end 713 @end
714 714
1498 button3 = @"Cancel"; 1498 button3 = @"Cancel";
1499 } 1499 }
1500 1500
1501 if(flags & DW_MB_ERROR) 1501 if(flags & DW_MB_ERROR)
1502 { 1502 {
1503 iResponse = 1503 iResponse = (int)
1504 NSRunCriticalAlertPanel([ NSString stringWithUTF8String:title ], 1504 NSRunCriticalAlertPanel([ NSString stringWithUTF8String:title ],
1505 [ NSString stringWithUTF8String:outbuf ], 1505 [ NSString stringWithUTF8String:outbuf ],
1506 button1, button2, button3); } 1506 button1, button2, button3); }
1507 else 1507 else
1508 { 1508 {
1509 iResponse = 1509 iResponse = (int)
1510 NSRunAlertPanel([ NSString stringWithUTF8String:title ], 1510 NSRunAlertPanel([ NSString stringWithUTF8String:title ],
1511 [ NSString stringWithUTF8String:outbuf ], 1511 [ NSString stringWithUTF8String:outbuf ],
1512 button1, button2, button3); 1512 button1, button2, button3);
1513 } 1513 }
1514 1514
2337 2337
2338 if([object isMemberOfClass:[DWComboBox class]]) 2338 if([object isMemberOfClass:[DWComboBox class]])
2339 { 2339 {
2340 DWComboBox *combo = handle; 2340 DWComboBox *combo = handle;
2341 2341
2342 return [combo numberOfItems]; 2342 return (int)[combo numberOfItems];
2343 } 2343 }
2344 return 0; 2344 return 0;
2345 } 2345 }
2346 2346
2347 /* 2347 /*
2412 id object = handle; 2412 id object = handle;
2413 2413
2414 if([object isMemberOfClass:[DWComboBox class]]) 2414 if([object isMemberOfClass:[DWComboBox class]])
2415 { 2415 {
2416 DWComboBox *combo = handle; 2416 DWComboBox *combo = handle;
2417 return [combo indexOfSelectedItem]; 2417 return (int)[combo indexOfSelectedItem];
2418 } 2418 }
2419 return -1; 2419 return -1;
2420 } 2420 }
2421 2421
2422 /* 2422 /*
2502 */ 2502 */
2503 unsigned int API dw_mle_import(HWND handle, char *buffer, int startpoint) 2503 unsigned int API dw_mle_import(HWND handle, char *buffer, int startpoint)
2504 { 2504 {
2505 DWMLE *mle = handle; 2505 DWMLE *mle = handle;
2506 [mle insertText:[ NSString stringWithUTF8String:buffer ]]; 2506 [mle insertText:[ NSString stringWithUTF8String:buffer ]];
2507 return strlen(buffer) + startpoint; 2507 return (unsigned int)strlen(buffer) + startpoint;
2508 } 2508 }
2509 2509
2510 /* 2510 /*
2511 * Grabs text from an MLE box. 2511 * Grabs text from an MLE box.
2512 * Parameters: 2512 * Parameters:
2715 */ 2715 */
2716 unsigned long API dw_color_choose(unsigned long value) 2716 unsigned long API dw_color_choose(unsigned long value)
2717 { 2717 {
2718 /* Create the File Save Dialog class. */ 2718 /* Create the File Save Dialog class. */
2719 DWColorChoose *colorDlg = (DWColorChoose *)[DWColorChoose sharedColorPanel]; 2719 DWColorChoose *colorDlg = (DWColorChoose *)[DWColorChoose sharedColorPanel];
2720 NSColor *color = [[NSColor alloc] init]; 2720 NSColor *color = [[[NSColor alloc] init] autorelease];
2721 DWDialog *dialog = dw_dialog_new(colorDlg); 2721 DWDialog *dialog = dw_dialog_new(colorDlg);
2722 2722
2723 /* Set defaults for the dialog. */ 2723 /* Set defaults for the dialog. */
2724 [colorDlg setColor:color]; 2724 [colorDlg setColor:color];
2725 [colorDlg setDialog:dialog]; 2725 [colorDlg setDialog:dialog];
2749 [image lockFocusIfCanDraw]; 2749 [image lockFocusIfCanDraw];
2750 _DWLastDrawable = handle; 2750 _DWLastDrawable = handle;
2751 } 2751 }
2752 NSBezierPath* aPath = [NSBezierPath bezierPath]; 2752 NSBezierPath* aPath = [NSBezierPath bezierPath];
2753 [aPath setLineWidth: 0.5]; 2753 [aPath setLineWidth: 0.5];
2754 [[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]; 2754 NSColor *color = [NSColor colorWithDeviceRed: DW_RED_VALUE(_foreground)/255.0 green: DW_GREEN_VALUE(_foreground)/255.0 blue: DW_BLUE_VALUE(_foreground)/255.0 alpha: 1];
2755 [color set];
2756 [color release];
2755 2757
2756 [aPath moveToPoint:NSMakePoint(x, y)]; 2758 [aPath moveToPoint:NSMakePoint(x, y)];
2757 [aPath stroke]; 2759 [aPath stroke];
2760 [aPath release];
2758 [image unlockFocus]; 2761 [image unlockFocus];
2759 } 2762 }
2760 2763
2761 /* Draw a line on a window (preferably a render window). 2764 /* Draw a line on a window (preferably a render window).
2762 * Parameters: 2765 * Parameters:
2780 [image lockFocusIfCanDraw]; 2783 [image lockFocusIfCanDraw];
2781 _DWLastDrawable = handle; 2784 _DWLastDrawable = handle;
2782 } 2785 }
2783 NSBezierPath* aPath = [NSBezierPath bezierPath]; 2786 NSBezierPath* aPath = [NSBezierPath bezierPath];
2784 [aPath setLineWidth: 0.5]; 2787 [aPath setLineWidth: 0.5];
2785 [[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]; 2788 NSColor *color = [NSColor colorWithDeviceRed: DW_RED_VALUE(_foreground)/255.0 green: DW_GREEN_VALUE(_foreground)/255.0 blue: DW_BLUE_VALUE(_foreground)/255.0 alpha: 1];
2789 [color set];
2790 [color release];
2786 2791
2787 [aPath moveToPoint:NSMakePoint(x1, y1)]; 2792 [aPath moveToPoint:NSMakePoint(x1, y1)];
2788 [aPath lineToPoint:NSMakePoint(x2, y2)]; 2793 [aPath lineToPoint:NSMakePoint(x2, y2)];
2789 [aPath stroke]; 2794 [aPath stroke];
2795 [aPath release];
2790 2796
2791 [image unlockFocus]; 2797 [image unlockFocus];
2792 } 2798 }
2793 2799
2794 /* Draw text on a window (preferably a render window). 2800 /* Draw text on a window (preferably a render window).
2806 if(image) 2812 if(image)
2807 { 2813 {
2808 if([image isMemberOfClass:[NSView class]]) 2814 if([image isMemberOfClass:[NSView class]])
2809 { 2815 {
2810 [image lockFocusIfCanDraw]; 2816 [image lockFocusIfCanDraw];
2811 [[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]; 2817 NSColor *color = [NSColor colorWithDeviceRed: DW_RED_VALUE(_foreground)/255.0 green: DW_GREEN_VALUE(_foreground)/255.0 blue: DW_BLUE_VALUE(_foreground)/255.0 alpha: 1];
2812 NSDictionary *dict = [[NSDictionary alloc] init]; 2818 NSDictionary *dict = [[NSDictionary alloc] initWithObjectsAndKeys:
2819 /*[NSFont fontWithName:@"Helvetica" size:26], NSFontAttributeName,*/
2820 color, NSForegroundColorAttributeName, nil];
2813 [nstr drawAtPoint:NSMakePoint(x, y) withAttributes:dict]; 2821 [nstr drawAtPoint:NSMakePoint(x, y) withAttributes:dict];
2822 [dict release];
2823 [color release];
2814 [image unlockFocus]; 2824 [image unlockFocus];
2815 } 2825 }
2816 _DWLastDrawable = handle; 2826 _DWLastDrawable = handle;
2817 } 2827 }
2818 if(pixmap) 2828 if(pixmap)
2822 NSColor *color = [NSColor colorWithDeviceRed: DW_RED_VALUE(_foreground)/255.0 green: DW_GREEN_VALUE(_foreground)/255.0 blue: DW_BLUE_VALUE(_foreground)/255.0 alpha: 1]; 2832 NSColor *color = [NSColor colorWithDeviceRed: DW_RED_VALUE(_foreground)/255.0 green: DW_GREEN_VALUE(_foreground)/255.0 blue: DW_BLUE_VALUE(_foreground)/255.0 alpha: 1];
2823 NSDictionary *dict = [[NSDictionary alloc] initWithObjectsAndKeys: 2833 NSDictionary *dict = [[NSDictionary alloc] initWithObjectsAndKeys:
2824 /*[NSFont fontWithName:@"Helvetica" size:26], NSFontAttributeName,*/ 2834 /*[NSFont fontWithName:@"Helvetica" size:26], NSFontAttributeName,*/
2825 color, NSForegroundColorAttributeName, nil]; 2835 color, NSForegroundColorAttributeName, nil];
2826 [nstr drawAtPoint:NSMakePoint(x, y) withAttributes:dict]; 2836 [nstr drawAtPoint:NSMakePoint(x, y) withAttributes:dict];
2837 [dict release];
2838 [color release];
2827 [image unlockFocus]; 2839 [image unlockFocus];
2828 } 2840 }
2841 [nstr release];
2829 } 2842 }
2830 2843
2831 /* Query the width and height of a text string. 2844 /* Query the width and height of a text string.
2832 * Parameters: 2845 * Parameters:
2833 * handle: Handle to the window. 2846 * handle: Handle to the window.
2837 * height Pointer to a variable to be filled in with the height. 2850 * height Pointer to a variable to be filled in with the height.
2838 */ 2851 */
2839 void API dw_font_text_extents_get(HWND handle, HPIXMAP pixmap, char *text, int *width, int *height) 2852 void API dw_font_text_extents_get(HWND handle, HPIXMAP pixmap, char *text, int *width, int *height)
2840 { 2853 {
2841 id image = handle; 2854 id image = handle;
2842 NSString *nstr = [ NSString stringWithUTF8String:text ]; 2855 NSString *nstr = [[ NSString stringWithUTF8String:text ] autorelease];
2843 if(pixmap) 2856 if(pixmap)
2844 { 2857 {
2845 image = (id)pixmap->handle; 2858 image = (id)pixmap->handle;
2846 [image lockFocus]; 2859 [image lockFocus];
2847 } 2860 }
2849 { 2862 {
2850 [image lockFocusIfCanDraw]; 2863 [image lockFocusIfCanDraw];
2851 } 2864 }
2852 NSDictionary *dict = [[NSDictionary alloc] init]; 2865 NSDictionary *dict = [[NSDictionary alloc] init];
2853 NSSize size = [nstr sizeWithAttributes:dict]; 2866 NSSize size = [nstr sizeWithAttributes:dict];
2867 [dict release];
2854 if(width) 2868 if(width)
2855 { 2869 {
2856 *width = size.width; 2870 *width = size.width;
2857 } 2871 }
2858 if(height) 2872 if(height)
2859 { 2873 {
2860 *height = size.height; 2874 *height = size.height;
2861 } 2875 }
2876 [nstr release];
2862 [image unlockFocus]; 2877 [image unlockFocus];
2863 } 2878 }
2864 2879
2865 /* Draw a polygon on a window (preferably a render window). 2880 /* Draw a polygon on a window (preferably a render window).
2866 * Parameters: 2881 * Parameters:
2886 [image lockFocusIfCanDraw]; 2901 [image lockFocusIfCanDraw];
2887 _DWLastDrawable = handle; 2902 _DWLastDrawable = handle;
2888 } 2903 }
2889 NSBezierPath* aPath = [NSBezierPath bezierPath]; 2904 NSBezierPath* aPath = [NSBezierPath bezierPath];
2890 [aPath setLineWidth: 0.5]; 2905 [aPath setLineWidth: 0.5];
2891 [[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]; 2906 NSColor *color = [NSColor colorWithDeviceRed: DW_RED_VALUE(_foreground)/255.0 green: DW_GREEN_VALUE(_foreground)/255.0 blue: DW_BLUE_VALUE(_foreground)/255.0 alpha: 1];
2907 [color set];
2908 [color release];
2892 2909
2893 [aPath moveToPoint:NSMakePoint(*x, *y)]; 2910 [aPath moveToPoint:NSMakePoint(*x, *y)];
2894 for(z=1;z<npoints;z++) 2911 for(z=1;z<npoints;z++)
2895 { 2912 {
2896 [aPath lineToPoint:NSMakePoint(x[z], y[z])]; 2913 [aPath lineToPoint:NSMakePoint(x[z], y[z])];
2899 if(fill) 2916 if(fill)
2900 { 2917 {
2901 [aPath fill]; 2918 [aPath fill];
2902 } 2919 }
2903 [aPath stroke]; 2920 [aPath stroke];
2921 [aPath release];
2904 [image unlockFocus]; 2922 [image unlockFocus];
2905 } 2923 }
2906 2924
2907 /* Draw a rectangle on a window (preferably a render window). 2925 /* Draw a rectangle on a window (preferably a render window).
2908 * Parameters: 2926 * Parameters:
2927 [image lockFocusIfCanDraw]; 2945 [image lockFocusIfCanDraw];
2928 _DWLastDrawable = handle; 2946 _DWLastDrawable = handle;
2929 } 2947 }
2930 NSBezierPath* aPath = [NSBezierPath bezierPath]; 2948 NSBezierPath* aPath = [NSBezierPath bezierPath];
2931 [aPath setLineWidth: 0.5]; 2949 [aPath setLineWidth: 0.5];
2932 [[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]; 2950 NSColor *color = [NSColor colorWithDeviceRed: DW_RED_VALUE(_foreground)/255.0 green: DW_GREEN_VALUE(_foreground)/255.0 blue: DW_BLUE_VALUE(_foreground)/255.0 alpha: 1];
2951 [color set];
2952 [color release];
2933 2953
2934 [aPath moveToPoint:NSMakePoint(x, y)]; 2954 [aPath moveToPoint:NSMakePoint(x, y)];
2935 [aPath lineToPoint:NSMakePoint(x, y + height)]; 2955 [aPath lineToPoint:NSMakePoint(x, y + height)];
2936 [aPath lineToPoint:NSMakePoint(x + width, y + height)]; 2956 [aPath lineToPoint:NSMakePoint(x + width, y + height)];
2937 [aPath lineToPoint:NSMakePoint(x + width, y)]; 2957 [aPath lineToPoint:NSMakePoint(x + width, y)];
2938 [aPath closePath]; 2958 [aPath closePath];
2939 [aPath fill]; 2959 [aPath fill];
2940 [aPath stroke]; 2960 [aPath stroke];
2961 [aPath release];
2941 [image unlockFocus]; 2962 [image unlockFocus];
2942 } 2963 }
2943 2964
2944 /* 2965 /*
2945 * Create a tree object to be packed. 2966 * Create a tree object to be packed.
3133 for(z=0;z<count;z++) 3154 for(z=0;z<count;z++)
3134 { 3155 {
3135 NSTableColumn *column = [[NSTableColumn alloc] init]; 3156 NSTableColumn *column = [[NSTableColumn alloc] init];
3136 [[column headerCell] setStringValue:[ NSString stringWithUTF8String:titles[z] ]]; 3157 [[column headerCell] setStringValue:[ NSString stringWithUTF8String:titles[z] ]];
3137 [cont addTableColumn:column]; 3158 [cont addTableColumn:column];
3138 [cont addColumn:column andType:flags[z]]; 3159 [cont addColumn:column andType:(int)flags[z]];
3139 } 3160 }
3140 3161
3141 return TRUE; 3162 return TRUE;
3142 } 3163 }
3143 3164
3681 { 3702 {
3682 HPIXMAP pixmap; 3703 HPIXMAP pixmap;
3683 3704
3684 if (!(pixmap = calloc(1,sizeof(struct _hpixmap)))) 3705 if (!(pixmap = calloc(1,sizeof(struct _hpixmap))))
3685 return NULL; 3706 return NULL;
3686 NSData *thisdata = [[NSData alloc] dataWithBytes:data length:len]; 3707 NSData *thisdata = [[[NSData alloc] dataWithBytes:data length:len] autorelease];
3687 NSImage *image = [[NSImage alloc] initWithData:thisdata]; 3708 NSImage *image = [[NSImage alloc] initWithData:thisdata];
3688 NSSize size = [image size]; 3709 NSSize size = [image size];
3689 pixmap->width = size.width; 3710 pixmap->width = size.width;
3690 pixmap->height = size.height; 3711 pixmap->height = size.height;
3691 pixmap->handle = image; 3712 pixmap->handle = image;
4152 * front: If TRUE page is added at the beginning. 4173 * front: If TRUE page is added at the beginning.
4153 */ 4174 */
4154 unsigned long API dw_notebook_page_new(HWND handle, ULONG flags, int front) 4175 unsigned long API dw_notebook_page_new(HWND handle, ULONG flags, int front)
4155 { 4176 {
4156 DWNotebook *notebook = handle; 4177 DWNotebook *notebook = handle;
4157 int page = [notebook pageid]; 4178 NSInteger page = [notebook pageid];
4158 DWNotebookPage *notepage = [[DWNotebookPage alloc] initWithIdentifier:nil]; 4179 DWNotebookPage *notepage = [[DWNotebookPage alloc] initWithIdentifier:nil];
4159 [notepage setPageid:(NSInteger)page]; 4180 [notepage setPageid:page];
4160 if(front) 4181 if(front)
4161 { 4182 {
4162 [notebook insertTabViewItem:notepage atIndex:(NSInteger)0]; 4183 [notebook insertTabViewItem:notepage atIndex:(NSInteger)0];
4163 } 4184 }
4164 else 4185 else
4404 id object = handle; 4425 id object = handle;
4405 4426
4406 if([object isMemberOfClass:[NSWindow class]]) 4427 if([object isMemberOfClass:[NSWindow class]])
4407 { 4428 {
4408 NSWindow *window = object; 4429 NSWindow *window = object;
4409 int currentstyle = [window styleMask]; 4430 int currentstyle = (int)[window styleMask];
4410 int tmp; 4431 int tmp;
4411 4432
4412 tmp = currentstyle | mask; 4433 tmp = currentstyle | (int)mask;
4413 tmp ^= mask; 4434 tmp ^= mask;
4414 tmp |= style; 4435 tmp |= style;
4415 4436
4416 [window setStyleMask:tmp]; 4437 [window setStyleMask:tmp];
4417 } 4438 }
4847 strcpy(env->osName, "MacOS"); 4868 strcpy(env->osName, "MacOS");
4848 strcpy(tempbuf, name.release); 4869 strcpy(tempbuf, name.release);
4849 4870
4850 env->MajorBuild = env->MinorBuild = 0; 4871 env->MajorBuild = env->MinorBuild = 0;
4851 4872
4852 len = strlen(tempbuf); 4873 len = (int)strlen(tempbuf);
4853 4874
4854 strcpy(env->buildDate, __DATE__); 4875 strcpy(env->buildDate, __DATE__);
4855 strcpy(env->buildTime, __TIME__); 4876 strcpy(env->buildTime, __TIME__);
4856 env->DWMajorVersion = DW_MAJOR_VERSION; 4877 env->DWMajorVersion = DW_MAJOR_VERSION;
4857 env->DWMinorVersion = DW_MINOR_VERSION; 4878 env->DWMinorVersion = DW_MINOR_VERSION;
5145 5166
5146 if(window && signame && sigfunc) 5167 if(window && signame && sigfunc)
5147 { 5168 {
5148 if((message = _findsigmessage(signame)) != 0) 5169 if((message = _findsigmessage(signame)) != 0)
5149 { 5170 {
5150 _new_signal(message, window, msgid, sigfunc, data); 5171 _new_signal(message, window, (int)msgid, sigfunc, data);
5151 } 5172 }
5152 } 5173 }
5153 } 5174 }
5154 5175
5155 /* 5176 /*