ListView.st
changeset 895 02d8e324dca5
parent 890 abd28e2f66ca
child 902 426fc02df6b9
equal deleted inserted replaced
894:210626ca9586 895:02d8e324dca5
  2438 
  2438 
  2439     |bott|
  2439     |bott|
  2440 
  2440 
  2441     (aListLineNr isNil "or:[shown not]") ifTrue:[^ self].
  2441     (aListLineNr isNil "or:[shown not]") ifTrue:[^ self].
  2442 
  2442 
  2443     shown ifFalse:[
  2443 "/  Old code follows. It is no longer used, because:
  2444         firstLineShown := (aListLineNr - 1) max:1.
  2444 "/      1. we must maintain our viewOrigin (not maintained in this code!!)
  2445         firstLineShown > (list size - nFullLinesShown) ifTrue:[
  2445 "/      2. we must inform our dependents about originChanges.
  2446             firstLineShown := list size - nFullLinesShown
  2446 "/
  2447         ].
  2447 "/    shown ifFalse:[
  2448         list size <= nFullLinesShown ifTrue:[
  2448 "/        firstLineShown := (aListLineNr - 1) max:1.
  2449             firstLineShown := 1
  2449 "/        firstLineShown > (list size - nFullLinesShown) ifTrue:[
  2450         ].
  2450 "/            firstLineShown := list size - nFullLinesShown
  2451         ^ self
  2451 "/        ].
  2452     ].
  2452 "/        list size <= nFullLinesShown ifTrue:[
       
  2453 "/            firstLineShown := 1
       
  2454 "/        ].
       
  2455 "/        ^ self
       
  2456 "/    ].
  2453 
  2457 
  2454     (aListLineNr >= firstLineShown) ifTrue:[
  2458     (aListLineNr >= firstLineShown) ifTrue:[
  2455         (aListLineNr < (firstLineShown + nFullLinesShown)) ifTrue:[
  2459         (aListLineNr < (firstLineShown + nFullLinesShown)) ifTrue:[
  2456             ^ self
  2460             ^ self
  2457         ]
  2461         ]
  2467         ^ self scrollToLine:bott
  2471         ^ self scrollToLine:bott
  2468     ].
  2472     ].
  2469     self scrollToLine:(aListLineNr - (nFullLinesShown // 2) + 1)
  2473     self scrollToLine:(aListLineNr - (nFullLinesShown // 2) + 1)
  2470 
  2474 
  2471     "Modified: 26.5.1996 / 16:00:32 / cg"
  2475     "Modified: 26.5.1996 / 16:00:32 / cg"
       
  2476     "Modified: 18.12.1996 / 17:48:22 / stefan"
  2472 !
  2477 !
  2473 
  2478 
  2474 makeVisible:someString
  2479 makeVisible:someString
  2475     "if nescessary, scroll to make the (first)
  2480     "if nescessary, scroll to make the (first)
  2476      line containing someString visible."
  2481      line containing someString visible."
  2769      This will be changed to do all work here, and call it from
  2774      This will be changed to do all work here, and call it from
  2770      the other scrolling methods."
  2775      the other scrolling methods."
  2771 
  2776 
  2772     |dX   "{ Class:SmallInteger }"
  2777     |dX   "{ Class:SmallInteger }"
  2773      dY   "{ Class:SmallInteger }"
  2778      dY   "{ Class:SmallInteger }"
  2774      m2   "{ Class:SmallInteger }"
  2779      m2   "{ Class:SmallInteger }" |
  2775      orgX "{ Class:SmallInteger }"
  2780 
  2776      orgY "{ Class:SmallInteger }" |
  2781     dX := newOrigin x - viewOrigin x.
  2777 
  2782     dY := newOrigin y - viewOrigin y.
  2778     transformation isNil ifTrue:[
       
  2779 	orgY := orgX := 0
       
  2780     ] ifFalse:[
       
  2781 	orgY := transformation translation y negated.
       
  2782 	orgX := transformation translation x negated
       
  2783     ].
       
  2784     dX := newOrigin x - orgX.
       
  2785     dY := newOrigin y - orgY.
       
  2786     dX = 0 ifTrue:[
  2783     dX = 0 ifTrue:[
  2787 	dY < 0 ifTrue:[
  2784         dY < 0 ifTrue:[
  2788 	    ^ self scrollUp:(dY negated).
  2785             ^ self scrollUpPixels:(dY negated).
  2789 	].
  2786         ].
  2790 	dY > 0 ifTrue:[
  2787         dY > 0 ifTrue:[
  2791 	    ^ self scrollDown:dY.
  2788             ^ self scrollDownPixels:dY.
  2792 	].
  2789         ].
  2793 	^ self
  2790         ^ self
  2794     ].
  2791     ].
  2795     dY = 0 ifTrue:[
  2792     dY = 0 ifTrue:[
  2796 	dX < 0 ifTrue:[
  2793         dX < 0 ifTrue:[
  2797 	    ^ self scrollLeft:dX negated
  2794             ^ self scrollLeft:dX negated
  2798 	].
  2795         ].
  2799 	dX > 0 ifTrue:[
  2796         dX > 0 ifTrue:[
  2800 	    ^ self scrollRight:dX
  2797             ^ self scrollRight:dX
  2801 	].
  2798         ].
  2802     ].
  2799     ].
  2803 
  2800 
  2804     self originWillChange.
  2801     self originWillChange.
  2805     self setViewOrigin:newOrigin.
  2802     self setViewOrigin:newOrigin.
  2806     shown ifTrue:[
  2803     shown ifTrue:[
  2807 	m2 := margin * 2. "top & bottom margins"
  2804         m2 := margin * 2. "top & bottom margins"
  2808 	self redrawDeviceX:margin y:margin
  2805         self redrawDeviceX:margin y:margin
  2809 		     width:(width - m2)
  2806                      width:(width - m2)
  2810 		    height:(height - m2).
  2807                     height:(height - m2).
  2811     ].
  2808     ].
  2812     self originChanged:(dX negated @ dY negated).
  2809     self originChanged:(dX negated @ dY negated).
  2813 
  2810 
  2814     "Modified: 22.5.1996 / 11:18:30 / cg"
  2811     "Modified: 22.5.1996 / 11:18:30 / cg"
  2815     "Created: 7.8.1996 / 17:51:34 / stefan"
  2812     "Created: 7.8.1996 / 17:51:34 / stefan"
       
  2813     "Modified: 16.12.1996 / 14:07:32 / stefan"
  2816 !
  2814 !
  2817 
  2815 
  2818 scrollToBottom
  2816 scrollToBottom
  2819     "change origin to show end of text"
  2817     "change origin to show end of text"
  2820 
  2818 
  3503 ! !
  3501 ! !
  3504 
  3502 
  3505 !ListView class methodsFor:'documentation'!
  3503 !ListView class methodsFor:'documentation'!
  3506 
  3504 
  3507 version
  3505 version
  3508     ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.108 1996-11-21 16:44:41 cg Exp $'
  3506     ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.109 1996-12-18 18:08:28 stefan Exp $'
  3509 ! !
  3507 ! !