Merge jv
authorMerge Script
Sat, 14 Nov 2015 06:43:31 +0100
branchjv
changeset 18896 00f8282955aa
parent 18889 2383cb158535 (current diff)
parent 18895 223497b63b36 (diff)
child 18907 77e711d30041
Merge
CharacterArray.st
Metaclass.st
Object.st
Point.st
Rectangle.st
--- a/CharacterArray.st	Fri Nov 13 06:40:14 2015 +0100
+++ b/CharacterArray.st	Sat Nov 14 06:43:31 2015 +0100
@@ -317,6 +317,7 @@
     "Created: 3.8.1997 / 18:16:40 / cg"
 ! !
 
+
 !CharacterArray class methodsFor:'cleanup'!
 
 lowSpaceCleanup
@@ -766,6 +767,7 @@
     ^ Unicode32String
 ! !
 
+
 !CharacterArray methodsFor:'Compatibility-ANSI'!
 
 addLineDelimiters
@@ -4408,6 +4410,8 @@
 ! !
 
 
+
+
 !CharacterArray methodsFor:'matching - glob expressions'!
 
 compoundMatch:aString
@@ -5774,6 +5778,7 @@
     "Modified: 17.4.1997 / 12:50:23 / cg"
 ! !
 
+
 !CharacterArray methodsFor:'special string converting'!
 
 asUnixFilenameString
@@ -6816,6 +6821,7 @@
     "
 ! !
 
+
 !CharacterArray methodsFor:'substring searching'!
 
 findRangeOfString:subString
@@ -7371,6 +7377,13 @@
     "Modified: / 13-10-2006 / 12:54:12 / cg"
 !
 
+isPlainString
+    "return true, if the receiver is a plain string (without attributes);
+     true is returned here - redefinition of Object>>isPlainString."
+
+    ^ true
+!
+
 isString
     "return true, if the receiver is some kind of string;
      true is returned here - redefinition of Object>>isString."
@@ -7494,6 +7507,7 @@
     ^ aVisitor visitString:self with:aParameter
 ! !
 
+
 !CharacterArray class methodsFor:'documentation'!
 
 version
--- a/Metaclass.st	Fri Nov 13 06:40:14 2015 +0100
+++ b/Metaclass.st	Sat Nov 14 06:43:31 2015 +0100
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 1988 by Claus Gittinger
 	      All Rights Reserved
@@ -828,6 +826,10 @@
     "Created: 15.10.1996 / 19:44:51 / cg"
 !
 
+sharedPools
+    ^ myClass sharedPools
+!
+
 soleInstance
     "return my sole class."
 
@@ -934,7 +936,7 @@
 !Metaclass class methodsFor:'documentation'!
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/Metaclass.st,v 1.217 2015-03-26 10:20:36 cg Exp $'
+    ^ '$Header$'
 ! !
 
 
--- a/Object.st	Fri Nov 13 06:40:14 2015 +0100
+++ b/Object.st	Sat Nov 14 06:43:31 2015 +0100
@@ -1761,6 +1761,8 @@
     "
 ! !
 
+
+
 !Object methodsFor:'attributes access'!
 
 objectAttributeAt:attributeKey
@@ -1883,6 +1885,7 @@
 ! !
 
 
+
 !Object methodsFor:'change & update'!
 
 broadcast:aSelectorSymbol
@@ -9652,6 +9655,13 @@
     ^ false
 !
 
+isPlainString
+    "return true, if the receiver is a plain string - without attributes;
+     false is returned here - the method is redefined in CharacterArray and Text."
+
+    ^ false
+!
+
 isPoint
     "return true, if the receiver is some kind of point;
      false is returned here - the method is only redefined in Point."
@@ -10308,6 +10318,7 @@
 
 
 
+
 !Object class methodsFor:'documentation'!
 
 version
--- a/Point.st	Fri Nov 13 06:40:14 2015 +0100
+++ b/Point.st	Sat Nov 14 06:43:31 2015 +0100
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 1989 by Claus Gittinger
 	      All Rights Reserved
@@ -661,7 +663,7 @@
 abs
     "return a new point with my coordinates taken from the absolute values."
 
-    ^ (x abs) @ (y abs)
+    ^ self class x:(x abs) y:(y abs)
 !
 
 ceiling
@@ -672,7 +674,7 @@
         ^ self
     ].
 
-    ^ (x ceiling) @ (y ceiling)
+    ^ self class x:x ceiling y:y ceiling.
 !
 
 floor
@@ -683,7 +685,7 @@
         ^ self
     ].
 
-    ^ (x floor) @ (y floor)
+    ^ self class x:(x floor) y:(y floor)
 !
 
 quadrant
@@ -744,7 +746,7 @@
     (x isInteger and:[y isInteger]) ifTrue: [
         ^ self
     ].
-    ^ (x rounded) @ (y rounded)
+    ^ self class x:(x rounded) y:(y rounded)
 
     "
      (1.5 @ 2.6) rounded
@@ -767,7 +769,7 @@
         ^ self
     ].
 
-    ^ (x truncated) @ (y truncated)
+    ^ self class x:(x truncated) y:(y truncated)
 ! !
 
 !Point methodsFor:'point functions'!
@@ -1034,75 +1036,75 @@
     "speedup for common cases ..."
 
     (scale isMemberOf:Point) ifTrue:[    
-	^ Point x:(x * scale x) y:(y * scale y)
+        ^ self class x:(x * scale x) y:(y * scale y)
     ].
     (scale isMemberOf:SmallInteger) ifTrue:[
-	^ Point x:(x * scale) y:(y * scale)
+        ^ self class x:(x * scale) y:(y * scale)
     ].
     scale isNumber ifTrue:[
-	^ Point x:(x * scale) y:(y * scale)
+        ^ self class x:(x * scale) y:(y * scale)
     ].
 
     "this is the general (& clean) code ..."
 
     scalePoint := scale asPoint.
-    ^ (x * scalePoint x) @ (y * scalePoint y)
+    ^ self class x:(x * scalePoint x) y:(y * scalePoint y)
 
     "Modified: 25.1.1997 / 17:28:11 / cg"
 !
 
-+ scale 
++ translation 
     "Return a new Point that is the sum of the 
-     receiver and scale (which is a Point or Number)."
+     receiver and translation (which is a Point or Number)."
 
-    |scalePoint|
+    |translationPoint|
 
     "speedup for common cases ..."
 
-    (scale isMemberOf:Point) ifTrue:[     
-        ^ Point x:(x + scale x) y:(y + scale y)
+    (translation isMemberOf:Point) ifTrue:[     
+        ^ self class x:(x + translation x) y:(y + translation y)
     ].
-    (scale isMemberOf:SmallInteger) ifTrue:[
+    (translation isMemberOf:SmallInteger) ifTrue:[
         "/ same as below, but stc can do better here
-        ^ Point x:(x + scale) y:(y + scale)
+        ^ self class x:(x + translation) y:(y + translation)
     ].
-    scale isNumber ifTrue:[
-        ^ Point x:(x + scale) y:(y + scale)
+    translation isNumber ifTrue:[
+        ^ self class x:(x + translation) y:(y + translation)
     ].
 
     "this is the general (& clean) code ..."
 
-    scalePoint := scale asPoint.
-    ^ (x + scalePoint x) @ (y + scalePoint y)
+    translationPoint := translation asPoint.
+    ^ self class x:(x + translationPoint x) y:(y + translationPoint y).
 
     "Modified: 25.1.1997 / 17:27:46 / cg"
 !
 
-- scale 
+- translation 
     "Return a new Point that is the difference of the 
-     receiver and scale (which is a Point or Number)."
+     receiver and translation (which is a Point or Number)."
 
-    |scalePoint|
+    |translationPoint|
 
     "speedup for common cases ..."
 
-    (scale isMemberOf:Point) ifTrue:[     
-	^ Point x:(x - scale x) y:(y - scale y)
+    (translation isMemberOf:Point) ifTrue:[     
+        ^ self class x:(x - translation x) y:(y - translation y)
     ].
-    (scale isMemberOf:SmallInteger) ifTrue:[
-	"/ same as below, but stc can do better here
-	^ Point x:(x - scale) y:(y - scale)
+    (translation isMemberOf:SmallInteger) ifTrue:[
+        "/ same as below, but stc can do better here
+        ^ self class x:(x - translation) y:(y - translation)
     ].
-    scale isNumber ifTrue:[
-	^ Point x:(x - scale) y:(y - scale)
+    translation isNumber ifTrue:[
+        ^ self class x:(x - translation) y:(y - translation)
     ].
 
     "this is the general (& clean) code ..."
 
-    scalePoint := scale asPoint.
-    ^ (x - scalePoint x) @ (y - scalePoint y)
+    translationPoint := translation asPoint.
+    ^ self class x:(x - translationPoint x) y:(y - translationPoint y).
 
-    "Modified: 25.1.1997 / 17:27:40 / cg"
+    "Modified: 25.1.1997 / 17:27:46 / cg"
 !
 
 / scale 
@@ -1114,16 +1116,16 @@
     "speedup for common cases ..."
 
     (scale isMemberOf:Point) ifTrue:[    
-	^ (x / scale x) @ (y / scale y)
+        self class x:(x / scale x) y:(y / scale y)
     ].
     scale isNumber ifTrue:[
-	^ (x / scale) @ (y / scale)
+        ^ self class x:(x / scale) y:(y / scale)
     ].
 
     "this is the general (& clean) code ..."
 
     scalePoint := scale asPoint.
-    ^ (x / scalePoint x) @ (y / scalePoint y)
+    ^ self class x:(x / scalePoint x) y:(y / scalePoint y)
 !
 
 // scale 
@@ -1133,21 +1135,25 @@
     |scalePoint|
 
     scalePoint := scale asPoint.
-    ^ (x // scalePoint x) @ (y // scalePoint y)
+    ^ self class x:(x // scalePoint x) y:(y // scalePoint y)
 !
 
 negated
     "return a new point with my coordinates negated 
      i.e. the receiver mirrored at the origin"
 
-    ^ (x negated) @ (y negated)
+    ^ self class x:x negated y:y negated
+
+    "
+        (1 @ 1) negated
+    "
 !
 
 reciprocal
     "return a new point where the coordinates are
      the reciproce of mine"
 
-    ^ (1 / x) @ (1 / y)
+    ^ self class x:(1 / x) y:(1 / y)
 !
 
 rotateBy:angle about:center
@@ -1161,8 +1167,8 @@
     p := self - center.
     r := p r.
     theta := angle asFloat - p theta.
-    ^ (center x asFloat + (r * theta cos)) @
-      (center y asFloat - (r * theta sin))
+    ^ self class x:(center x asFloat + (r * theta cos))
+                 y:(center y asFloat - (r * theta sin))
 
     "
      (10@10) rotateBy:Float pi about:0@0  
--- a/Rectangle.st	Fri Nov 13 06:40:14 2015 +0100
+++ b/Rectangle.st	Sat Nov 14 06:43:31 2015 +0100
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 1989 by Claus Gittinger
 	      All Rights Reserved
@@ -1808,17 +1810,77 @@
     "
 !
 
+scaledBy:scale translatedBy:translation 
+    "return a new rectangle which is translated (i.e. moved)
+     by translation, aPoint or Number and scaled by scale, aPoint or number."
+
+    |x y w h translationPoint scalePoint sx sy|
+
+    (translation isNil and:[scale isNil]) ifTrue:[
+        ^ self.
+    ].
+
+    x := left.
+    y := top.
+    w := width.
+    h := height.
+
+    scale notNil ifTrue:[
+        (scale isMemberOf:SmallInteger) ifTrue:[
+            "/ this is an stc optimization
+            x := x * scale.
+            y := y * scale.
+            w := w * scale.
+            h := h * scale.
+        ] ifFalse:[
+            scalePoint := scale asPoint.
+            sx := scalePoint x.
+            sy := scalePoint y.
+            x := x * sx.
+            y := y * sy.
+            w := w * sx.
+            h := h * sy.
+        ].
+    ].
+    translation notNil ifTrue:[
+        (translation isMemberOf:SmallInteger) ifTrue:[
+            "/ this is an stc optimization
+            x := x + translation.
+            y := y + translation.
+        ] ifFalse:[
+            translationPoint := translation asPoint.
+            x := x + translationPoint x.
+            y := y + translationPoint y.
+        ].
+    ].
+
+    ^ Rectangle left:x top:y width:w height:h.
+
+    "
+     (Rectangle origin:10@10 corner:50@50) scaledBy:2 translatedBy:10 
+    "
+!
+
 translatedBy:amount
     "return a new rectangle which is translated (i.e. moved)
      by amount, aPoint or Number"
 
     |amountPoint|
 
+    (amount isMemberOf:SmallInteger) ifTrue:[
+        "/ this is an stc optimization
+        ^ Rectangle 
+            left:(left + amount)
+            top:(top + amount)
+            width:width
+            height:height
+    ].
+
     amountPoint := amount asPoint.
     ^ Rectangle left:(left + amountPoint x) 
-		 top:(top + amountPoint y)
-	       width:width
-	      height:height
+                 top:(top + amountPoint y)
+               width:width
+              height:height
     "
      (Rectangle origin:10@10 corner:50@50) translatedBy:10
     "