ListView.st
branchjv
changeset 5981 50c1bb3e9f98
parent 5898 dd3d011daf37
parent 5947 e20b025f658d
child 5986 1fa5f049f917
--- a/ListView.st	Fri Nov 18 21:10:35 2016 +0000
+++ b/ListView.st	Fri Nov 18 21:15:56 2016 +0000
@@ -1348,7 +1348,7 @@
 
 setContents:something
     "set the contents (either a string or a Collection of strings)
-     dont change position (i.e. do not scroll).
+     don't change position (i.e. do not scroll).
      This can be used to update a self-changing list
      (for example: a file list being shown, without disturbing user too much).
      Compare with #contents:, which scrolls to top."
@@ -1357,9 +1357,9 @@
 
     l := something.
     l notNil ifTrue:[
-	l isString ifTrue:[
-	    l := l asStringCollection
-	]
+        l isString ifTrue:[
+            l := l asStringCollection
+        ]
     ].
     self setList:l.
 
@@ -2367,7 +2367,7 @@
     <resource: #keyboard (#PreviousPage #NextPage #HalfPageUp #HalfPageDown
                           #BeginOfText #EndOfText
                           #ScrollUp #ScrollDown 
-                          #ZoomIn #ZoomOut)>
+                          )>
     |n|
 
     (key == #PreviousPage) ifTrue: [^ self pageUp].
@@ -2386,7 +2386,6 @@
         n := 1 + (self sensor compressKeyPressEventsWithKey:#ScrollDown).
         ^ self scrollDown:n
     ].
-    (key == #ZoomIn or:[key == #ZoomOut]) ifTrue:[ self keyboardZoom:(key == #ZoomIn) ].
 
     super keyPress:key x:x y:y
 !
@@ -2397,6 +2396,18 @@
     self fontLargerOrSmaller:larger
 !
 
+keyboardZoom:larger inAllViews:inAllViews
+    "CTRL+/- zoom action"
+
+    inAllViews ifTrue:[
+        SimpleView allSubInstancesDo:[:each |
+            each keyboardZoom:larger 
+        ].    
+    ] ifFalse:[
+        self keyboardZoom:larger 
+    ].
+!
+
 mapped
     self stopAutoScroll.
     super mapped
@@ -2719,8 +2730,7 @@
      for fix fonts, this is easy ...
     "
     (fontIsFixedWidth
-    and:[lineString isNil
-          or:[lineString hasChangeOfEmphasis not]]) ifTrue:[
+    and:[lineString isNil or:[lineString hasChangeOfEmphasis not]]) ifTrue:[
         ^ (xRel // fontWidth) + 1
     ].
 
@@ -2937,6 +2947,11 @@
     "/ fontAscent := font maxAscent "ascent". "/ maxAscent. -- see SelectionInListViews selection in motif style
     "/ fontAscent := (font maxAscent + font ascent) // 2. "/ maxAscent. -- see SelectionInListViews selection in motif style
     fontWidth := newDeviceFont width.
+    fontWidth == 0 ifTrue:[
+        "/ should not happen, but some bad fonts seem to have it
+        ('ListView [info]: font says, it has zero width: ', newDeviceFont printString) infoPrintCR.
+        fontWidth := 1.
+    ].    
     fontIsFixedWidth := newDeviceFont isFixedWidth.
 
     "Modified: 3.7.1997 / 12:24:25 / cg"
@@ -3543,7 +3558,7 @@
 "/    nFullLinesShown ~~ nLinesShown ifTrue:[
 "/        numLines := numLines + 1
 "/    ].
-    ^ numLines * fontHeight "dont take font height here - think of LabelAndIcons"
+    ^ numLines * fontHeight "don't take font height here - think of LabelAndIcons"
 "/                            + textStartTop
                             - (lineSpacing // 2)
                             + (gc deviceFont descent)
@@ -4046,7 +4061,7 @@
     xVis := xWant - viewOrigin x.
 
     "
-     dont scroll, if already visible
+     don't scroll, if already visible
      (but scroll, if not in inner 20%..80% of visible area)
     "
 "/    ((xVis >= (width // 5)) and:[xVis <= (width * 4 // 5)]) ifTrue:[