--- a/NoteBookView.st Thu Feb 12 19:36:45 2004 +0100
+++ b/NoteBookView.st Fri Feb 13 12:02:13 2004 +0100
@@ -20,7 +20,7 @@
fitLastRow tabModus lastComputedExtent keepCanvas
activeForegroundColor drawLightColor edgeStyle tabInset
tabLabelInset disabledForegroundColor tabLevel tabTopMargin
- tabBottomMargin selectionInsetX selectionInsetY'
+ tabBottomMargin selectionInsetX selectionInsetY translateLabel'
classVariableNames:'DefaultForegroundColor DefaultActiveForegroundColor
DefaultShadowColor DefaultHalfShadowColor DefaultLightColor
DefaultHalfLightColor DefaultEdgeStyle DisabledForegroundColor'
@@ -420,6 +420,43 @@
returns false. The argument to the block is the selection index
"
selectConditionBlock := aOneArgBlock
+!
+
+translateLabel
+ "true if labels are translated
+ "
+ ^ translateLabel
+!
+
+translateLabel:aBoolean
+ "set to true if labels should be translated
+ "
+ translateLabel := aBoolean.
+!
+
+translateToDisplayLabel:aString
+ "translate the label
+ "
+ |application builder string|
+
+ translateLabel ifFalse:[ ^ aString ].
+
+ aString isEmptyOrNil ifTrue:[ ^ aString ].
+
+ application := self application.
+ application isNil ifTrue:[^ aString ].
+
+ builder := application builder.
+
+ builder isNil ifTrue:[
+ string := application resources string:aString.
+ ] ifFalse:[
+
+ string := builder aspectAt:(aString asSymbol).
+ string notNil ifTrue:[^ string ].
+ string := builder resources string:aString.
+ ].
+ ^ string ? aString
! !
!NoteBookView methodsFor:'accessing-channels'!
@@ -1399,7 +1436,7 @@
tabLabelInset := StyleSheet at:#'noteBook.tabLabelInset' default:4@4.
selectionInsetX := (2 max:(tabLevel abs)) + 1.
selectionInsetY := (2 max:(tabLevel abs)) + 1.
-
+ translateLabel := false.
tabTopMargin := StyleSheet at:#'noteBook.tabTopMargin' default:nil.
@@ -2140,10 +2177,10 @@
printableLabel := printableLabel onDevice:(aGC device)
] ifFalse:[
printableLabel isString ifTrue:[
- printableLabel := self resolveDisplayStringFor:printableLabel
+ printableLabel := self resolveDisplayStringFor:printableLabel on:aGC.
] ifFalse:[
printableLabel class == LabelAndIcon ifTrue:[
- printableLabel string:(self resolveDisplayStringFor:(printableLabel string))
+ printableLabel string:(self resolveDisplayStringFor:(printableLabel string) on:aGC)
]
].
]
@@ -2151,7 +2188,6 @@
printableLabel := ''
].
extent := (printableLabel widthOn:aGC) @ (printableLabel heightOn:aGC).
-
!
lineNr
@@ -2318,31 +2354,33 @@
!NoteBookView::Tab methodsFor:'private'!
-resolveDisplayStringFor:aString
+resolveDisplayStringFor:aString on:aNoteBook
|string size rest pos idx|
- size := aString size.
- string := aString.
+ accessCharacter := nil.
+ string := aNoteBook translateToDisplayLabel:aString.
+ size := string size.
pos := 0.
- size > 1 ifTrue:[
- (model notNil and:[(pos := model accessCharacterPosition) ~~ 0]) ifTrue:[
- pos > size ifTrue:[pos := 0]
- ] ifFalse:[
- idx := 1.
-
- [((idx := string indexOf:$& startingAt:idx) ~~ 0 and:[idx < size])] whileTrue:[
- rest := string copyFrom:(idx+1).
-
- idx == 1 ifTrue:[string := rest]
- ifFalse:[string := (string copyFrom:1 to:(idx-1)), rest].
-
- (string at:idx) == $& ifTrue:[idx := idx + 1]
- ifFalse:[pos := idx].
- size := size - 1.
- ]
+ size == 0 ifTrue:[ ^ string ].
+
+ (model notNil and:[(pos := model accessCharacterPosition) ~~ 0]) ifTrue:[
+ pos > size ifTrue:[pos := 0]
+ ] ifFalse:[
+ idx := 1.
+
+ [((idx := string indexOf:$& startingAt:idx) ~~ 0 and:[idx < size])] whileTrue:[
+ rest := string copyFrom:(idx+1).
+
+ idx == 1 ifTrue:[string := rest]
+ ifFalse:[string := (string copyFrom:1 to:(idx-1)), rest].
+
+ (string at:idx) == $& ifTrue:[idx := idx + 1]
+ ifFalse:[pos := idx].
+ size := size - 1.
]
].
+
size ~~ 0 ifTrue:[
pos == 0 ifTrue:[
pos := 1
@@ -2353,8 +2391,6 @@
string emphasisAt:pos add:#underline
].
accessCharacter := (string at:pos) asLowercase
- ] ifFalse:[
- accessCharacter := nil
].
^ string
! !
@@ -2387,5 +2423,5 @@
!NoteBookView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg2/NoteBookView.st,v 1.83 2004-01-29 23:01:45 ca Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg2/NoteBookView.st,v 1.84 2004-02-13 11:02:13 ca Exp $'
! !