David T. Lewis uploaded a new version of ToolBuilder-Morphic to project The Trunk:
http://source.squeak.org/trunk/ToolBuilder-Morphic-dtl.81.mcz
==================== Summary ====================
Name: ToolBuilder-Morphic-dtl.81
Author: dtl
Time: 28 September 2011, 7:45:59.81 pm
UUID: fabb7fd0-be16-4540-a80e-6234dfc664b0
Ancestors: ToolBuilder-Morphic-ul.79
Provide updating button for "what to show" button on CodeHolder, similar to Squeak 3.8 behavior. This button activates a menu, and displays the resulting menu selection. For the default look, normal buttons are rounded and the menu activation button is square (vice versa if the "Rounded Button Corners" preference is disabled). When menu selection is changed, the button label displays the selected mode ('source', 'decompile', 'bytecodes' etc).
Changes are in four packages.
ToolBuilder-Kernel:
- Add PluggableButtonSpec>>style to provide style hint. Used to suggest that a button should be rendered differently, in this case rounded versus square corners.
- Add changeLableWhen: to connect pluggable button with change notification, in this case to allow update: #contents to result in a label update in the dependent button.
ToolBuilder-Morphic:
- Add #whenChanged:update: as a mechanism for hooking change events to button updates, allowing an individual button to respond to e.g. self changed: #contents in the model.
- Update MorphicToolBuilder>>buildPluggableButton to make use of style and changeLabelWhen in the widget spec.
Tools:
- Update CodeHolder>>buildCodeProvenanceButtonWith: to add style hint for round/ square corners and changeLableWhen: for change notification to the widget spec.
Note: ToolBuilder has PluggableDropDownListSpec which is presumably intended to describe a drop-down list widget. This is currently unused in the image, but in future might provide a better approach than the current action button with menu approach.
Morphic:
- Let style hint control rounded versus square corners for a PluggableButtonMorph. May be used as a visual cue to distinguish simple action buttons from buttons that invoke a selection menu (e.g. "what to show" button for a CodeHolder).
- Instance var #style was added to PluggableButtonMorph, so must also update #veryDeepInner: to match (problem detected by DeepCopier>>checkClass: called from ChangeSet>>fileOutClassDefinition:on:).
=============== Diff against ToolBuilder-Morphic-ul.79 ===============
Item was changed:
----- Method: MorphicToolBuilder>>buildPluggableButton: (in category 'pluggable widgets') -----
buildPluggableButton: aSpec
| widget label state action enabled |
label := aSpec label.
state := aSpec state.
action := aSpec action.
widget := self buttonClass on: aSpec model
getState: (state isSymbol ifTrue:[state])
action: nil
label: (label isSymbol ifTrue:[label]).
+ widget style: aSpec style.
+ aSpec changeLabelWhen
+ ifNotNilDo: [ :event | widget whenChanged: event update: aSpec label].
self register: widget id: aSpec name.
enabled := aSpec enabled.
enabled isSymbol
ifTrue:[widget getEnabledSelector: enabled]
ifFalse:[widget enabled:enabled].
widget action: action.
widget getColorSelector: aSpec color.
widget offColor: Color white..
self buildHelpFor: widget spec: aSpec.
(label isSymbol or:[label == nil]) ifFalse:[widget label: label].
self setFrame: aSpec frame in: widget.
parent ifNotNil:[self add: widget to: parent].
^widget!
Item was changed:
PluggableButtonMorph subclass: #PluggableButtonMorphPlus
+ instanceVariableNames: 'enabled action getColorSelector getEnabledSelector updateMap'
- instanceVariableNames: 'enabled action getColorSelector getEnabledSelector'
classVariableNames: ''
poolDictionaries: ''
category: 'ToolBuilder-Morphic'!
!PluggableButtonMorphPlus commentStamp: 'ar 2/11/2005 21:53' prior: 0!
An extended version of PluggableButtonMorph supporting enablement, color and block/message actions.!
Item was changed:
----- Method: PluggableButtonMorphPlus>>update: (in category 'updating') -----
update: what
what ifNil:[^self].
what == getLabelSelector ifTrue: [
self label: (model perform: getLabelSelector)].
what == getEnabledSelector ifTrue:[^self enabled: (model perform: getEnabledSelector)].
getColorSelector ifNotNil: [ | cc |
color = (cc := model perform: getColorSelector) ifFalse:[
color := cc.
self onColor: color offColor: color.
self changed.
].
].
self getModelState
ifTrue: [self color: onColor]
ifFalse: [self color: offColor].
getEnabledSelector ifNotNil:[
self enabled: (model perform: getEnabledSelector).
].
+ updateMap ifNotNil:
+ [(updateMap at: what ifAbsent: [])
+ ifNotNilDo: [ :newTarget | ^self update: newTarget]].
!
Item was added:
+ ----- Method: PluggableButtonMorphPlus>>updateMap (in category 'updating') -----
+ updateMap
+ ^ updateMap ifNil: [updateMap := Dictionary new]
+ !
Item was added:
+ ----- Method: PluggableButtonMorphPlus>>whenChanged:update: (in category 'updating') -----
+ whenChanged: notification update: target
+ "On receipt of a notification, such as #contents notification from a CodeHolder,
+ invoke an update as if target had been the original notification."
+
+ self updateMap at: notification put: target!
Eliot Miranda uploaded a new version of Compiler to project The Trunk:
http://source.squeak.org/trunk/Compiler-eem.217.mcz
==================== Summary ====================
Name: Compiler-eem.217
Author: eem
Time: 27 September 2011, 3:51:31.614 pm
UUID: 4b06bdff-bc34-4a41-b59d-8de0dc9bf16c
Ancestors: Compiler-eem.216
Add MethodNode>>ensureNotQuick to allow forcing generating
non-quick versions of quick methods (^self, ^inst var, et al).
This is used by MwbreakpointWrapper.
Yes this could arguably be a set of extensions in
MethodWrappers, but it feels too intimate for that, and
other compilers may want to implement the same API.
=============== Diff against Compiler-eem.216 ===============
Item was added:
+ ----- Method: BlockNode>>ensureNotQuick: (in category 'converting') -----
+ ensureNotQuick: encoder
+ "If the receiver is quick (can be generated as a Quick method, ^self,^inst var or ^ special constant)
+ make it not so. This is used to create break-pointable versions of quick methods. Answer if the
+ receiver was quick."
+ self isQuick ifFalse:
+ [^false].
+ "Making statements size > 1 is sufficient to cause isQuick to answer false (see BlockNode>>isQuick).
+ N.B. This is a no-op since statements generate via emitCodeForEffect: and VariableNodes have no effect."
+ statements addFirst: (encoder encodeVariable: 'self').
+ ^true!
Item was added:
+ ----- Method: MethodNode>>ensureNotQuick (in category 'converting') -----
+ ensureNotQuick
+ "If the receiver is quick (can be generated as a Quick method, ^self,^inst var or ^ special constant)
+ make it not so. This is used to create break-pointable versions of quick methods. Answer if the
+ receiver was quick."
+ ^block ensureNotQuick: encoder!
Eliot Miranda uploaded a new version of Compiler to project The Trunk:
http://source.squeak.org/trunk/Compiler-eem.217.mcz
==================== Summary ====================
Name: Compiler-eem.217
Author: eem
Time: 27 September 2011, 3:51:31.614 pm
UUID: 4b06bdff-bc34-4a41-b59d-8de0dc9bf16c
Ancestors: Compiler-eem.216
Add MethodNode>>ensureNotQuick to allow forcing generating
non-quick versions of quick methods (^self, ^inst var, et al).
This is used by MwbreakpointWrapper.
Yes this could arguably be a set of extensions in
MethodWrappers, but it feels too intimate for that, and
other compilers may want to implement the same API.
=============== Diff against Compiler-eem.216 ===============
Item was added:
+ ----- Method: BlockNode>>ensureNotQuick: (in category 'converting') -----
+ ensureNotQuick: encoder
+ "If the receiver is quick (can be generated as a Quick method, ^self,^inst var or ^ special constant)
+ make it not so. This is used to create break-pointable versions of quick methods. Answer if the
+ receiver was quick."
+ self isQuick ifFalse:
+ [^false].
+ "Making statements size > 1 is sufficient to cause isQuick to answer false (see BlockNode>>isQuick).
+ N.B. This is a no-op since statements generate via emitCodeForEffect: and VariableNodes have no effect."
+ statements addFirst: (encoder encodeVariable: 'self').
+ ^true!
Item was added:
+ ----- Method: MethodNode>>ensureNotQuick (in category 'converting') -----
+ ensureNotQuick
+ "If the receiver is quick (can be generated as a Quick method, ^self,^inst var or ^ special constant)
+ make it not so. This is used to create break-pointable versions of quick methods. Answer if the
+ receiver was quick."
+ ^block ensureNotQuick: encoder!
Eliot Miranda uploaded a new version of Compiler to project The Trunk:
http://source.squeak.org/trunk/Compiler-eem.217.mcz
==================== Summary ====================
Name: Compiler-eem.217
Author: eem
Time: 27 September 2011, 3:51:31.614 pm
UUID: 4b06bdff-bc34-4a41-b59d-8de0dc9bf16c
Ancestors: Compiler-eem.216
Add MethodNode>>ensureNotQuick to allow forcing generating
non-quick versions of quick methods (^self, ^inst var, et al).
This is used by MwbreakpointWrapper.
Yes this could arguably be a set of extensions in
MethodWrappers, but it feels too intimate for that, and
other compilers may want to implement the same API.
=============== Diff against Compiler-eem.216 ===============
Item was added:
+ ----- Method: BlockNode>>ensureNotQuick: (in category 'converting') -----
+ ensureNotQuick: encoder
+ "If the receiver is quick (can be generated as a Quick method, ^self,^inst var or ^ special constant)
+ make it not so. This is used to create break-pointable versions of quick methods. Answer if the
+ receiver was quick."
+ self isQuick ifFalse:
+ [^false].
+ "Making statements size > 1 is sufficient to cause isQuick to answer false (see BlockNode>>isQuick).
+ N.B. This is a no-op since statements generate via emitCodeForEffect: and VariableNodes have no effect."
+ statements addFirst: (encoder encodeVariable: 'self').
+ ^true!
Item was added:
+ ----- Method: MethodNode>>ensureNotQuick (in category 'converting') -----
+ ensureNotQuick
+ "If the receiver is quick (can be generated as a Quick method, ^self,^inst var or ^ special constant)
+ make it not so. This is used to create break-pointable versions of quick methods. Answer if the
+ receiver was quick."
+ ^block ensureNotQuick: encoder!
Levente Uzonyi uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-ul.631.mcz
==================== Summary ====================
Name: Kernel-ul.631
Author: ul
Time: 27 September 2011, 6:47:40.645 pm
UUID: 7793f80d-42dc-2a45-afc1-67ce003aba45
Ancestors: Kernel-eem.630, Kernel-ul.630
Merged.
=============== Diff against Kernel-eem.630 ===============
Item was changed:
----- Method: MethodDictionary class>>new (in category 'instance creation') -----
new
+ "Create a new instance with 32 slots, which can hold at most 24 methods before growing is necessary."
- "Create a new instance with 32 slots. See the comment of #sizeFor: why the argument is 16."
+ ^self newForCapacity: 32!
- ^self new: 16!
Item was changed:
----- Method: MethodDictionary class>>new: (in category 'instance creation') -----
new: numberOfElements
+ "Create an instance large enough to hold numberOfElements methods without growing."
- "Create an instance large enough to hold numberOfElements without growing. Note that the basic size must be a power of 2. It is VITAL (see grow) that size gets doubled if numberOfElements is a power of 2"
+ ^self newForCapacity: (self sizeFor: numberOfElements)!
- | size |
- size := self sizeFor: numberOfElements.
- ^(self basicNew: size) initialize: size!
Item was added:
+ ----- Method: MethodDictionary class>>newForCapacity: (in category 'private') -----
+ newForCapacity: capacity
+ "Create an instance with the given capacity which must be a power of two."
+
+ ^(self basicNew: capacity) initialize: capacity!
Item was changed:
----- Method: MethodDictionary class>>sizeFor: (in category 'sizing') -----
sizeFor: numberOfElements
"Return the minimum capacity of a dictionary that can hold numberOfElements elements. At least 25% of the array must be empty and the return value must be a power of 2."
+ ^(numberOfElements * 4 // 3) asLargerPowerOfTwo!
- ^1 bitShift: (numberOfElements * 4 // 3) highBit!
Item was changed:
----- Method: MethodDictionary>>grow (in category 'private') -----
grow
| newSelf |
+ newSelf := self species newForCapacity: self basicSize * 2.
- newSelf := self species new: self basicSize. "This will double the size"
1 to: self basicSize do: [ :i |
(self basicAt: i) ifNotNil: [ :key |
newSelf at: key put: (array at: i) ] ].
self become: newSelf!
Item was changed:
----- Method: MethodDictionary>>rehash (in category 'private') -----
rehash
| newInstance |
+ newInstance := self species newForCapacity: self basicSize.
- newInstance := self species new: self basicSize - 1. "Make sure it has the same capacity"
1 to: self basicSize do: [ :index |
(self basicAt: index) ifNotNil: [ :key |
newInstance at: key put: (array at: index) ] ].
self copyFrom: newInstance!
Item was changed:
----- Method: MethodDictionary>>removeAll (in category 'removing') -----
removeAll
+ "Remove all elements from this collection. Preserve the capacity"
- "This provides a faster way than repeated become.
- a single become is still in use to prevent system crash."
| newSelf |
tally = 0 ifTrue: [^self].
+ newSelf := self species newForCapacity: self basicSize.
- newSelf := self species new: self basicSize - 1. "This will preserve the capacity"
self copyFrom: newSelf!
Levente Uzonyi uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-ul.631.mcz
==================== Summary ====================
Name: Kernel-ul.631
Author: ul
Time: 27 September 2011, 6:47:40.645 pm
UUID: 7793f80d-42dc-2a45-afc1-67ce003aba45
Ancestors: Kernel-eem.630, Kernel-ul.630
Merged.
=============== Diff against Kernel-eem.630 ===============
Item was changed:
----- Method: MethodDictionary class>>new (in category 'instance creation') -----
new
+ "Create a new instance with 32 slots, which can hold at most 24 methods before growing is necessary."
- "Create a new instance with 32 slots. See the comment of #sizeFor: why the argument is 16."
+ ^self newForCapacity: 32!
- ^self new: 16!
Item was changed:
----- Method: MethodDictionary class>>new: (in category 'instance creation') -----
new: numberOfElements
+ "Create an instance large enough to hold numberOfElements methods without growing."
- "Create an instance large enough to hold numberOfElements without growing. Note that the basic size must be a power of 2. It is VITAL (see grow) that size gets doubled if numberOfElements is a power of 2"
+ ^self newForCapacity: (self sizeFor: numberOfElements)!
- | size |
- size := self sizeFor: numberOfElements.
- ^(self basicNew: size) initialize: size!
Item was added:
+ ----- Method: MethodDictionary class>>newForCapacity: (in category 'private') -----
+ newForCapacity: capacity
+ "Create an instance with the given capacity which must be a power of two."
+
+ ^(self basicNew: capacity) initialize: capacity!
Item was changed:
----- Method: MethodDictionary class>>sizeFor: (in category 'sizing') -----
sizeFor: numberOfElements
"Return the minimum capacity of a dictionary that can hold numberOfElements elements. At least 25% of the array must be empty and the return value must be a power of 2."
+ ^(numberOfElements * 4 // 3) asLargerPowerOfTwo!
- ^1 bitShift: (numberOfElements * 4 // 3) highBit!
Item was changed:
----- Method: MethodDictionary>>grow (in category 'private') -----
grow
| newSelf |
+ newSelf := self species newForCapacity: self basicSize * 2.
- newSelf := self species new: self basicSize. "This will double the size"
1 to: self basicSize do: [ :i |
(self basicAt: i) ifNotNil: [ :key |
newSelf at: key put: (array at: i) ] ].
self become: newSelf!
Item was changed:
----- Method: MethodDictionary>>rehash (in category 'private') -----
rehash
| newInstance |
+ newInstance := self species newForCapacity: self basicSize.
- newInstance := self species new: self basicSize - 1. "Make sure it has the same capacity"
1 to: self basicSize do: [ :index |
(self basicAt: index) ifNotNil: [ :key |
newInstance at: key put: (array at: index) ] ].
self copyFrom: newInstance!
Item was changed:
----- Method: MethodDictionary>>removeAll (in category 'removing') -----
removeAll
+ "Remove all elements from this collection. Preserve the capacity"
- "This provides a faster way than repeated become.
- a single become is still in use to prevent system crash."
| newSelf |
tally = 0 ifTrue: [^self].
+ newSelf := self species newForCapacity: self basicSize.
- newSelf := self species new: self basicSize - 1. "This will preserve the capacity"
self copyFrom: newSelf!
Levente Uzonyi uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-ul.631.mcz
==================== Summary ====================
Name: Kernel-ul.631
Author: ul
Time: 27 September 2011, 6:47:40.645 pm
UUID: 7793f80d-42dc-2a45-afc1-67ce003aba45
Ancestors: Kernel-eem.630, Kernel-ul.630
Merged.
=============== Diff against Kernel-eem.630 ===============
Item was changed:
----- Method: MethodDictionary class>>new (in category 'instance creation') -----
new
+ "Create a new instance with 32 slots, which can hold at most 24 methods before growing is necessary."
- "Create a new instance with 32 slots. See the comment of #sizeFor: why the argument is 16."
+ ^self newForCapacity: 32!
- ^self new: 16!
Item was changed:
----- Method: MethodDictionary class>>new: (in category 'instance creation') -----
new: numberOfElements
+ "Create an instance large enough to hold numberOfElements methods without growing."
- "Create an instance large enough to hold numberOfElements without growing. Note that the basic size must be a power of 2. It is VITAL (see grow) that size gets doubled if numberOfElements is a power of 2"
+ ^self newForCapacity: (self sizeFor: numberOfElements)!
- | size |
- size := self sizeFor: numberOfElements.
- ^(self basicNew: size) initialize: size!
Item was added:
+ ----- Method: MethodDictionary class>>newForCapacity: (in category 'private') -----
+ newForCapacity: capacity
+ "Create an instance with the given capacity which must be a power of two."
+
+ ^(self basicNew: capacity) initialize: capacity!
Item was changed:
----- Method: MethodDictionary class>>sizeFor: (in category 'sizing') -----
sizeFor: numberOfElements
"Return the minimum capacity of a dictionary that can hold numberOfElements elements. At least 25% of the array must be empty and the return value must be a power of 2."
+ ^(numberOfElements * 4 // 3) asLargerPowerOfTwo!
- ^1 bitShift: (numberOfElements * 4 // 3) highBit!
Item was changed:
----- Method: MethodDictionary>>grow (in category 'private') -----
grow
| newSelf |
+ newSelf := self species newForCapacity: self basicSize * 2.
- newSelf := self species new: self basicSize. "This will double the size"
1 to: self basicSize do: [ :i |
(self basicAt: i) ifNotNil: [ :key |
newSelf at: key put: (array at: i) ] ].
self become: newSelf!
Item was changed:
----- Method: MethodDictionary>>rehash (in category 'private') -----
rehash
| newInstance |
+ newInstance := self species newForCapacity: self basicSize.
- newInstance := self species new: self basicSize - 1. "Make sure it has the same capacity"
1 to: self basicSize do: [ :index |
(self basicAt: index) ifNotNil: [ :key |
newInstance at: key put: (array at: index) ] ].
self copyFrom: newInstance!
Item was changed:
----- Method: MethodDictionary>>removeAll (in category 'removing') -----
removeAll
+ "Remove all elements from this collection. Preserve the capacity"
- "This provides a faster way than repeated become.
- a single become is still in use to prevent system crash."
| newSelf |
tally = 0 ifTrue: [^self].
+ newSelf := self species newForCapacity: self basicSize.
- newSelf := self species new: self basicSize - 1. "This will preserve the capacity"
self copyFrom: newSelf!