Merge jv
authorJan Vrany <jan.vrany@fit.cvut.cz>
Wed, 10 Aug 2016 18:18:42 +0100
branchjv
changeset 5822 b1c3b057c48d
parent 5814 88cb6a7bb8b6 (current diff)
parent 5821 fd8b7742fe2c (diff)
child 5825 526907af5217
Merge
EditField.st
Label.st
ListView.st
TextView.st
--- a/EditField.st	Fri Aug 05 06:42:12 2016 +0200
+++ b/EditField.st	Wed Aug 10 18:18:42 2016 +0100
@@ -2258,7 +2258,7 @@
         w := fontWidth * 20.  "space for 20 characters"
     ] ifFalse:[
         "length of current contents +  50% space to type more characters"
-        f := gc font onDevice:device.
+        f := gc deviceFont.
         w := ((f widthOf:string) * 1.5) rounded. 
         w := w + margin + margin.
     ].
--- a/FramedBox.st	Fri Aug 05 06:42:12 2016 +0200
+++ b/FramedBox.st	Wed Aug 10 18:18:42 2016 +0100
@@ -593,7 +593,6 @@
     ] ifFalse:[
         label isString ifTrue:[
             l := ' ' , label , ' '.
-            gc createFontOnDevice.
         ] ifFalse:[
             l := label
         ].
--- a/Label.st	Fri Aug 05 06:42:12 2016 +0200
+++ b/Label.st	Wed Aug 10 18:18:42 2016 +0100
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 1989 by Claus Gittinger
 	      All Rights Reserved
@@ -1436,7 +1434,7 @@
 
     super initialize.
 
-    currentFont := gc createFontOnDevice.
+    currentFont := gc font.
     self initialHeight:(currentFont height + currentFont descent).
     adjust := #center.
     labelOriginX := labelOriginY := 0.
@@ -1452,7 +1450,6 @@
      different font parameters"
 
     super recreate.
-    gc createFontOnDevice.
     self computeLabelSize.
     self computeLabelOrigin
 !
--- a/ListView.st	Fri Aug 05 06:42:12 2016 +0200
+++ b/ListView.st	Wed Aug 10 18:18:42 2016 +0100
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 1989 by Claus Gittinger
 	      All Rights Reserved
@@ -2877,24 +2875,24 @@
 
     |hMax newDeviceFont|
 
-    newDeviceFont := gc createFontOnDevice.
+    newDeviceFont := gc deviceFont.
     hMax := newDeviceFont height.
 
     includesNonStrings == true ifTrue:[
-	"/
-	"/ find maximum height of lines
-	"/
-	hMax := list inject:hMax into:[:maxSoFar :thisLine |
-					thisLine isNil ifTrue:[
-					    maxSoFar
-					] ifFalse:[
-					    (thisLine isSingleByteString) ifTrue:[
-						maxSoFar
-					    ] ifFalse:[
-						maxSoFar max:(thisLine heightOn:self)
-					    ]
-					]
-			      ].
+        "/
+        "/ find maximum height of lines
+        "/
+        hMax := list inject:hMax into:[:maxSoFar :thisLine |
+                                        thisLine isNil ifTrue:[
+                                            maxSoFar
+                                        ] ifFalse:[
+                                            (thisLine isSingleByteString) ifTrue:[
+                                                maxSoFar
+                                            ] ifFalse:[
+                                                maxSoFar max:(thisLine heightOn:self)
+                                            ]
+                                        ]
+                              ].
 
     ].
     fontHeight := newDeviceFont maxHeight.
@@ -3470,11 +3468,7 @@
 heightForLines:numberOfLines
     "return the height of the receiver, if numberOfLines are to be displayed"
 
-    |font|
-
-    "need a device font for query"
-    font := gc createFontOnDevice.
-    ^ numberOfLines * fontHeight + topMargin + font descent + lineSpacing + (margin * 2)
+    ^ numberOfLines * fontHeight + topMargin + gc deviceFont descent + lineSpacing + (margin * 2)
 
     "Created: 27.1.1996 / 16:55:39 / cg"
 !
@@ -3483,7 +3477,7 @@
     "return the height of the contents in pixels
      - used for scrollbar interface"
 
-    |numLines font|
+    |numLines|
 
     numLines := self numberOfLines.
     numLines == 0 ifTrue:[^ 0].
@@ -3494,14 +3488,10 @@
 "/    nFullLinesShown ~~ nLinesShown ifTrue:[
 "/        numLines := numLines + 1
 "/    ].
-    "
-     need device-font for query
-    "
-    font := gc createFontOnDevice.
     ^ numLines * fontHeight "dont take font height here - think of LabelAndIcons"
 "/                            + textStartTop
                             - (lineSpacing // 2)
-                            + (font descent)
+                            + (gc deviceFont descent)
 "/                            + (font descent * 2) "makes it look better"
                                 .
 
@@ -3660,7 +3650,7 @@
         ^ widthOfWidestLine + (leftMargin * 2)
     ].
 
-    font := gc createFontOnDevice.
+    font := gc deviceFont.
     
     checkedLinesForWidthOfContentsComputation isNil ifTrue:[
         start := 1.
@@ -3738,16 +3728,15 @@
 widthOfLine:lineNr
     "return the width of a line in pixels"
 
-    |line font|
+    |line|
 
     list isNil ifTrue:[^ 0].
     lineNr > list size ifTrue:[^ 0].
     line := list at:lineNr.
     list isNil ifTrue:[^ 0].
 
-    font := gc createFontOnDevice.
     (line isSingleByteString) ifTrue:[
-        ^ font widthOf:line
+        ^ gc deviceFont widthOf:line
     ].
     ^ line widthOn:self
 
--- a/PopUpList.st	Fri Aug 05 06:42:12 2016 +0200
+++ b/PopUpList.st	Wed Aug 10 18:18:42 2016 +0100
@@ -1010,7 +1010,7 @@
 rawLabelSizeOf:aLogo
     "compute the extent needed to hold the label plus the mark"
 
-    |ext mmH mmV longest longestWidth labels currentDeviceFont|
+    |ext mmH mmV longest longestWidth labels deviceFont|
 
     ext := super rawLabelSizeOf:aLogo.
 
@@ -1019,19 +1019,19 @@
     and:[adjust ~~ #center]]) ifTrue:[
         "compute length of longest menu entry"
 
-        currentDeviceFont := gc createFontOnDevice.
+        deviceFont := gc deviceFont.
         longest := logo.
         logo isNil ifTrue:[
             longestWidth := 0
         ] ifFalse:[
-            longestWidth := currentDeviceFont widthOf:logo.
+            longestWidth := deviceFont widthOf:logo.
         ].
         labels := menu value labels.
         labels notNil ifTrue:[
             labels do:[:entry |
                 |this|
 
-                this := currentDeviceFont widthOf:entry printString.
+                this := deviceFont widthOf:entry printString.
                 this > longestWidth ifTrue:[
                     longest := entry.
                     longestWidth := this
--- a/TextView.st	Fri Aug 05 06:42:12 2016 +0200
+++ b/TextView.st	Wed Aug 10 18:18:42 2016 +0100
@@ -9,33 +9,31 @@
  other person.  No title to or ownership of the software is
  hereby transferred.
 "
-'From Smalltalk/X, Version:7.1.0.0 on 15-07-2016 at 17:19:36'                   !
-
 "{ Package: 'stx:libwidg' }"
 
 "{ NameSpace: Smalltalk }"
 
 ListView subclass:#TextView
-        instanceVariableNames:'selectionStartLine selectionStartCol selectionEndLine
-                selectionEndCol clickPos clickStartLine clickStartCol clickLine
-                clickCol clickCount expandingTop wordStartCol wordStartLine
-                wordEndCol wordEndLine selectionFgColor selectionBgColor
-                selectStyle directoryForFileDialog defaultFileNameForFileDialog
-                externalEncoding contentsWasSaved searchAction lastSearchPattern
-                lastSearchWasMatch lastSearchIgnoredCase lastSearchDirection
-                lastSearchWasVariableSearch parenthesisSpecification dropSource
-                dragIsActive saveAction st80SelectMode searchBarActionBlock'
-        classVariableNames:'DefaultViewBackground DefaultSelectionForegroundColor
-                DefaultSelectionBackgroundColor
-                DefaultAlternativeSelectionForegroundColor
-                DefaultAlternativeSelectionBackgroundColor MatchDelayTime
-                WordSelectCatchesBlanks LastSearchPatterns
-                NumRememberedSearchPatterns LastSearchIgnoredCase
-                LastSearchWasMatch DefaultParenthesisSpecification
-                LastSearchWasMatchWithRegex LastSearchWasWrapAtEndOfText
-                LastSearchWasReplace LastSearchReplacedString'
-        poolDictionaries:''
-        category:'Views-Text'
+	instanceVariableNames:'selectionStartLine selectionStartCol selectionEndLine
+		selectionEndCol clickPos clickStartLine clickStartCol clickLine
+		clickCol clickCount expandingTop wordStartCol wordStartLine
+		wordEndCol wordEndLine selectionFgColor selectionBgColor
+		selectStyle directoryForFileDialog defaultFileNameForFileDialog
+		externalEncoding contentsWasSaved searchAction lastSearchPattern
+		lastSearchWasMatch lastSearchIgnoredCase lastSearchDirection
+		lastSearchWasVariableSearch parenthesisSpecification dropSource
+		dragIsActive saveAction st80SelectMode searchBarActionBlock'
+	classVariableNames:'DefaultViewBackground DefaultSelectionForegroundColor
+		DefaultSelectionBackgroundColor
+		DefaultAlternativeSelectionForegroundColor
+		DefaultAlternativeSelectionBackgroundColor MatchDelayTime
+		WordSelectCatchesBlanks LastSearchPatterns
+		NumRememberedSearchPatterns LastSearchIgnoredCase
+		LastSearchWasMatch DefaultParenthesisSpecification
+		LastSearchWasMatchWithRegex LastSearchWasWrapAtEndOfText
+		LastSearchWasReplace LastSearchReplacedString'
+	poolDictionaries:''
+	category:'Views-Text'
 !
 
 !TextView class methodsFor:'documentation'!
@@ -2836,7 +2834,7 @@
 
     |italicFont boldFont font|
 
-    font := gc createFontOnDevice.
+    font := gc deviceFont.
     "/ do we really need this info now?
     "/ on unix, it seems to work with the next two lines commented;
     "/ should probably check on windows too
--- a/VariablePanel.st	Fri Aug 05 06:42:12 2016 +0200
+++ b/VariablePanel.st	Wed Aug 10 18:18:42 2016 +0100
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 1991 by Claus Gittinger
 	      All Rights Reserved
@@ -1954,7 +1952,7 @@
     <resource: #style (#'variablePanel.barHeight'
                        #'variablePanel.barHeightMM')>
 
-    |bH h lvl currentDeviceFont|
+    |bH h lvl|
 
     shadowForm notNil ifTrue:[
         bH := shadowForm height + 2.
@@ -1974,7 +1972,6 @@
     knobHeight := bH.
 
     handleLabels notNil ifTrue:[
-        currentDeviceFont := gc createFontOnDevice.
         bH := handleLabels inject:bH into:[:maxSoFar :thisLabel |
                                            thisLabel isNil ifTrue:[
                                                 maxSoFar
@@ -1982,7 +1979,7 @@
                                                 maxSoFar max:(thisLabel heightOn:self)
                                            ]
                                           ].
-        bH := bH + currentDeviceFont descent - 1
+        bH := bH + gc deviceFont descent - 1
     ].
 
     self barHeight:bH.