# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1301605102 0 # Node ID 9dc45928a75f93e03559b7f144498ca28e670077 # Parent 0103a8751ab45f1956b0d060b38b19de78b1c400 Added method to do column optimizations like on other platforms. Figure out the maximum width for a column and sizing to that. diff -r 0103a8751ab4 -r 9dc45928a75f mac/dw.m --- a/mac/dw.m Thu Mar 31 19:13:24 2011 +0000 +++ b/mac/dw.m Thu Mar 31 20:58:22 2011 +0000 @@ -1078,6 +1078,7 @@ -(void)setLastQueryPoint:(int)input; -(void)clear; -(void)setup; +-(void)optimize; -(void)setForegroundColor:(NSColor *)input; -(void)doubleClicked:(id)sender; -(void)keyUp:(NSEvent *)theEvent; @@ -1226,6 +1227,44 @@ titles = [[NSPointerArray pointerArrayWithWeakObjects] retain]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(selectionChanged:) name:NSTableViewSelectionDidChangeNotification object:self]; } +-(void)optimize +{ + if(tvcols) + { + int z; + int colcount = (int)[tvcols count]; + int rowcount = (int)[self numberOfRowsInTableView:self]; + + for(z=0;z 0) + { + int x; + int width = 0; + + for(x=0;x width) + { + width = thiswidth; + } + } + [column setWidth:width]; + } + else + { + [column sizeToFit]; + } + } + } + } +} -(void)setForegroundColor:(NSColor *)input { int z, count = (int)[tvcols count]; @@ -5260,7 +5299,8 @@ int _locked_by_me = FALSE; DW_MUTEX_LOCK; DWContainer *cont = handle; - /*[cont sizeToFit];*/ + [cont optimize]; + /* All resizable columns should expand */ [cont setColumnAutoresizingStyle:NSTableViewUniformColumnAutoresizingStyle]; DW_MUTEX_UNLOCK; }