[squeak-dev] The Inbox: Morphic-ct.1790.mcz
commits at source.squeak.org
commits at source.squeak.org
Mon Nov 1 17:18:45 UTC 2021
A new version of Morphic was added to project The Inbox:
http://source.squeak.org/inbox/Morphic-ct.1790.mcz
==================== Summary ====================
Name: Morphic-ct.1790
Author: ct
Time: 1 November 2021, 6:18:39.271014 pm
UUID: d7f1d632-e952-e44a-a817-587501e5c542
Ancestors: Morphic-eem.1784
Proposal: Add syntax for submenus to MenuMorph >> #addList: by specifying a 1-ary selector. Also fixes typos in the comment.
=============== Diff against Morphic-eem.1784 ===============
Item was changed:
----- Method: MenuMorph>>addList: (in category 'construction') -----
addList: aList
+ "Add the given items to this menu, where each item is a pair (<string> <actionSelector | menuSelector:>). If an element of the list is simply the symbol #-, add a line to the receiver. The optional third element of each entry, if present, provides balloon help."
- "Add the given items to this menu, where each item is a pair (<string> <actionSelector>).. If an element of the list is simply the symobl $-, add a line to the receiver. The optional third element of each entry, if present, provides balloon help."
aList do: [:tuple |
(tuple == #-)
ifTrue: [self addLine]
ifFalse:
+ [tuple second isUnary
+ ifTrue: [self add: tuple first action: tuple second]
+ ifFalse:
+ [self addItem: [:item |
+ item
+ target: self defaultTarget;
+ contents: tuple first;
+ subMenuUpdater: [:menu |
+ menu defaultTarget: self defaultTarget.
+ self defaultTarget perform: tuple second with: menu]
+ selector: #value:]]].
- [self add: tuple first action: tuple second.
tuple size > 2 ifTrue:
+ [self balloonTextForLastItem: tuple third]].!
- [self balloonTextForLastItem: tuple third]]]!
Item was changed:
----- Method: MenuMorph>>addTranslatedList: (in category 'construction') -----
addTranslatedList: aList
+ "Add the given items to this menu, where each item is a pair (<string> <actionSelector | menuSelector:>). If an element of the list is simply the symbol #-, add a line to the receiver. The optional third element of each entry, if present, provides balloon help.
+ All strings will be translated."
- "Add the given items to this menu, where each item is a pair (<string> <actionSelector>).. If an element of the list is simply the symobl $-, add a line to the receiver. The optional third element of each entry, if present, provides balloon help.
- The first and third items will be translated."
+ ^ self addList: (aList collect: [:tuple |
+ tuple == #-
+ ifTrue: [tuple]
- aList do: [:tuple |
- (tuple == #-)
- ifTrue: [self addLine]
ifFalse:
+ [Array new: tuple size streamContents: [:stream |
+ stream nextPut: tuple first translated.
+ tuple size >= 2
+ ifTrue: [stream nextPut: tuple second].
+ tuple size >= 3
+ ifTrue:
+ [stream nextPut:
+ (tuple third isString
+ ifTrue: [tuple third translated]
+ ifFalse: [tuple third])]]]])!
- [self add: tuple first translated action: tuple second.
- tuple size > 2 ifTrue:
- [self balloonTextForLastItem: tuple third translated ]]]!
More information about the Squeak-dev
mailing list
|