# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1300981370 0 # Node ID f7016a38bedde50a12c1415d3cea959ac8d39583 # Parent 16964b141964703207ba54eca9aa501a14481a86 Fix for dw_window_set_text() on buttons not working. Implemented dw_mle_get_size() returning the line count. diff -r 16964b141964 -r f7016a38bedd mac/dw.m --- a/mac/dw.m Thu Mar 24 06:35:41 2011 +0000 +++ b/mac/dw.m Thu Mar 24 15:42:50 2011 +0000 @@ -3679,9 +3679,13 @@ DWMLE *mle = [sv documentView]; NSTextStorage *ts = [mle textStorage]; NSMutableString *ms = [ts mutableString]; - - *bytes = [ms length]; - *lines = 0; /* TODO: Line count */ + NSUInteger numberOfLines, index, stringLength = [ms length]; + + for(index=0, numberOfLines=0; index < stringLength; numberOfLines++) + index = NSMaxRange([ms lineRangeForRange:NSMakeRange(index, 0)]); + + *bytes = stringLength; + *lines = numberOfLines; } /* @@ -6413,16 +6417,16 @@ DW_MUTEX_LOCK; NSObject *object = handle; - if([ object isKindOfClass:[ NSControl class ] ]) + if([ object isKindOfClass:[ NSWindow class ] ] || [ object isKindOfClass:[ NSButton class ] ]) + { + id window = handle; + [window setTitle:[ NSString stringWithUTF8String:text ]]; + } + else if([ object isKindOfClass:[ NSControl class ] ]) { NSControl *control = handle; [control setStringValue:[ NSString stringWithUTF8String:text ]]; } - else if([ object isKindOfClass:[ NSWindow class ] ]) - { - NSWindow *window = handle; - [window setTitle:[ NSString stringWithUTF8String:text ]]; - } DW_MUTEX_UNLOCK; }