*** empty log message ***
authorca
Mon, 14 Oct 2002 06:23:56 +0200
changeset 2286 43f23901a999
parent 2285 0f3ce1478322
child 2287 c9337aecb335
*** empty log message ***
NoteBookView.st
--- a/NoteBookView.st	Sun Oct 13 16:51:42 2002 +0200
+++ b/NoteBookView.st	Mon Oct 14 06:23:56 2002 +0200
@@ -1465,7 +1465,7 @@
 computeLayoutForTab:aTab
     "calculate extent of a tab
     "
-    |layout bwAbs left right top bottom|
+    |layout bwAbs left right top bottom inset|
 
     layout := aTab layout.
 
@@ -1479,15 +1479,12 @@
     top    := layout top.
     bottom := layout bottom.
 
+    bwAbs == 0 ifTrue:[ inset := 2 ]
+              ifFalse:[ inset := 0 ].
+
     (direction == #top or:[direction == #bottom]) ifTrue:[
-        left   := left  - selectionInsetX.
-        right  := right + selectionInsetX.
-
-        bwAbs == 0 ifTrue:[
-            "/ make outer line invisible
-            left  <= 2           ifTrue:[ left  := -1 ].
-            right >= (width - 2) ifTrue:[ right := width + 1 ].
-        ].
+        left   := (left  - selectionInsetX) max:inset.
+        right  := (right + selectionInsetX) min:(width - inset).
 
         direction == #top  ifTrue:[
             bottom := bottom + bwAbs.
@@ -1497,14 +1494,8 @@
             bottom := bottom + selectionInsetY.
         ].
     ] ifFalse:[
-        top    := top    - selectionInsetX.
-        bottom := bottom + selectionInsetX.
-
-        bwAbs == 0 ifTrue:[
-            "/ make outer line invisible
-            top     <= 2            ifTrue:[ top    := -1 ].
-            bottom  >= (height - 2) ifTrue:[ bottom := height + 1 ].
-        ].
+        top    := (top    - selectionInsetX) max:inset.
+        bottom := (bottom + selectionInsetX) min:(height - inset).
 
         direction == #left ifTrue:[
             right := right + bwAbs.
@@ -1585,31 +1576,33 @@
      first     "{ Class:SmallInteger }"
      last      "{ Class:SmallInteger }"
      border    "{ Class:SmallInteger }"
-     maxWidth  "{ Class:SmallInteger }"
      lastLnNr  "{ Class:SmallInteger }"
      tabLvlAbs "{ Class:SmallInteger }"
+     minLeft   "{ Class:SmallInteger }"
+     maxRight  "{ Class:SmallInteger }"
     |
     numberOfLines := 1.
-    maxWidth      := width - selectionInsetX.
     tabLvlAbs     := tabLevel abs max:1.
     border        := tabLevel * 2.
-    xLeft         := selectionInsetX.
     tabHeight     := 0.
+    minLeft       := selectionInsetX.
+    maxRight      := width - selectionInsetX.
+    xLeft         := minLeft.
 
     list do:[:aTab|
         tabWidth  := aTab preferredExtentX + border.
         tabHeight := (aTab preferredExtentY) max:tabHeight.
         xRight    := xLeft + tabWidth.
 
-        xRight > maxWidth ifTrue:[
-            xLeft ~~ selectionInsetX ifTrue:[
+        xRight > maxRight ifTrue:[
+            xLeft ~~ minLeft ifTrue:[
                 numberOfLines := numberOfLines + 1.
-                xLeft  := selectionInsetX.
+                xLeft  := minLeft.
                 xRight := xLeft + tabWidth.
             ].
-            xRight > maxWidth ifTrue:[
-                tabWidth := maxWidth - selectionInsetX.
-                xRight   := maxWidth.
+            xRight > maxRight ifTrue:[
+                tabWidth := maxRight - minLeft.
+                xRight   := maxRight.
             ].
         ].
         aTab lineNr:numberOfLines.
@@ -1657,8 +1650,8 @@
         last    := list findLast:[:t|t lineNr == aLnNr].
         lastLyt := (list at:last) layout.
 
-        (delta := maxWidth - lastLyt right) ~~ 0 ifTrue:[
-            xLeft := selectionInsetX.
+        (delta := maxRight - lastLyt right) ~~ 0 ifTrue:[
+            xLeft := minLeft.
             delta := delta // (last - first + 1).
 
             delta ~~ 0 ifTrue:[
@@ -1670,7 +1663,7 @@
                     xLeft := xLeft + tabWidth.
                 ]
             ].
-            lastLyt width:(maxWidth - lastLyt left)
+            lastLyt width:(maxRight - lastLyt left)
         ].
         first := last + 1.
     ]
@@ -1685,35 +1678,37 @@
      yBottom   "{ Class:SmallInteger }"
      tabWidth  "{ Class:SmallInteger }"
      tabHeight "{ Class:SmallInteger }"
-     maxHeight "{ Class:SmallInteger }"
      delta     "{ Class:SmallInteger }"
      first     "{ Class:SmallInteger }"
      last      "{ Class:SmallInteger }"
      border    "{ Class:SmallInteger }"
      tabLvlAbs "{ Class:SmallInteger }"
+     minTop    "{ Class:SmallInteger }"
+     maxBottom "{ Class:SmallInteger }"
     |
 
     numberOfLines := 1.
-    maxHeight     := height - selectionInsetX.
-    yTop          := selectionInsetX.
     tabLvlAbs     := (tabLevel abs) max:1.
     border        := tabLvlAbs * 2.
     tabHeight     := 0.
+    minTop        := selectionInsetX.
+    maxBottom     := height - selectionInsetX.    
+    yTop          := minTop.
 
     list do:[:aTab|
         tabWidth  := aTab preferredExtentX + border.
         tabHeight := (aTab preferredExtentY) max:tabHeight.
         yBottom   := yTop + tabWidth.
 
-        yBottom > maxHeight ifTrue:[
-            yTop ~~ selectionInsetX ifTrue:[
+        yBottom > maxBottom ifTrue:[
+            yTop ~~ minTop ifTrue:[
                 numberOfLines := numberOfLines + 1.
-                yTop := selectionInsetX.
+                yTop    := minTop.
                 yBottom := yTop + tabWidth.
             ].
-            yBottom > maxHeight ifTrue:[
-                tabWidth := maxHeight - selectionInsetX.
-                yBottom  := maxHeight.
+            yBottom > maxBottom ifTrue:[
+                tabWidth := maxBottom - minTop.
+                yBottom  := maxBottom.
             ].
         ].
         aTab lineNr:numberOfLines.
@@ -1761,8 +1756,8 @@
         last    := list findLast:[:t|t lineNr == aLnNr].
         lastLyt := (list at:last) layout.
 
-        (delta := maxHeight - lastLyt bottom) ~~ 0 ifTrue:[
-            yTop  := selectionInsetX.
+        (delta := maxBottom - lastLyt bottom) ~~ 0 ifTrue:[
+            yTop  := minTop.
             delta := delta // (last - first + 1).
 
             delta ~~ 0 ifTrue:[
@@ -1774,7 +1769,7 @@
                     yTop := yTop + tabWidth.
                 ]
             ].
-            lastLyt height:(maxHeight - lastLyt top)
+            lastLyt height:(maxBottom - lastLyt top)
         ].
         first := last + 1.
     ]
@@ -2347,5 +2342,5 @@
 !NoteBookView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/NoteBookView.st,v 1.67 2002-10-13 14:51:42 ca Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/NoteBookView.st,v 1.68 2002-10-14 04:23:56 ca Exp $'
 ! !