DSVColumnView.st
changeset 1460 2fe0ac4bc4d1
parent 1448 b389b8c76479
child 1461 1508f35230e6
equal deleted inserted replaced
1459:53f83c83b354 1460:2fe0ac4bc4d1
  2263 sizeChanged:how
  2263 sizeChanged:how
  2264     "size changed - move origin up if possible
  2264     "size changed - move origin up if possible
  2265     "
  2265     "
  2266     super sizeChanged:how.
  2266     super sizeChanged:how.
  2267 
  2267 
  2268     (shown and:[self numberOfColumns ~~ 0 and:[self fitColumns not]]) ifTrue:[
  2268     (shown and:[self numberOfColumns ~~ 0]) ifFalse:[
       
  2269         ^ self
       
  2270     ].
       
  2271     self fitColumns ifFalse:[
  2269         self scrollTo:viewOrigin.       "/ validates viewOrigin
  2272         self scrollTo:viewOrigin.       "/ validates viewOrigin
  2270         self invalidate.
  2273         self invalidate.
  2271         self scrollToSelection
  2274         self scrollToSelection
  2272     ]
  2275     ]
  2273 
  2276 
  2511 !
  2514 !
  2512 
  2515 
  2513 fitColumns
  2516 fitColumns
  2514     "fit columns to view
  2517     "fit columns to view
  2515     "
  2518     "
  2516     |raiseNotify lastColumn dX sz expand resizables deltaWidth|
  2519     |raiseNotify lastColumn dX sz expand resizables deltaWidth changed loSizes|
  2517 
  2520 
  2518     self canFit ifFalse:[^ false ].
  2521     self canFit ifFalse:[^ true ].
  2519 
  2522 
  2520     resizables  := 0.
  2523     resizables  := 0.
  2521     deltaWidth  := 0.
  2524     deltaWidth  := 0.
  2522 
  2525 
  2523     preferredExtent isNil ifTrue:[
  2526     preferredExtent isNil ifTrue:[
  2525         catchChangeEvents := true.
  2528         catchChangeEvents := true.
  2526         self preferredExtent.
  2529         self preferredExtent.
  2527         catchChangeEvents := raiseNotify.
  2530         catchChangeEvents := raiseNotify.
  2528         raiseNotify := raiseNotify not.
  2531         raiseNotify := raiseNotify not.
  2529     ] ifFalse:[
  2532     ] ifFalse:[
  2530         raiseNotify := false
  2533         raiseNotify := false.
       
  2534         loSizes := columnDescriptors collect:[:aCol| aCol width].
  2531     ].
  2535     ].
  2532 
  2536 
  2533     self columnsDo:[:aCol|
  2537     self columnsDo:[:aCol|
  2534         aCol canResize ifTrue:[
  2538         aCol canResize ifTrue:[
  2535             resizables := resizables + 1.
  2539             resizables := resizables + 1.
  2545             deltaWidth := width - sz + margin + margin
  2549             deltaWidth := width - sz + margin + margin
  2546         ]
  2550         ]
  2547     ].
  2551     ].
  2548 
  2552 
  2549     deltaWidth == 0 ifTrue:[
  2553     deltaWidth == 0 ifTrue:[
       
  2554         loSizes notNil ifTrue:[
       
  2555             columnDescriptors keysAndValuesDo:[:i :aCol|
       
  2556                 aCol width ~~ (loSizes at:i) ifTrue:[^ false]
       
  2557             ].
       
  2558             ^ true
       
  2559         ].
  2550         raiseNotify ifTrue:[ self changed:#columnsLayout ].
  2560         raiseNotify ifTrue:[ self changed:#columnsLayout ].
  2551         ^ false
  2561       ^ false
  2552     ].
  2562     ].
  2553 
  2563 
  2554     expand ifTrue:[
  2564     expand ifTrue:[
  2555         (dX := deltaWidth // resizables) ~~ 0 ifTrue:[
  2565         (dX := deltaWidth // resizables) ~~ 0 ifTrue:[
  2556             self columnsDo:[:aCol|aCol canResize ifTrue:[aCol growWidth:dX]]
  2566             self columnsDo:[:aCol|aCol canResize ifTrue:[aCol growWidth:dX]]
  2557         ].
  2567         ].
  2558         lastColumn growWidth:(deltaWidth - (dX * resizables)).
  2568         lastColumn growWidth:(deltaWidth - (dX * resizables)).
       
  2569     ].
       
  2570     loSizes notNil ifTrue:[
       
  2571         changed := false.
       
  2572 
       
  2573         columnDescriptors keysAndValuesDo:[:i :aCol|
       
  2574             aCol width ~~ (loSizes at:i) ifTrue:[changed := true].
       
  2575         ].
       
  2576         changed ifFalse:[
       
  2577             (shown and:[self hasSelection]) ifTrue:[
       
  2578                 editView notNil ifTrue:[
       
  2579                     editView width:(self selectedColumn width - separatorSize)
       
  2580                 ].
       
  2581                 self scrollToSelection.
       
  2582             ].
       
  2583             ^ true.
       
  2584         ].
  2559     ].
  2585     ].
  2560 
  2586 
  2561     self preferredExtentChanged.
  2587     self preferredExtentChanged.
  2562 
  2588 
  2563     shown ifTrue:[
  2589     shown ifTrue:[
  2894             h  := innerHG - dY.
  2920             h  := innerHG - dY.
  2895 
  2921 
  2896             dltOrg y < 0 ifTrue:[y0 := margin. y := y0]
  2922             dltOrg y < 0 ifTrue:[y0 := margin. y := y0]
  2897                         ifFalse:[y1 := margin. y := y1 + h].
  2923                         ifFalse:[y1 := margin. y := y1 + h].
  2898 
  2924 
  2899             self catchExpose.
  2925 "/            self catchExpose.
  2900             self copyFrom:self x:margin y:y0 toX:margin y:y1 width:innerWT height:h async:true.
  2926             self copyFrom:self x:margin y:y0 toX:margin y:y1 width:innerWT height:h async:false.
  2901             self waitForExpose.
  2927 "/            self waitForExpose.
  2902             self invalidateX:margin y:y width:innerWT height:(innerHG - h).
  2928             self invalidateX:margin y:y width:innerWT height:(innerHG - h).
  2903         ]
  2929         ]
  2904     ] ifFalse:[                                 "/ SCROLL HORIZONTAL
  2930     ] ifFalse:[                                 "/ SCROLL HORIZONTAL
  2905         dX := dX abs.
  2931         dX := dX abs.
  2906 
  2932 
  2913             w  := width - dX - margin.
  2939             w  := width - dX - margin.
  2914 
  2940 
  2915             dltOrg x < 0 ifTrue:[x0 := x := margin ]
  2941             dltOrg x < 0 ifTrue:[x0 := x := margin ]
  2916                         ifFalse:[x1 := margin. x := w].
  2942                         ifFalse:[x1 := margin. x := w].
  2917 
  2943 
  2918             self catchExpose.
  2944 "/            self catchExpose.
  2919             self copyFrom:self x:x0 y:margin toX:x1 y:margin width:w height:innerHG async:true.
  2945             self copyFrom:self x:x0 y:margin toX:x1 y:margin width:w height:innerHG async:false.
  2920             self waitForExpose.
  2946 "/            self waitForExpose.
  2921             self invalidateX:x y:margin width:(width - w) height:innerHG.
  2947             self invalidateX:x y:margin width:(width - w) height:innerHG.
  2922         ]
  2948         ]
  2923     ].
  2949     ].
  2924     self originChanged:dltOrg.
  2950     self originChanged:dltOrg.
  2925 
  2951 
  3369 ! !
  3395 ! !
  3370 
  3396 
  3371 !DSVColumnView class methodsFor:'documentation'!
  3397 !DSVColumnView class methodsFor:'documentation'!
  3372 
  3398 
  3373 version
  3399 version
  3374     ^ '$Header: /cvs/stx/stx/libwidg2/DSVColumnView.st,v 1.78 1999-07-13 20:13:44 cg Exp $'
  3400     ^ '$Header: /cvs/stx/stx/libwidg2/DSVColumnView.st,v 1.79 1999-07-26 11:00:18 cg Exp $'
  3375 ! !
  3401 ! !