Skip to content

Commit

Permalink
DividerMenuItem using some magic numbers instead of symbolic constants
Browse files Browse the repository at this point in the history
  • Loading branch information
blairmcg committed Dec 20, 2023
1 parent 65c81bc commit afb912e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Core/Object Arts/Dolphin/MVP/Base/Dolphin MVP Base.pax
Original file line number Diff line number Diff line change
Expand Up @@ -1738,7 +1738,7 @@ UI.MenuItem
classInstanceVariableNames: ''
classConstants: {
'DividerLookup'
-> (LookupTable withAll: { 16r20 -> #barBreak. 16r40 -> #break. 16r800 -> #separator })
-> (IdentityDictionary withAll: { 16r20 -> #barBreak. 16r40 -> #break. 16r800 -> #separator })
}!
UI.Presenter
subclass: #'UI.SelectableItemsPresenter'
Expand Down
13 changes: 10 additions & 3 deletions Core/Object Arts/Dolphin/MVP/Base/UI.DividerMenuItem.cls
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ UI.MenuItem
classInstanceVariableNames: ''
classConstants: {
'DividerLookup'
-> (LookupTable withAll: { 16r20 -> #barBreak. 16r40 -> #break. 16r800 -> #separator })
-> (IdentityDictionary withAll: { 16r20 -> #barBreak. 16r40 -> #break. 16r800 -> #separator })
}!
UI.DividerMenuItem guid: (Core.GUID fromString: '{87b4c661-026e-11d3-9fd7-00a0cc3e4a32}')!
UI.DividerMenuItem comment: 'DividerMenuItem represents a divider that can be placed between other items in a <Menu>. Separate singleton instances for the various styles are held in class variables and answered by the #separator, #break and #barBreak [instance creation] methods.
Expand Down Expand Up @@ -49,8 +49,9 @@ displayOn: aPuttableStream
"Append to the <puttableStream> first argument a String whose characters are a representation of the receiver that an end-user might want to see."

aPuttableStream
nextPutAll: (##(IdentityDictionary withAll: { 16r20 -> '||'. 16r40 -> '|'. 16r800 -> '-' })
at: self styleFlags)!
nextPutAll: (##(IdentityDictionary
withAll: { MFT_MENUBARBREAK -> '||'. MFT_MENUBREAK -> '|'. MFT_SEPARATOR -> '-' })
at: self styleFlags)!

id
"Answers the menu item identifier for the receiver"
Expand Down Expand Up @@ -136,6 +137,11 @@ break

^Break ifNil: [Break := self dividers at: '|']!

initialize
self addClassConstant: 'DividerLookup'
value: (IdentityDictionary
withAll: { MFT_MENUBARBREAK -> #barBreak. MFT_MENUBREAK -> #break. MFT_SEPARATOR -> #separator })!

new
"Answers an instance of the receiver"

Expand Down Expand Up @@ -175,6 +181,7 @@ uninitialize
!UI.DividerMenuItem class categoriesForMethods!
barBreak!instance creation!public! !
break!instance creation!public! !
initialize!class initialization!private! !
new!instance creation!public! !
onPreStripImage!class hierarchy-removing!private! !
separator!instance creation!public! !
Expand Down

0 comments on commit afb912e

Please sign in to comment.