comparison mac/dw.m @ 802:676d46b31a11

Initial implementation of dw_mle_set_visible().
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Wed, 23 Mar 2011 20:05:11 +0000
parents 5d8e4ecb7820
children 8555ac1bcbcd
comparison
equal deleted inserted replaced
801:5d8e4ecb7820 802:676d46b31a11
3702 * handle: Handle to the MLE to be positioned. 3702 * handle: Handle to the MLE to be positioned.
3703 * line: Line to be visible. 3703 * line: Line to be visible.
3704 */ 3704 */
3705 void API dw_mle_set_visible(HWND handle, int line) 3705 void API dw_mle_set_visible(HWND handle, int line)
3706 { 3706 {
3707 /*NSScrollView *sv = handle; 3707 NSScrollView *sv = handle;
3708 DWMLE *mle = [sv documentView]; 3708 DWMLE *mle = [sv documentView];
3709 [mle scrollrangeToVisible:NSMakeRange(0,13)];*/ 3709 NSTextStorage *ts = [mle textStorage];
3710 NSLog(@"dw_mle_set_visible() unimplemented\n"); 3710 NSMutableString *ms = [ts mutableString];
3711 NSUInteger numberOfLines, index, stringLength = [ms length];
3712
3713 for(index=0, numberOfLines=0; index < stringLength && numberOfLines < line; numberOfLines++)
3714 index = NSMaxRange([ms lineRangeForRange:NSMakeRange(index, 0)]);
3715
3716 if(line == numberOfLines)
3717 {
3718 [mle scrollRangeToVisible:[ms lineRangeForRange:NSMakeRange(index, 0)]];
3719 }
3711 } 3720 }
3712 3721
3713 /* 3722 /*
3714 * Sets the editablity of an MLE box. 3723 * Sets the editablity of an MLE box.
3715 * Parameters: 3724 * Parameters: