Mercurial > emacs
comparison src/nsterm.m @ 105562:5a48bf458622
* nsterm.m (ns_color_to_lisp): Use CGFloat where appropriate. Fix
printf format.
(ns_query_color): Use CGFloat where appropriate.
(EmacsView<NSTextInput>, EmacsScroller): Fix method signatures.
(EmacsScroller-mouseDown:) Use long format in printf, and cast
argument.
author | Adrian Robert <Adrian.B.Robert@gmail.com> |
---|---|
date | Mon, 12 Oct 2009 00:27:52 +0000 |
parents | 9f0244ca1777 |
children | f846b59ab251 |
comparison
equal
deleted
inserted
replaced
105561:69741c366370 | 105562:5a48bf458622 |
---|---|
1447 ns_color_to_lisp (NSColor *col) | 1447 ns_color_to_lisp (NSColor *col) |
1448 /* -------------------------------------------------------------------------- | 1448 /* -------------------------------------------------------------------------- |
1449 Convert a color to a lisp string with the RGB equivalent | 1449 Convert a color to a lisp string with the RGB equivalent |
1450 -------------------------------------------------------------------------- */ | 1450 -------------------------------------------------------------------------- */ |
1451 { | 1451 { |
1452 float red, green, blue, alpha, gray; | 1452 CGFloat red, green, blue, alpha, gray; |
1453 char buf[1024]; | 1453 char buf[1024]; |
1454 const char *str; | 1454 const char *str; |
1455 NSTRACE (ns_color_to_lisp); | 1455 NSTRACE (ns_color_to_lisp); |
1456 | 1456 |
1457 BLOCK_INPUT; | 1457 BLOCK_INPUT; |
1467 getRed: &red green: &green blue: &blue alpha: &alpha]; | 1467 getRed: &red green: &green blue: &blue alpha: &alpha]; |
1468 if (red ==green && red ==blue) | 1468 if (red ==green && red ==blue) |
1469 { | 1469 { |
1470 [[col colorUsingColorSpaceName: NSCalibratedWhiteColorSpace] | 1470 [[col colorUsingColorSpaceName: NSCalibratedWhiteColorSpace] |
1471 getWhite: &gray alpha: &alpha]; | 1471 getWhite: &gray alpha: &alpha]; |
1472 snprintf (buf, sizeof (buf), "#%02.2lx%02.2lx%02.2lx", | 1472 snprintf (buf, sizeof (buf), "#%2.2lx%2.2lx%2.2lx", |
1473 lrint (gray * 0xff), lrint (gray * 0xff), lrint (gray * 0xff)); | 1473 lrint (gray * 0xff), lrint (gray * 0xff), lrint (gray * 0xff)); |
1474 UNBLOCK_INPUT; | 1474 UNBLOCK_INPUT; |
1475 return build_string (buf); | 1475 return build_string (buf); |
1476 } | 1476 } |
1477 | 1477 |
1478 snprintf (buf, sizeof (buf), "#%02.2lx%02.2lx%02.2lx", | 1478 snprintf (buf, sizeof (buf), "#%2.2lx%2.2lx%2.2lx", |
1479 lrint (red*0xff), lrint (green*0xff), lrint (blue*0xff)); | 1479 lrint (red*0xff), lrint (green*0xff), lrint (blue*0xff)); |
1480 | 1480 |
1481 UNBLOCK_INPUT; | 1481 UNBLOCK_INPUT; |
1482 return build_string (buf); | 1482 return build_string (buf); |
1483 } | 1483 } |
1489 Get ARGB values out of NSColor col and put them into color_def. | 1489 Get ARGB values out of NSColor col and put them into color_def. |
1490 If setPixel, set the pixel to a concatenated version. | 1490 If setPixel, set the pixel to a concatenated version. |
1491 and set color_def pixel to the resulting index. | 1491 and set color_def pixel to the resulting index. |
1492 -------------------------------------------------------------------------- */ | 1492 -------------------------------------------------------------------------- */ |
1493 { | 1493 { |
1494 float r, g, b, a; | 1494 CGFloat r, g, b, a; |
1495 | 1495 |
1496 [((NSColor *)col) getRed: &r green: &g blue: &b alpha: &a]; | 1496 [((NSColor *)col) getRed: &r green: &g blue: &b alpha: &a]; |
1497 color_def->red = r * 65535; | 1497 color_def->red = r * 65535; |
1498 color_def->green = g * 65535; | 1498 color_def->green = g * 65535; |
1499 color_def->blue = b * 65535; | 1499 color_def->blue = b * 65535; |
4703 if (NS_KEYLOG) | 4703 if (NS_KEYLOG) |
4704 NSLog (@"selectedRange request"); | 4704 NSLog (@"selectedRange request"); |
4705 return NSMakeRange (NSNotFound, 0); | 4705 return NSMakeRange (NSNotFound, 0); |
4706 } | 4706 } |
4707 | 4707 |
4708 - (unsigned int)characterIndexForPoint: (NSPoint)thePoint | 4708 - (NSUInteger)characterIndexForPoint: (NSPoint)thePoint |
4709 { | 4709 { |
4710 if (NS_KEYLOG) | 4710 if (NS_KEYLOG) |
4711 NSLog (@"characterIndexForPoint request"); | 4711 NSLog (@"characterIndexForPoint request"); |
4712 return 0; | 4712 return 0; |
4713 } | 4713 } |
5393 | 5393 |
5394 | 5394 |
5395 /* NSDraggingDestination protocol methods. Actually this is not really a | 5395 /* NSDraggingDestination protocol methods. Actually this is not really a |
5396 protocol, but a category of Object. O well... */ | 5396 protocol, but a category of Object. O well... */ |
5397 | 5397 |
5398 -(unsigned int) draggingEntered: (id <NSDraggingInfo>) sender | 5398 -(NSUInteger) draggingEntered: (id <NSDraggingInfo>) sender |
5399 { | 5399 { |
5400 NSTRACE (draggingEntered); | 5400 NSTRACE (draggingEntered); |
5401 return NSDragOperationGeneric; | 5401 return NSDragOperationGeneric; |
5402 } | 5402 } |
5403 | 5403 |
5678 | 5678 |
5679 /* for repeat button push */ | 5679 /* for repeat button push */ |
5680 #define SCROLL_BAR_FIRST_DELAY 0.5 | 5680 #define SCROLL_BAR_FIRST_DELAY 0.5 |
5681 #define SCROLL_BAR_CONTINUOUS_DELAY (1.0 / 15) | 5681 #define SCROLL_BAR_CONTINUOUS_DELAY (1.0 / 15) |
5682 | 5682 |
5683 + (float) scrollerWidth | 5683 + (CGFloat) scrollerWidth |
5684 { | 5684 { |
5685 /* TODO: if we want to allow variable widths, this is the place to do it, | 5685 /* TODO: if we want to allow variable widths, this is the place to do it, |
5686 however neither GNUstep nor Cocoa support it very well */ | 5686 however neither GNUstep nor Cocoa support it very well */ |
5687 return [NSScroller scrollerWidth]; | 5687 return [NSScroller scrollerWidth]; |
5688 } | 5688 } |
5923 case NSScrollerKnob: | 5923 case NSScrollerKnob: |
5924 last_hit_part = scroll_bar_handle; break; | 5924 last_hit_part = scroll_bar_handle; break; |
5925 case NSScrollerKnobSlot: /* GNUstep-only */ | 5925 case NSScrollerKnobSlot: /* GNUstep-only */ |
5926 last_hit_part = scroll_bar_move_ratio; break; | 5926 last_hit_part = scroll_bar_move_ratio; break; |
5927 default: /* NSScrollerNoPart? */ | 5927 default: /* NSScrollerNoPart? */ |
5928 fprintf (stderr, "EmacsScoller-mouseDown: unexpected part %d\n", part); | 5928 fprintf (stderr, "EmacsScoller-mouseDown: unexpected part %ld\n", |
5929 (long)part); | |
5929 return; | 5930 return; |
5930 } | 5931 } |
5931 | 5932 |
5932 if (inc != 0.0) | 5933 if (inc != 0.0) |
5933 { | 5934 { |