David T. Lewis uploaded a new version of GraphicsTests to project The Trunk:
http://source.squeak.org/trunk/GraphicsTests-dtl.45.mcz
==================== Summary ====================
Name: GraphicsTests-dtl.45
Author: dtl
Time: 14 November 2017, 10:44:29.014493 pm
UUID: 9ccfae93-4e04-47d7-a565-9ad5eda7009c
Ancestors: GraphicsTests-dtl.44
Remove unnecessary references to global World.
=============== Diff against GraphicsTests-dtl.44 ===============
Item was changed:
----- Method: PNGReadWriterTest>>encodeAndDecodeDisplay: (in category 'helpers') -----
encodeAndDecodeDisplay: depth
| form |
fileName := 'testDisplay', depth printString,'.png'.
form := Form extent: (Display extent min: 560@560) depth: depth.
Smalltalk isMorphic
+ ifTrue:[Project current world fullDrawOn: form getCanvas]
- ifTrue:[World fullDrawOn: form getCanvas]
ifFalse:[Display displayOn: form].
self encodeAndDecode: form.!
Item was changed:
----- Method: PNGReadWriterTest>>tearDown (in category 'helpers') -----
tearDown
+ Project current world changed.
- World changed.
fileName notNil ifTrue: [FileDirectory default deleteFileNamed: fileName]!
David T. Lewis uploaded a new version of HelpSystem-Tests to project The Trunk:
http://source.squeak.org/trunk/HelpSystem-Tests-dtl.20.mcz
==================== Summary ====================
Name: HelpSystem-Tests-dtl.20
Author: dtl
Time: 14 November 2017, 10:43:34.406403 pm
UUID: 284f0515-234f-4376-af5e-6f73b521384d
Ancestors: HelpSystem-Tests-ul.19
Remove unnecessary reference to global World.
=============== Diff against HelpSystem-Tests-ul.19 ===============
Item was changed:
----- Method: HelpBrowserTest>>testOpen (in category 'testing') -----
testOpen
| browser |
[
"This should not throw an exception."
browser := self defaultTestClass open.
+ Project current world doOneCycleNow ]
- World doOneCycleNow ]
ensure: [
browser ifNotNil: [ browser delete ] ]!
David T. Lewis uploaded a new version of ToolBuilder-Morphic to project The Trunk:
http://source.squeak.org/trunk/ToolBuilder-Morphic-dtl.199.mcz
==================== Summary ====================
Name: ToolBuilder-Morphic-dtl.199
Author: dtl
Time: 14 November 2017, 10:41:32.579671 pm
UUID: f6bdf59b-ef5d-4052-aec1-4482afc32e5f
Ancestors: ToolBuilder-Morphic-tpr.198
Remove unnecessary reference to global World.
=============== Diff against ToolBuilder-Morphic-tpr.198 ===============
Item was changed:
----- Method: MenuMorph>>openAsTool (in category '*ToolBuilder-Morphic-opening') -----
openAsTool
+ self popUpInWorld: self world.!
- self popUpInWorld: World.!
David T. Lewis uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-dtl.1123.mcz
==================== Summary ====================
Name: Kernel-dtl.1123
Author: dtl
Time: 14 November 2017, 9:49:38.176543 pm
UUID: 5b3f0e1b-0cf5-481f-8d80-31041122d3a7
Ancestors: Kernel-nice.1122
Move Object>>currentEvent, Object>>currentHand, and Object>>currentWord from catagory macpal to *Morphic-Kernel.
=============== Diff against Kernel-nice.1122 ===============
Item was removed:
- ----- Method: Object>>currentEvent (in category 'macpal') -----
- currentEvent
- "Answer the current Morphic event. This method never returns nil."
- ^ActiveEvent ifNil:[self currentHand lastEvent]!
Item was removed:
- ----- Method: Object>>currentHand (in category 'macpal') -----
- currentHand
- "Return a usable HandMorph -- the one associated with the object's current environment. This method will always return a hand, even if it has to conjure one up as a last resort. If a particular hand is actually handling events at the moment (such as a remote hand or a ghost hand), it will be returned."
-
- ^ActiveHand ifNil: [ self currentWorld primaryHand ]!
Item was removed:
- ----- Method: Object>>currentWorld (in category 'macpal') -----
- currentWorld
- "Answer a morphic world that is the current UI focus."
- ^ActiveWorld ifNil:[World]!
David T. Lewis uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-dtl.1362.mcz
==================== Summary ====================
Name: Morphic-dtl.1362
Author: dtl
Time: 14 November 2017, 9:48:26.563471 pm
UUID: 2cd4f6d7-e8d9-48ed-9c73-79c28627b226
Ancestors: Morphic-dtl.1361
Remove unnecessary reference to global World.
Move Object>>currentEvent, Object>>currentHand, and Object>>currentWord from catagory macpal to *Morphic-Kernel.
Fix error in previous update, MailComposition>>addAttachment has been moved to package Network.
=============== Diff against Morphic-dtl.1361 ===============
Item was removed:
- ----- Method: MailComposition>>addAttachment (in category '*Morphic-Support') -----
- addAttachment
- | file fileResult fileName |
- textEditor
- ifNotNil: [self hasUnacceptedEdits ifTrue: [textEditor accept]].
-
- (fileResult := StandardFileMenu oldFile)
- ifNotNil:
- [fileName := fileResult directory fullNameFor: fileResult name.
- file := FileStream readOnlyFileNamed: fileName.
- file ifNotNil:
- [file binary.
- self messageText:
- ((MailMessage from: self messageText asString)
- addAttachmentFrom: file withName: fileResult name; text).
- file close]] !
Item was added:
+ ----- Method: Object>>currentEvent (in category '*Morphic-Kernel') -----
+ currentEvent
+ "Answer the current Morphic event. This method never returns nil."
+ ^ActiveEvent ifNil:[self currentHand lastEvent]!
Item was added:
+ ----- Method: Object>>currentHand (in category '*Morphic-Kernel') -----
+ currentHand
+ "Return a usable HandMorph -- the one associated with the object's current environment. This method will always return a hand, even if it has to conjure one up as a last resort. If a particular hand is actually handling events at the moment (such as a remote hand or a ghost hand), it will be returned."
+
+ ^ActiveHand ifNil: [ self currentWorld primaryHand ]!
Item was added:
+ ----- Method: Object>>currentWorld (in category '*Morphic-Kernel') -----
+ currentWorld
+ "Answer a morphic world that is the current UI focus."
+ ^ActiveWorld ifNil:[Project current world]!
David T. Lewis uploaded a new version of Network to project The Trunk:
http://source.squeak.org/trunk/Network-dtl.210.mcz
==================== Summary ====================
Name: Network-dtl.210
Author: dtl
Time: 14 November 2017, 9:37:54.635956 pm
UUID: 261ad919-abb4-40e5-8f5d-c43cefd44d55
Ancestors: Network-dtl.209
Remove unnecessary World global reference
=============== Diff against Network-dtl.209 ===============
Item was changed:
----- Method: MailMessage>>viewImageInBody (in category 'printing/formatting') -----
viewImageInBody
| stream image |
stream := self body contentStream.
image := Form fromBinaryStream: stream.
+ (Project current world drawingClass withForm: image) openInWorld!
- (World drawingClass withForm: image) openInWorld!
David T. Lewis uploaded a new version of Network to project The Trunk:
http://source.squeak.org/trunk/Network-dtl.209.mcz
==================== Summary ====================
Name: Network-dtl.209
Author: dtl
Time: 14 November 2017, 9:29:47.62246 pm
UUID: e8111790-1d67-4514-9021-4a8bb30f0720
Ancestors: Network-dtl.208
MailComposition>>addAttachment had been moved from *Morphic-Support to Network, but was mistakenly removed from this package in Network-dtl.208. Restore it here.
=============== Diff against Network-dtl.208 ===============
Item was changed:
----- Method: MailMessage>>viewImageInBody (in category 'printing/formatting') -----
viewImageInBody
| stream image |
stream := self body contentStream.
image := Form fromBinaryStream: stream.
+ (World drawingClass withForm: image) openInWorld!
- (Project current world drawingClass withForm: image) openInWorld!
Nicolas Cellier uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-nice.1122.mcz
==================== Summary ====================
Name: Kernel-nice.1122
Author: nice
Time: 14 November 2017, 8:40:24.173283 pm
UUID: fa7a025a-ef0d-431c-80af-32d0a9f170b5
Ancestors: Kernel-eem.1121, Kernel-nice.1120
Merge Kernel-nice.1120 and correct Fraction comment typo
=============== Diff against Kernel-eem.1121 ===============
Item was changed:
Number subclass: #Fraction
instanceVariableNames: 'numerator denominator'
classVariableNames: ''
poolDictionaries: ''
category: 'Kernel-Numbers'!
+ !Fraction commentStamp: 'nice 11/14/2017 20:39' prior: 0!
+ Fraction provides methods for dealing with fractions like 1/3 as a ratio of two integers (as apposed to a decimal representation 0.33333...).
- !Fraction commentStamp: '<historical>' prior: 0!
- Fraction provides methods for dealing with fractions like 1/3 as fractions (not as 0.33333...). All public arithmetic operations answer reduced fractions (see examples).
+ instance variables:
+ numerator <Integer> the number appearing before the fraction bar (above)
+ denominator <Integer> the number appearing after the fraction bar (below)
+
+ A Fraction is generally created by sending the message / to an Integer, like in
- instance variables: 'numerator denominator '
+ 1 / 3
- Examples: (note the parentheses required to get the right answers in Smalltalk and Squeak):
+ Alternatively, it is possible to create a new instance of Fraction by sending #numerator:denominator: to the class.
+ In this later case, it is then user responsibility to ensure that it conforms to the following invariants:
+
+ - the denominator shall allways be positive.
+ A negative Fraction shall have a negative numerator, never a negative denominator.
+ Example: 1 / -3 will return -1/3
+ - the denominator shall allways be greater than 1.
+ A Fraction with denominator 1 shall be reduced to its numerator (an Integer).
+ Example 3 / 1 will answer 3 (the Integer) not 3/1
+ - the numerator and denominator shall never have common multiples.
+ Common multiples shall allways be simplified until (numerator gcd: denominator) = 1.
+ Example 8 / 6 will answer 4 / 3, because both 8=2*4 and 6=2*3 are both divisible by 2.
+
+ A Fraction non conforming to above invariants could be the cause of undefined behavior and unexpected results.
+ If unsure, it is advised to send the message #reduced to the freshly created instance so as to obtain a conforming Fraction, or an Integer.
+
+ Note that Fraction and Integer represent together the set of Rational numbers:
+ - Integer is a subset of rational (those which are whole numbers)
+ - Fraction is used for representing the complementary subset of rational (those which are not whole numbers)
+
+ There could have been a Rational superclass to both Integer and Fraction, and a message #isRational for testing if a Number is a Rational, as well as a message #asRational for converting a Number to a Rational.
+ But this level of indirection is not strictly necessary: instead, the notion of Rational and Fraction are collapsed in Squeak, and Integer are considered as a sort of special Fraction with unitary denominator.
+ Thus #isFraction is the testing message, to which every Integer will also answer true, since considered as a sort of Fraction.
+ And #asFraction is the conversion message, that may answer an instance of Fraction or Integer, depending if the corresponding rational number is whole or not.
+
+ All public arithmetic operations will answer reduced fractions.
+ Examples:
+
(2/3) + (2/3)
+ (2/3) + (1/2) "case showing reduction to common denominator"
+ (2/3) + (4/3) "case where result is reduced to an Integer"
+ (2/3) raisedToInteger: 5 "fractions also can be exponentiated"
- (2/3) + (1/2) "answers shows the reduced fraction"
- (2/3) raisedToInteger: 5 "fractions also can have exponents"
!
Item was changed:
----- Method: Fraction>>gcd: (in category 'arithmetic') -----
gcd: aFraction
| d |
d := denominator gcd: aFraction denominator.
+ ^(numerator *(aFraction denominator//d) gcd: aFraction numerator*(denominator//d)) / (denominator//d*aFraction denominator)!
- ^(numerator *(aFraction denominator/d) gcd: aFraction numerator*(denominator/d)) / (denominator/d*aFraction denominator)!