Levente Uzonyi uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-ul.517.mcz
==================== Summary ====================
Name: Morphic-ul.517
Author: ul
Time: 29 January 2011, 1:29:48.539 am
UUID: 8fc622a0-bd75-1445-b30f-dd525ec0f5bf
Ancestors: Morphic-dtl.516
- avoid an annoying error which is possibly caused by a concurrency issue. It happens rarely (often if you're using RFB) when you press the backspace in a TextEditor.
=============== Diff against Morphic-dtl.516 ===============
Item was changed:
----- Method: TextEditor>>backTo: (in category 'typing support') -----
backTo: startIndex
"During typing, backspace to startIndex. Deleted characters fall into three
clusters, from left to right in the text: (1) preexisting characters that were
backed over; (2) newly typed characters that were backed over (excluding
typeahead, which never even appears); (3) preexisting characters that
were highlighted before typing began. If typing has not yet been opened,
open it and watch for the first and third cluster. If typing has been opened,
watch for the first and second cluster. Save characters from the first and third
cluster in UndoSelection. Tally characters from the first cluster in UndoMessage's parameter.
Delete all the clusters. Do not alter Undoer or UndoInterval (except via
openTypeIn). The code is shorter than the comment."
| saveLimit newBackovers |
saveLimit := beginTypeInBlock
ifNil: [self openTypeIn. UndoSelection := self nullText. self stopIndex]
ifNotNil: [self startOfTyping].
self markIndex: startIndex.
startIndex < saveLimit ifTrue: [
newBackovers := self startOfTyping - startIndex.
beginTypeInBlock := self startIndex.
UndoSelection replaceFrom: 1 to: 0 with:
(paragraph text copyFrom: startIndex to: saveLimit - 1).
+ UndoMessage arguments size > 0 ifTrue: [
+ UndoMessage argument: (UndoMessage argument ifNil: [1]) + newBackovers] ].
- UndoMessage argument: (UndoMessage argument ifNil: [1]) + newBackovers].
self zapSelectionWith: self nullText.
self unselect!
Levente Uzonyi uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-ul.517.mcz
==================== Summary ====================
Name: Morphic-ul.517
Author: ul
Time: 29 January 2011, 1:29:48.539 am
UUID: 8fc622a0-bd75-1445-b30f-dd525ec0f5bf
Ancestors: Morphic-dtl.516
- avoid an annoying error which is possibly caused by a concurrency issue. It happens rarely (often if you're using RFB) when you press the backspace in a TextEditor.
=============== Diff against Morphic-dtl.516 ===============
Item was changed:
----- Method: TextEditor>>backTo: (in category 'typing support') -----
backTo: startIndex
"During typing, backspace to startIndex. Deleted characters fall into three
clusters, from left to right in the text: (1) preexisting characters that were
backed over; (2) newly typed characters that were backed over (excluding
typeahead, which never even appears); (3) preexisting characters that
were highlighted before typing began. If typing has not yet been opened,
open it and watch for the first and third cluster. If typing has been opened,
watch for the first and second cluster. Save characters from the first and third
cluster in UndoSelection. Tally characters from the first cluster in UndoMessage's parameter.
Delete all the clusters. Do not alter Undoer or UndoInterval (except via
openTypeIn). The code is shorter than the comment."
| saveLimit newBackovers |
saveLimit := beginTypeInBlock
ifNil: [self openTypeIn. UndoSelection := self nullText. self stopIndex]
ifNotNil: [self startOfTyping].
self markIndex: startIndex.
startIndex < saveLimit ifTrue: [
newBackovers := self startOfTyping - startIndex.
beginTypeInBlock := self startIndex.
UndoSelection replaceFrom: 1 to: 0 with:
(paragraph text copyFrom: startIndex to: saveLimit - 1).
+ UndoMessage arguments size > 0 ifTrue: [
+ UndoMessage argument: (UndoMessage argument ifNil: [1]) + newBackovers] ].
- UndoMessage argument: (UndoMessage argument ifNil: [1]) + newBackovers].
self zapSelectionWith: self nullText.
self unselect!
Levente Uzonyi uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-ul.517.mcz
==================== Summary ====================
Name: Morphic-ul.517
Author: ul
Time: 29 January 2011, 1:29:48.539 am
UUID: 8fc622a0-bd75-1445-b30f-dd525ec0f5bf
Ancestors: Morphic-dtl.516
- avoid an annoying error which is possibly caused by a concurrency issue. It happens rarely (often if you're using RFB) when you press the backspace in a TextEditor.
=============== Diff against Morphic-dtl.516 ===============
Item was changed:
----- Method: TextEditor>>backTo: (in category 'typing support') -----
backTo: startIndex
"During typing, backspace to startIndex. Deleted characters fall into three
clusters, from left to right in the text: (1) preexisting characters that were
backed over; (2) newly typed characters that were backed over (excluding
typeahead, which never even appears); (3) preexisting characters that
were highlighted before typing began. If typing has not yet been opened,
open it and watch for the first and third cluster. If typing has been opened,
watch for the first and second cluster. Save characters from the first and third
cluster in UndoSelection. Tally characters from the first cluster in UndoMessage's parameter.
Delete all the clusters. Do not alter Undoer or UndoInterval (except via
openTypeIn). The code is shorter than the comment."
| saveLimit newBackovers |
saveLimit := beginTypeInBlock
ifNil: [self openTypeIn. UndoSelection := self nullText. self stopIndex]
ifNotNil: [self startOfTyping].
self markIndex: startIndex.
startIndex < saveLimit ifTrue: [
newBackovers := self startOfTyping - startIndex.
beginTypeInBlock := self startIndex.
UndoSelection replaceFrom: 1 to: 0 with:
(paragraph text copyFrom: startIndex to: saveLimit - 1).
+ UndoMessage arguments size > 0 ifTrue: [
+ UndoMessage argument: (UndoMessage argument ifNil: [1]) + newBackovers] ].
- UndoMessage argument: (UndoMessage argument ifNil: [1]) + newBackovers].
self zapSelectionWith: self nullText.
self unselect!
Levente Uzonyi uploaded a new version of EToys to project The Trunk:
http://source.squeak.org/trunk/EToys-fbs.78.mcz
==================== Summary ====================
Name: EToys-fbs.78
Author: fbs
Time: 22 December 2010, 8:46:12.242 am
UUID: b05ca9a9-a9e0-e047-84a8-0fd215cd95e4
Ancestors: EToys-cmm.77
Use Character space instead of $ to avoid Decompiler tests failing.
=============== Diff against EToys-cmm.77 ===============
Item was changed:
----- Method: SyntaxMorph>>replaceKeyWord:menuItem: (in category 'pop ups') -----
replaceKeyWord: evt menuItem: stringMorph
"Replace my entire message (which may be multi-part) with the one specified. Preserve all argument tiles, either in the new message or in the world outside the scriptor. I am a SelectorNode or KeyWordNode."
| menu new news newSel mm newTree newRec newArgs top oldArgNodes share ctrY |
(menu := stringMorph owner owner) class == RectangleMorph ifTrue: [
menu delete].
new := stringMorph contents.
new first = $( ifTrue: [^ self]. "Cancel"
new first = $ ifTrue: [^ self]. "nothing"
news := String streamContents: [:strm | "remove fake args"
+ (new findBetweenSubStrs: {' 5'. Character space.}) do: [:part | strm nextPutAll: part]].
- (new findBetweenSubStrs: #(' 5' $ )) do: [:part | strm nextPutAll: part]].
newSel := stringMorph valueOfProperty: #syntacticallyCorrectContents.
newSel ifNil: [newSel := news].
mm := MessageSend receiver: 5 selector: newSel
arguments: ((Array new: newSel numArgs) atAllPut: 5).
newTree := mm asTilesIn: Object globalNames: false.
newRec := newTree receiverNode.
newArgs := newTree argumentNodes.
ctrY := self fullBoundsInWorld center y.
top := self messageNode.
newRec owner replaceSubmorph: newRec by: top receiverNode.
oldArgNodes := top argumentNodes.
share := newArgs size min: oldArgNodes size.
(newArgs first: share) with: (oldArgNodes first: share) do: [:newNode :oldNode |
newNode owner replaceSubmorph: newNode by: oldNode].
"later get nodes for objects of the right type for new extra args"
top owner replaceSubmorph: top by: newTree.
"Deposit extra args in the World"
(oldArgNodes copyFrom: share+1 to: oldArgNodes size) do: [:leftOver |
(leftOver parseNode class == LiteralNode and: [leftOver decompile asString = '5'])
ifFalse: [newTree pasteUpMorph addMorphFront: leftOver.
leftOver position: newTree enclosingPane fullBoundsInWorld right - 20 @ ctrY.
ctrY := ctrY + 26]
ifTrue: [leftOver delete]].
newTree acceptIfInScriptor.!
Item was changed:
----- Method: SyntaxMorph>>replaceSel:menuItem: (in category 'pop ups') -----
replaceSel: evt menuItem: stringMorph
"I rep a SelectorNode. Replace my selector with new one that was just chosen from a menu"
| menu new old newSel ms oa na case news |
(menu := stringMorph owner owner) class == RectangleMorph ifTrue: [
menu delete].
new := stringMorph contents.
new first = $( ifTrue: [^ self]. "Cancel"
new first = $ ifTrue: [^ self]. "nothing"
news := String streamContents: [:strm | "remove fake args"
+ (new findBetweenSubStrs: {' 5'. Character space.}) do: [:part | strm nextPutAll: part]].
- (new findBetweenSubStrs: #(' 5' $ )) do: [:part | strm nextPutAll: part]].
newSel := stringMorph valueOfProperty: #syntacticallyCorrectContents.
newSel ifNil: [newSel := news].
old := (ms := self findA: StringMorph) valueOfProperty: #syntacticallyCorrectContents.
old ifNil: [old := (self findA: StringMorph) contents].
oa := old numArgs. na := newSel numArgs. case := 5.
(oa = 1) & (na = 1) ifTrue: [case := 1].
(oa = 0) & (na = 0) ifTrue: [case := 2].
(oa = 1) & (na = 0) ifTrue: [case := 3].
(oa = 0) & (na = 1) ifTrue: [case := 4].
case <= 4 ifTrue: ["replace the selector"
ms contents: news. "not multi-part"
ms setProperty: #syntacticallyCorrectContents toValue: newSel].
case = 3 ifTrue: [owner tossOutArg: 1].
case = 4 ifTrue: [self addArg: 1].
"more cases here. Rebuild the entire MessageNode"
self acceptIfInScriptor.!
Levente Uzonyi uploaded a new version of EToys to project The Trunk:
http://source.squeak.org/trunk/EToys-fbs.78.mcz
==================== Summary ====================
Name: EToys-fbs.78
Author: fbs
Time: 22 December 2010, 8:46:12.242 am
UUID: b05ca9a9-a9e0-e047-84a8-0fd215cd95e4
Ancestors: EToys-cmm.77
Use Character space instead of $ to avoid Decompiler tests failing.
=============== Diff against EToys-cmm.77 ===============
Item was changed:
----- Method: SyntaxMorph>>replaceKeyWord:menuItem: (in category 'pop ups') -----
replaceKeyWord: evt menuItem: stringMorph
"Replace my entire message (which may be multi-part) with the one specified. Preserve all argument tiles, either in the new message or in the world outside the scriptor. I am a SelectorNode or KeyWordNode."
| menu new news newSel mm newTree newRec newArgs top oldArgNodes share ctrY |
(menu := stringMorph owner owner) class == RectangleMorph ifTrue: [
menu delete].
new := stringMorph contents.
new first = $( ifTrue: [^ self]. "Cancel"
new first = $ ifTrue: [^ self]. "nothing"
news := String streamContents: [:strm | "remove fake args"
+ (new findBetweenSubStrs: {' 5'. Character space.}) do: [:part | strm nextPutAll: part]].
- (new findBetweenSubStrs: #(' 5' $ )) do: [:part | strm nextPutAll: part]].
newSel := stringMorph valueOfProperty: #syntacticallyCorrectContents.
newSel ifNil: [newSel := news].
mm := MessageSend receiver: 5 selector: newSel
arguments: ((Array new: newSel numArgs) atAllPut: 5).
newTree := mm asTilesIn: Object globalNames: false.
newRec := newTree receiverNode.
newArgs := newTree argumentNodes.
ctrY := self fullBoundsInWorld center y.
top := self messageNode.
newRec owner replaceSubmorph: newRec by: top receiverNode.
oldArgNodes := top argumentNodes.
share := newArgs size min: oldArgNodes size.
(newArgs first: share) with: (oldArgNodes first: share) do: [:newNode :oldNode |
newNode owner replaceSubmorph: newNode by: oldNode].
"later get nodes for objects of the right type for new extra args"
top owner replaceSubmorph: top by: newTree.
"Deposit extra args in the World"
(oldArgNodes copyFrom: share+1 to: oldArgNodes size) do: [:leftOver |
(leftOver parseNode class == LiteralNode and: [leftOver decompile asString = '5'])
ifFalse: [newTree pasteUpMorph addMorphFront: leftOver.
leftOver position: newTree enclosingPane fullBoundsInWorld right - 20 @ ctrY.
ctrY := ctrY + 26]
ifTrue: [leftOver delete]].
newTree acceptIfInScriptor.!
Item was changed:
----- Method: SyntaxMorph>>replaceSel:menuItem: (in category 'pop ups') -----
replaceSel: evt menuItem: stringMorph
"I rep a SelectorNode. Replace my selector with new one that was just chosen from a menu"
| menu new old newSel ms oa na case news |
(menu := stringMorph owner owner) class == RectangleMorph ifTrue: [
menu delete].
new := stringMorph contents.
new first = $( ifTrue: [^ self]. "Cancel"
new first = $ ifTrue: [^ self]. "nothing"
news := String streamContents: [:strm | "remove fake args"
+ (new findBetweenSubStrs: {' 5'. Character space.}) do: [:part | strm nextPutAll: part]].
- (new findBetweenSubStrs: #(' 5' $ )) do: [:part | strm nextPutAll: part]].
newSel := stringMorph valueOfProperty: #syntacticallyCorrectContents.
newSel ifNil: [newSel := news].
old := (ms := self findA: StringMorph) valueOfProperty: #syntacticallyCorrectContents.
old ifNil: [old := (self findA: StringMorph) contents].
oa := old numArgs. na := newSel numArgs. case := 5.
(oa = 1) & (na = 1) ifTrue: [case := 1].
(oa = 0) & (na = 0) ifTrue: [case := 2].
(oa = 1) & (na = 0) ifTrue: [case := 3].
(oa = 0) & (na = 1) ifTrue: [case := 4].
case <= 4 ifTrue: ["replace the selector"
ms contents: news. "not multi-part"
ms setProperty: #syntacticallyCorrectContents toValue: newSel].
case = 3 ifTrue: [owner tossOutArg: 1].
case = 4 ifTrue: [self addArg: 1].
"more cases here. Rebuild the entire MessageNode"
self acceptIfInScriptor.!
Levente Uzonyi uploaded a new version of EToys to project The Trunk:
http://source.squeak.org/trunk/EToys-fbs.78.mcz
==================== Summary ====================
Name: EToys-fbs.78
Author: fbs
Time: 22 December 2010, 8:46:12.242 am
UUID: b05ca9a9-a9e0-e047-84a8-0fd215cd95e4
Ancestors: EToys-cmm.77
Use Character space instead of $ to avoid Decompiler tests failing.
=============== Diff against EToys-cmm.77 ===============
Item was changed:
----- Method: SyntaxMorph>>replaceKeyWord:menuItem: (in category 'pop ups') -----
replaceKeyWord: evt menuItem: stringMorph
"Replace my entire message (which may be multi-part) with the one specified. Preserve all argument tiles, either in the new message or in the world outside the scriptor. I am a SelectorNode or KeyWordNode."
| menu new news newSel mm newTree newRec newArgs top oldArgNodes share ctrY |
(menu := stringMorph owner owner) class == RectangleMorph ifTrue: [
menu delete].
new := stringMorph contents.
new first = $( ifTrue: [^ self]. "Cancel"
new first = $ ifTrue: [^ self]. "nothing"
news := String streamContents: [:strm | "remove fake args"
+ (new findBetweenSubStrs: {' 5'. Character space.}) do: [:part | strm nextPutAll: part]].
- (new findBetweenSubStrs: #(' 5' $ )) do: [:part | strm nextPutAll: part]].
newSel := stringMorph valueOfProperty: #syntacticallyCorrectContents.
newSel ifNil: [newSel := news].
mm := MessageSend receiver: 5 selector: newSel
arguments: ((Array new: newSel numArgs) atAllPut: 5).
newTree := mm asTilesIn: Object globalNames: false.
newRec := newTree receiverNode.
newArgs := newTree argumentNodes.
ctrY := self fullBoundsInWorld center y.
top := self messageNode.
newRec owner replaceSubmorph: newRec by: top receiverNode.
oldArgNodes := top argumentNodes.
share := newArgs size min: oldArgNodes size.
(newArgs first: share) with: (oldArgNodes first: share) do: [:newNode :oldNode |
newNode owner replaceSubmorph: newNode by: oldNode].
"later get nodes for objects of the right type for new extra args"
top owner replaceSubmorph: top by: newTree.
"Deposit extra args in the World"
(oldArgNodes copyFrom: share+1 to: oldArgNodes size) do: [:leftOver |
(leftOver parseNode class == LiteralNode and: [leftOver decompile asString = '5'])
ifFalse: [newTree pasteUpMorph addMorphFront: leftOver.
leftOver position: newTree enclosingPane fullBoundsInWorld right - 20 @ ctrY.
ctrY := ctrY + 26]
ifTrue: [leftOver delete]].
newTree acceptIfInScriptor.!
Item was changed:
----- Method: SyntaxMorph>>replaceSel:menuItem: (in category 'pop ups') -----
replaceSel: evt menuItem: stringMorph
"I rep a SelectorNode. Replace my selector with new one that was just chosen from a menu"
| menu new old newSel ms oa na case news |
(menu := stringMorph owner owner) class == RectangleMorph ifTrue: [
menu delete].
new := stringMorph contents.
new first = $( ifTrue: [^ self]. "Cancel"
new first = $ ifTrue: [^ self]. "nothing"
news := String streamContents: [:strm | "remove fake args"
+ (new findBetweenSubStrs: {' 5'. Character space.}) do: [:part | strm nextPutAll: part]].
- (new findBetweenSubStrs: #(' 5' $ )) do: [:part | strm nextPutAll: part]].
newSel := stringMorph valueOfProperty: #syntacticallyCorrectContents.
newSel ifNil: [newSel := news].
old := (ms := self findA: StringMorph) valueOfProperty: #syntacticallyCorrectContents.
old ifNil: [old := (self findA: StringMorph) contents].
oa := old numArgs. na := newSel numArgs. case := 5.
(oa = 1) & (na = 1) ifTrue: [case := 1].
(oa = 0) & (na = 0) ifTrue: [case := 2].
(oa = 1) & (na = 0) ifTrue: [case := 3].
(oa = 0) & (na = 1) ifTrue: [case := 4].
case <= 4 ifTrue: ["replace the selector"
ms contents: news. "not multi-part"
ms setProperty: #syntacticallyCorrectContents toValue: newSel].
case = 3 ifTrue: [owner tossOutArg: 1].
case = 4 ifTrue: [self addArg: 1].
"more cases here. Rebuild the entire MessageNode"
self acceptIfInScriptor.!
Levente Uzonyi uploaded a new version of EToys to project The Trunk:
http://source.squeak.org/trunk/EToys-ul.80.mcz
==================== Summary ====================
Name: EToys-ul.80
Author: ul
Time: 29 January 2011, 1:21:24.328 am
UUID: 9b00814e-958d-d04c-a09e-bc5440d726d4
Ancestors: EToys-nice.79, EToys-fbs.78
- merged
=============== Diff against EToys-nice.79 ===============
Item was changed:
----- Method: SyntaxMorph>>replaceKeyWord:menuItem: (in category 'pop ups') -----
replaceKeyWord: evt menuItem: stringMorph
"Replace my entire message (which may be multi-part) with the one specified. Preserve all argument tiles, either in the new message or in the world outside the scriptor. I am a SelectorNode or KeyWordNode."
| menu new news newSel mm newTree newRec newArgs top oldArgNodes share ctrY |
(menu := stringMorph owner owner) class == RectangleMorph ifTrue: [
menu delete].
new := stringMorph contents.
new first = $( ifTrue: [^ self]. "Cancel"
new first = $ ifTrue: [^ self]. "nothing"
news := String streamContents: [:strm | "remove fake args"
+ (new findBetweenSubStrs: {' 5'. Character space.}) do: [:part | strm nextPutAll: part]].
- (new findBetweenSubStrs: #(' 5' $ )) do: [:part | strm nextPutAll: part]].
newSel := stringMorph valueOfProperty: #syntacticallyCorrectContents.
newSel ifNil: [newSel := news].
mm := MessageSend receiver: 5 selector: newSel
arguments: ((Array new: newSel numArgs) atAllPut: 5).
newTree := mm asTilesIn: Object globalNames: false.
newRec := newTree receiverNode.
newArgs := newTree argumentNodes.
ctrY := self fullBoundsInWorld center y.
top := self messageNode.
newRec owner replaceSubmorph: newRec by: top receiverNode.
oldArgNodes := top argumentNodes.
share := newArgs size min: oldArgNodes size.
(newArgs first: share) with: (oldArgNodes first: share) do: [:newNode :oldNode |
newNode owner replaceSubmorph: newNode by: oldNode].
"later get nodes for objects of the right type for new extra args"
top owner replaceSubmorph: top by: newTree.
"Deposit extra args in the World"
(oldArgNodes copyFrom: share+1 to: oldArgNodes size) do: [:leftOver |
(leftOver parseNode class == LiteralNode and: [leftOver decompile asString = '5'])
ifFalse: [newTree pasteUpMorph addMorphFront: leftOver.
leftOver position: newTree enclosingPane fullBoundsInWorld right - 20 @ ctrY.
ctrY := ctrY + 26]
ifTrue: [leftOver delete]].
newTree acceptIfInScriptor.!
Item was changed:
----- Method: SyntaxMorph>>replaceSel:menuItem: (in category 'pop ups') -----
replaceSel: evt menuItem: stringMorph
"I rep a SelectorNode. Replace my selector with new one that was just chosen from a menu"
| menu new old newSel ms oa na case news |
(menu := stringMorph owner owner) class == RectangleMorph ifTrue: [
menu delete].
new := stringMorph contents.
new first = $( ifTrue: [^ self]. "Cancel"
new first = $ ifTrue: [^ self]. "nothing"
news := String streamContents: [:strm | "remove fake args"
+ (new findBetweenSubStrs: {' 5'. Character space.}) do: [:part | strm nextPutAll: part]].
- (new findBetweenSubStrs: #(' 5' $ )) do: [:part | strm nextPutAll: part]].
newSel := stringMorph valueOfProperty: #syntacticallyCorrectContents.
newSel ifNil: [newSel := news].
old := (ms := self findA: StringMorph) valueOfProperty: #syntacticallyCorrectContents.
old ifNil: [old := (self findA: StringMorph) contents].
oa := old numArgs. na := newSel numArgs. case := 5.
(oa = 1) & (na = 1) ifTrue: [case := 1].
(oa = 0) & (na = 0) ifTrue: [case := 2].
(oa = 1) & (na = 0) ifTrue: [case := 3].
(oa = 0) & (na = 1) ifTrue: [case := 4].
case <= 4 ifTrue: ["replace the selector"
ms contents: news. "not multi-part"
ms setProperty: #syntacticallyCorrectContents toValue: newSel].
case = 3 ifTrue: [owner tossOutArg: 1].
case = 4 ifTrue: [self addArg: 1].
"more cases here. Rebuild the entire MessageNode"
self acceptIfInScriptor.!
Levente Uzonyi uploaded a new version of EToys to project The Trunk:
http://source.squeak.org/trunk/EToys-ul.80.mcz
==================== Summary ====================
Name: EToys-ul.80
Author: ul
Time: 29 January 2011, 1:21:24.328 am
UUID: 9b00814e-958d-d04c-a09e-bc5440d726d4
Ancestors: EToys-nice.79, EToys-fbs.78
- merged
=============== Diff against EToys-nice.79 ===============
Item was changed:
----- Method: SyntaxMorph>>replaceKeyWord:menuItem: (in category 'pop ups') -----
replaceKeyWord: evt menuItem: stringMorph
"Replace my entire message (which may be multi-part) with the one specified. Preserve all argument tiles, either in the new message or in the world outside the scriptor. I am a SelectorNode or KeyWordNode."
| menu new news newSel mm newTree newRec newArgs top oldArgNodes share ctrY |
(menu := stringMorph owner owner) class == RectangleMorph ifTrue: [
menu delete].
new := stringMorph contents.
new first = $( ifTrue: [^ self]. "Cancel"
new first = $ ifTrue: [^ self]. "nothing"
news := String streamContents: [:strm | "remove fake args"
+ (new findBetweenSubStrs: {' 5'. Character space.}) do: [:part | strm nextPutAll: part]].
- (new findBetweenSubStrs: #(' 5' $ )) do: [:part | strm nextPutAll: part]].
newSel := stringMorph valueOfProperty: #syntacticallyCorrectContents.
newSel ifNil: [newSel := news].
mm := MessageSend receiver: 5 selector: newSel
arguments: ((Array new: newSel numArgs) atAllPut: 5).
newTree := mm asTilesIn: Object globalNames: false.
newRec := newTree receiverNode.
newArgs := newTree argumentNodes.
ctrY := self fullBoundsInWorld center y.
top := self messageNode.
newRec owner replaceSubmorph: newRec by: top receiverNode.
oldArgNodes := top argumentNodes.
share := newArgs size min: oldArgNodes size.
(newArgs first: share) with: (oldArgNodes first: share) do: [:newNode :oldNode |
newNode owner replaceSubmorph: newNode by: oldNode].
"later get nodes for objects of the right type for new extra args"
top owner replaceSubmorph: top by: newTree.
"Deposit extra args in the World"
(oldArgNodes copyFrom: share+1 to: oldArgNodes size) do: [:leftOver |
(leftOver parseNode class == LiteralNode and: [leftOver decompile asString = '5'])
ifFalse: [newTree pasteUpMorph addMorphFront: leftOver.
leftOver position: newTree enclosingPane fullBoundsInWorld right - 20 @ ctrY.
ctrY := ctrY + 26]
ifTrue: [leftOver delete]].
newTree acceptIfInScriptor.!
Item was changed:
----- Method: SyntaxMorph>>replaceSel:menuItem: (in category 'pop ups') -----
replaceSel: evt menuItem: stringMorph
"I rep a SelectorNode. Replace my selector with new one that was just chosen from a menu"
| menu new old newSel ms oa na case news |
(menu := stringMorph owner owner) class == RectangleMorph ifTrue: [
menu delete].
new := stringMorph contents.
new first = $( ifTrue: [^ self]. "Cancel"
new first = $ ifTrue: [^ self]. "nothing"
news := String streamContents: [:strm | "remove fake args"
+ (new findBetweenSubStrs: {' 5'. Character space.}) do: [:part | strm nextPutAll: part]].
- (new findBetweenSubStrs: #(' 5' $ )) do: [:part | strm nextPutAll: part]].
newSel := stringMorph valueOfProperty: #syntacticallyCorrectContents.
newSel ifNil: [newSel := news].
old := (ms := self findA: StringMorph) valueOfProperty: #syntacticallyCorrectContents.
old ifNil: [old := (self findA: StringMorph) contents].
oa := old numArgs. na := newSel numArgs. case := 5.
(oa = 1) & (na = 1) ifTrue: [case := 1].
(oa = 0) & (na = 0) ifTrue: [case := 2].
(oa = 1) & (na = 0) ifTrue: [case := 3].
(oa = 0) & (na = 1) ifTrue: [case := 4].
case <= 4 ifTrue: ["replace the selector"
ms contents: news. "not multi-part"
ms setProperty: #syntacticallyCorrectContents toValue: newSel].
case = 3 ifTrue: [owner tossOutArg: 1].
case = 4 ifTrue: [self addArg: 1].
"more cases here. Rebuild the entire MessageNode"
self acceptIfInScriptor.!
Levente Uzonyi uploaded a new version of EToys to project The Trunk:
http://source.squeak.org/trunk/EToys-ul.80.mcz
==================== Summary ====================
Name: EToys-ul.80
Author: ul
Time: 29 January 2011, 1:21:24.328 am
UUID: 9b00814e-958d-d04c-a09e-bc5440d726d4
Ancestors: EToys-nice.79, EToys-fbs.78
- merged
=============== Diff against EToys-nice.79 ===============
Item was changed:
----- Method: SyntaxMorph>>replaceKeyWord:menuItem: (in category 'pop ups') -----
replaceKeyWord: evt menuItem: stringMorph
"Replace my entire message (which may be multi-part) with the one specified. Preserve all argument tiles, either in the new message or in the world outside the scriptor. I am a SelectorNode or KeyWordNode."
| menu new news newSel mm newTree newRec newArgs top oldArgNodes share ctrY |
(menu := stringMorph owner owner) class == RectangleMorph ifTrue: [
menu delete].
new := stringMorph contents.
new first = $( ifTrue: [^ self]. "Cancel"
new first = $ ifTrue: [^ self]. "nothing"
news := String streamContents: [:strm | "remove fake args"
+ (new findBetweenSubStrs: {' 5'. Character space.}) do: [:part | strm nextPutAll: part]].
- (new findBetweenSubStrs: #(' 5' $ )) do: [:part | strm nextPutAll: part]].
newSel := stringMorph valueOfProperty: #syntacticallyCorrectContents.
newSel ifNil: [newSel := news].
mm := MessageSend receiver: 5 selector: newSel
arguments: ((Array new: newSel numArgs) atAllPut: 5).
newTree := mm asTilesIn: Object globalNames: false.
newRec := newTree receiverNode.
newArgs := newTree argumentNodes.
ctrY := self fullBoundsInWorld center y.
top := self messageNode.
newRec owner replaceSubmorph: newRec by: top receiverNode.
oldArgNodes := top argumentNodes.
share := newArgs size min: oldArgNodes size.
(newArgs first: share) with: (oldArgNodes first: share) do: [:newNode :oldNode |
newNode owner replaceSubmorph: newNode by: oldNode].
"later get nodes for objects of the right type for new extra args"
top owner replaceSubmorph: top by: newTree.
"Deposit extra args in the World"
(oldArgNodes copyFrom: share+1 to: oldArgNodes size) do: [:leftOver |
(leftOver parseNode class == LiteralNode and: [leftOver decompile asString = '5'])
ifFalse: [newTree pasteUpMorph addMorphFront: leftOver.
leftOver position: newTree enclosingPane fullBoundsInWorld right - 20 @ ctrY.
ctrY := ctrY + 26]
ifTrue: [leftOver delete]].
newTree acceptIfInScriptor.!
Item was changed:
----- Method: SyntaxMorph>>replaceSel:menuItem: (in category 'pop ups') -----
replaceSel: evt menuItem: stringMorph
"I rep a SelectorNode. Replace my selector with new one that was just chosen from a menu"
| menu new old newSel ms oa na case news |
(menu := stringMorph owner owner) class == RectangleMorph ifTrue: [
menu delete].
new := stringMorph contents.
new first = $( ifTrue: [^ self]. "Cancel"
new first = $ ifTrue: [^ self]. "nothing"
news := String streamContents: [:strm | "remove fake args"
+ (new findBetweenSubStrs: {' 5'. Character space.}) do: [:part | strm nextPutAll: part]].
- (new findBetweenSubStrs: #(' 5' $ )) do: [:part | strm nextPutAll: part]].
newSel := stringMorph valueOfProperty: #syntacticallyCorrectContents.
newSel ifNil: [newSel := news].
old := (ms := self findA: StringMorph) valueOfProperty: #syntacticallyCorrectContents.
old ifNil: [old := (self findA: StringMorph) contents].
oa := old numArgs. na := newSel numArgs. case := 5.
(oa = 1) & (na = 1) ifTrue: [case := 1].
(oa = 0) & (na = 0) ifTrue: [case := 2].
(oa = 1) & (na = 0) ifTrue: [case := 3].
(oa = 0) & (na = 1) ifTrue: [case := 4].
case <= 4 ifTrue: ["replace the selector"
ms contents: news. "not multi-part"
ms setProperty: #syntacticallyCorrectContents toValue: newSel].
case = 3 ifTrue: [owner tossOutArg: 1].
case = 4 ifTrue: [self addArg: 1].
"more cases here. Rebuild the entire MessageNode"
self acceptIfInScriptor.!
Levente Uzonyi uploaded a new version of Files to project The Trunk:
http://source.squeak.org/trunk/Files-ul.97.mcz
==================== Summary ====================
Name: Files-ul.97
Author: ul
Time: 24 January 2011, 3:59:59.143 am
UUID: 6f9985b2-9bce-a145-a3d2-276a76ce1fa7
Ancestors: Files-ul.96
- removed previous stdio support code from StandardFileStream, migration is done in the preamble
=============== Diff against Files-ul.96 ===============
Item was added:
+ (PackageInfo named: 'Files') preamble: '"Migrate stdio handles and files from StandardFileStream to FileStream. Turn off encoding and reuse the streams if they are in use in the image for backwards compatibility."
+ (StandardFileStream classPool at: #StdioHandles) ifNotNil: [ :handleArray |
+ FileStream classPool at: #TheStdioHandles put: handleArray ].
+ (StandardFileStream instVarNamed: #stdioFiles) ifNotNil: [ :stdioFiles |
+ FileStream classPool
+ at: #StdioFiles put: stdioFiles;
+ at: #EncodeAndDecodeStdioFiles put: false ].
+ Smalltalk
+ removeFromStartUpList: StandardFileStream;
+ removeFromShutDownList: StandardFileStream'!
Item was changed:
FileStream subclass: #StandardFileStream
instanceVariableNames: 'name fileID buffer1'
+ classVariableNames: 'Registry'
- classVariableNames: 'Registry StdioHandles'
poolDictionaries: ''
category: 'Files-Kernel'!
- StandardFileStream class
- instanceVariableNames: 'stdioFiles'!
!StandardFileStream commentStamp: 'ul 12/6/2009 05:13' prior: 0!
Provides a simple, platform-independent, interface to a file system. The instance variable rwmode, inherited from class PositionableStream, here is used to hold a Boolean -- true means opened for read-write, false means opened for read-only. 2/12/96 sw
I implement a simple read buffering scheme with the variables defined in PositionableStream (which are unused in me otherwise) in the following way:
collection <ByteString> or <ByteArray> This is the buffer.
position <Integer> The relative position in the buffer. Greater or equal to zero.
readLimit <Integer> The number of bytes buffered. Greater or equal to zero.
Read buffering is enabled with #enableReadBuffering, disabled with #disableReadBuffering and it is enabled by default. The buffer is filled when a read attempt of an unbuffered absolute position is requested, or when a negative repositioning is made (with #position: with an argument < than the current absolute position) to an absolute position which is not buffered. In the first case, the buffer is positioned to the given absolute position. In the latter case the repositioning is made to the requested absolute position minus fourth of the buffer size. This means that further small negative repositionings won't result in buffer flushing. This is really useful when filing in code.
The read buffer is flushed (#flushReadBuffer) whenever a write attempt is made.
The buffer state is valid if and only if collection is not nil and position < readLimit.!
- StandardFileStream class
- instanceVariableNames: 'stdioFiles'!
Item was removed:
- ----- Method: StandardFileStream class>>flushAndVoidStdioFiles (in category 'class initialization') -----
- flushAndVoidStdioFiles
- stdioFiles ifNotNil:
- [stdioFiles do:
- [:f| f ifNotNil: [f isReadOnly ifFalse: [[f flush] on: Error do: [:ex|"care less"]]]].
- stdioFiles := nil]!
Item was removed:
- ----- Method: StandardFileStream class>>initialize (in category 'class initialization') -----
- initialize
- "StandardFileStream initialize"
- StdioHandles := Array new: 3.
- Smalltalk
- addToStartUpList: self after: SecurityManager; "the intent being before: AutoStart"
- addToShutDownList: self after: SecurityManager!
Item was removed:
- ----- Method: StandardFileStream class>>newForStdio (in category 'private-file creation') -----
- newForStdio
- "Circumvent CrLfFileStream new's returning an instance of MultiBteFileStream"
- ^self new!
Item was removed:
- ----- Method: StandardFileStream class>>shutDown: (in category 'class initialization') -----
- shutDown: quitting
- quitting ifTrue:
- [self withAllSubclassesDo:
- [:fileStreamClass| fileStreamClass flushAndVoidStdioFiles]]!
Item was removed:
- ----- Method: StandardFileStream class>>standardIOStreamNamed:forWrite: (in category 'private-file creation') -----
- standardIOStreamNamed: moniker forWrite: forWrite
-
- | index |
- index := #(stdin stdout stderr) identityIndexOf: moniker.
- ^((stdioFiles ifNil: [ stdioFiles := Array new: 3 ]) at: index)
- ifNil: [
- stdioFiles
- at: index
- put: (
- (StdioHandles at: index)
- ifNil: [ ^self error: moniker, ' is unavailable' ]
- ifNotNil: [ :handle|
- self newForStdio
- openOnHandle: handle
- name: moniker
- forWrite: forWrite ]) ]!
Item was removed:
- ----- Method: StandardFileStream class>>startUp: (in category 'class initialization') -----
- startUp: resuming
- (resuming and: [self == StandardFileStream]) ifTrue:
- [self withAllSubclassesDo:
- [:fileStreamClass| fileStreamClass voidStdioFiles].
- [StdioHandles := self stdioHandles]
- on: Error
- do: [:ex|
- StdioHandles isArray ifFalse:
- [StdioHandles := Array new: 3]]]!
Item was removed:
- ----- Method: StandardFileStream class>>stderr (in category 'file creation') -----
- stderr
- ^self standardIOStreamNamed: #stderr forWrite: true!
Item was removed:
- ----- Method: StandardFileStream class>>stdin (in category 'file creation') -----
- stdin
- ^self standardIOStreamNamed: #stdin forWrite: false!
Item was removed:
- ----- Method: StandardFileStream class>>stdioHandles (in category 'private-file creation') -----
- stdioHandles
- <primitive: 'primitiveFileStdioHandles' module: 'FilePlugin' error: ec>
- self primitiveFailed!
Item was removed:
- ----- Method: StandardFileStream class>>stdout (in category 'file creation') -----
- stdout
- ^self standardIOStreamNamed: #stdout forWrite: true!
Item was removed:
- ----- Method: StandardFileStream class>>voidStdioFiles (in category 'class initialization') -----
- voidStdioFiles
- stdioFiles := nil!