ListView.st
changeset 986 7f50e27cb732
parent 984 dbd60475b3f5
child 990 c466fa72c6e5
equal deleted inserted replaced
985:6e8a73b27390 986:7f50e27cb732
  2537      nPixel sz sH partialCopy|
  2537      nPixel sz sH partialCopy|
  2538 
  2538 
  2539     count := nLines.
  2539     count := nLines.
  2540     sz := self size.
  2540     sz := self size.
  2541     (firstLineShown + nLines + nFullLinesShown > sz) ifTrue:[
  2541     (firstLineShown + nLines + nFullLinesShown > sz) ifTrue:[
  2542 	count := sz - firstLineShown - nFullLinesShown + 1
  2542         count := sz - firstLineShown - nFullLinesShown + 1
  2543     ].
  2543     ].
  2544     count <= 0 ifTrue:[^ self].
  2544     count <= 0 ifTrue:[^ self].
  2545 
  2545 
  2546     self originWillChange.
  2546     self originWillChange.
  2547     nPixel := fontHeight * count.
  2547     nPixel := fontHeight * count.
  2548 
  2548 
  2549     shown ifFalse:[
  2549     shown ifFalse:[
  2550 	firstLineShown := firstLineShown + count.
  2550         firstLineShown := firstLineShown + count.
  2551 	viewOrigin := viewOrigin x @ (viewOrigin y + nPixel).
  2551         viewOrigin := viewOrigin x @ (viewOrigin y + nPixel).
  2552     ] ifTrue:[
  2552     ] ifTrue:[
  2553 	(count >= nLinesShown) ifTrue:[
  2553         (count >= nLinesShown) ifTrue:[
  2554 	    firstLineShown := firstLineShown + count.
  2554             firstLineShown := firstLineShown + count.
  2555 	    viewOrigin := viewOrigin x @ (viewOrigin y + nPixel).
  2555             viewOrigin := viewOrigin x @ (viewOrigin y + nPixel).
  2556 	    self redrawFromVisibleLine:1 to:nLinesShown.
  2556             self redrawFromVisibleLine:1 to:nLinesShown.
  2557 	] ifFalse:[
  2557         ] ifFalse:[
  2558 	    m2 := margin * 2.
  2558             m2 := margin * 2.
  2559 	    w := self widthForScrollBetween:firstLineShown 
  2559             w := self widthForScrollBetween:firstLineShown 
  2560 					and:(firstLineShown + nLinesShown).
  2560                                         and:(firstLineShown + nLinesShown).
  2561 	    w := w + leftMargin.
  2561             w := w + leftMargin.
  2562 
  2562 
  2563 	    sH := lineSpacing // 2.    
  2563             sH := lineSpacing // 2.    
  2564 	    y0 := textStartTop - sH.
  2564             y0 := textStartTop - sH.
  2565 	    h := nPixel + y0.
  2565             h := nPixel + y0.
  2566 	    n := height - h + (lineSpacing " //2 ").   
  2566             n := height - h + (lineSpacing " //2 ").   
  2567 
  2567 
  2568 	    y1 := h + n - 1.
  2568             y1 := h + n - 1.
  2569 	    y1 >= (height - margin) ifTrue:[
  2569             y1 >= (height - margin) ifTrue:[
  2570 		partialCopy := true.
  2570                 partialCopy := true.
  2571 		y1 := height - margin - 1
  2571                 y1 := height - margin - 1
  2572 	    ].
  2572             ].
  2573 
  2573 
  2574 	    self catchExpose.
  2574             self catchExpose.
  2575 	    self copyFrom:self x:margin y:h
  2575             self 
  2576 			     toX:margin y:y0
  2576                 copyFrom:self x:margin y:h
  2577 			   width:w height:(y1 - h + 1).
  2577                 toX:margin y:y0
  2578 
  2578                 width:w height:(y1 - h + 1)
  2579 	    firstLineShown := firstLineShown + count.
  2579                 async:true.
  2580 	    viewOrigin := viewOrigin x @ (viewOrigin y + nPixel).
  2580 
  2581 
  2581             firstLineShown := firstLineShown + count.
  2582 	    (partialCopy == true and:[lineSpacing ~~ 0]) ifTrue:[
  2582             viewOrigin := viewOrigin x @ (viewOrigin y + nPixel).
  2583 		self paint:bgColor.
  2583 
  2584 		self fillRectangleX:margin y:(y0 + (y1 - h + 1))
  2584             (partialCopy == true and:[lineSpacing ~~ 0]) ifTrue:[
  2585 			      width:w height:sH.
  2585                 self paint:bgColor.
  2586 	    ].
  2586                 self fillRectangleX:margin y:(y0 + (y1 - h + 1))
  2587 	    self redrawFromVisibleLine:(nFullLinesShown - count + 1) to:nLinesShown.
  2587                               width:w height:sH.
  2588 	    self waitForExpose.
  2588             ].
  2589 	].
  2589             self redrawFromVisibleLine:(nFullLinesShown - count + 1) to:nLinesShown.
       
  2590             self waitForExpose.
       
  2591         ].
  2590     ].
  2592     ].
  2591     self originChanged:(0 @ nPixel).
  2593     self originChanged:(0 @ nPixel).
  2592 
  2594 
  2593     "Modified: 26.5.1996 / 15:59:29 / cg"
  2595     "Modified: 29.1.1997 / 13:30:23 / cg"
  2594 !
  2596 !
  2595 
  2597 
  2596 scrollDownPixels:pix
  2598 scrollDownPixels:pix
  2597     "change origin to scroll down some pixels 
  2599     "change origin to scroll down some pixels 
  2598      (towards the bottom of the text)
  2600      (towards the bottom of the text)
  3502 ! !
  3504 ! !
  3503 
  3505 
  3504 !ListView class methodsFor:'documentation'!
  3506 !ListView class methodsFor:'documentation'!
  3505 
  3507 
  3506 version
  3508 version
  3507     ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.120 1997-01-29 12:24:00 cg Exp $'
  3509     ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.121 1997-01-29 12:31:23 cg Exp $'
  3508 ! !
  3510 ! !