--- a/NoteBookView.st Sat Nov 10 00:18:08 2018 +0100
+++ b/NoteBookView.st Sat Nov 10 00:18:12 2018 +0100
@@ -421,7 +421,7 @@
].
list := newList.
- preferredExtent := nil.
+ self flushCachedPreferredExtent.
numberOfLines := nil.
selection notNil ifTrue:[
@@ -457,6 +457,7 @@
self invalidate.
"Modified: / 16-07-2013 / 19:15:05 / cg"
+ "Modified: / 09-11-2018 / 20:17:08 / Claus Gittinger"
!
listIndexOf:something
@@ -801,6 +802,56 @@
^ 3
!
+computePreferredExtent
+ "compute max extent x/y based on one line"
+
+ |lvl size x y isHorizontal insetX insetY ext|
+
+ x := y := 0.
+ lvl := tabLevel abs "max:1".
+ size := list size.
+
+ size ~~ 0 ifTrue:[
+ list do:[:aTab|
+ |tabExtent|
+
+ tabExtent := self preferredExtentForTab:aTab.
+ x := tabExtent x + x.
+ y := tabExtent y max:y.
+ ].
+ ].
+ y := y + selectionInsetY + lvl + tabTopMargin + tabBottomMargin.
+ x := x + selectionInsetX + selectionInsetX + ((lvl + lvl) * size).
+
+ isHorizontal := self isHorizontal.
+
+ isHorizontal ifTrue:[
+ x := x + self tabLeftMargin + self tabRightMargin
+ ] ifFalse:[
+ y := y + self tabLeftMargin + self tabRightMargin
+ ].
+
+ tabModus ifFalse:[
+ canvasInset isPoint ifTrue:[
+ insetX := canvasInset x.
+ insetY := canvasInset y.
+ ] ifFalse:[
+ insetX := insetY := canvasInset.
+ ].
+ canvas notNil ifTrue:[ ext := canvas preferredExtent ]
+ ifFalse:[ ext := 100@100 ].
+
+ y := y + insetY + insetY + ext y.
+ x := x max:ext x.
+ x := x + insetX + insetX + lvl + lvl.
+ ].
+
+ isHorizontal ifTrue:[ ^ x @ y ].
+ ^ y @ x
+
+ "Created: / 09-11-2018 / 19:58:00 / Claus Gittinger"
+!
+
destroyButtonFrameForTab:aTab
|l bW bH dX dY bLeft bTop|
@@ -854,66 +905,6 @@
^ 8
!
-preferredExtent
- "compute max extent x/y based on one line"
-
- |lvl size x y isHorizontal insetX insetY ext|
-
- "/ If I have an explicit preferredExtent..
- explicitExtent notNil ifTrue:[
- ^ explicitExtent
- ].
-
- "/ If I have a cached preferredExtent value..
- preferredExtent notNil ifTrue:[
- ^ preferredExtent
- ].
-
- x := y := 0.
- lvl := tabLevel abs "max:1".
- size := list size.
-
- size ~~ 0 ifTrue:[
- list do:[:aTab|
- |tabExtent|
-
- tabExtent := self preferredExtentForTab:aTab.
- x := tabExtent x + x.
- y := tabExtent y max:y.
- ].
- ].
- y := y + selectionInsetY + lvl + tabTopMargin + tabBottomMargin.
- x := x + selectionInsetX + selectionInsetX + ((lvl + lvl) * size).
-
- isHorizontal := self isHorizontal.
-
- isHorizontal ifTrue:[
- x := x + self tabLeftMargin + self tabRightMargin
- ] ifFalse:[
- y := y + self tabLeftMargin + self tabRightMargin
- ].
-
- tabModus ifFalse:[
- canvasInset isPoint ifTrue:[
- insetX := canvasInset x.
- insetY := canvasInset y.
- ] ifFalse:[
- insetX := insetY := canvasInset.
- ].
- canvas notNil ifTrue:[ ext := canvas preferredExtent ]
- ifFalse:[ ext := 100@100 ].
-
- y := y + insetY + insetY + ext y.
- x := x max:ext x.
- x := x + insetX + insetX + lvl + lvl.
- ].
-
- isHorizontal ifTrue:[ ^ x @ y ].
- ^ y @ x
-
- "Modified (format): / 16-11-2016 / 23:13:18 / cg"
-!
-
preferredExtentForTab:aTab
"returns the preferred extent of a specific tab"
@@ -1262,16 +1253,18 @@
!NoteBookView methodsFor:'change & update'!
styleChanged
- "called if the tab style changed
- list must be recomputed
- "
- preferredExtent := nil.
+ "called if the tab style changed;
+ list must be recomputed"
+
+ self flushCachedPreferredExtent.
numberOfLines isNil ifTrue:[
^ self. "/ layout not yet computed
].
self recomputeList.
self invalidate
+
+ "Modified: / 09-11-2018 / 20:17:21 / Claus Gittinger"
!
update:something with:aParameter from:changedObject