From afb912ee95e22c52d378de481ce9ba28f3e5f27a Mon Sep 17 00:00:00 2001 From: Blair McGlashan Date: Fri, 27 Oct 2023 15:11:47 +0100 Subject: [PATCH] DividerMenuItem using some magic numbers instead of symbolic constants --- .../Dolphin/MVP/Base/Dolphin MVP Base.pax | 2 +- .../Dolphin/MVP/Base/UI.DividerMenuItem.cls | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Core/Object Arts/Dolphin/MVP/Base/Dolphin MVP Base.pax b/Core/Object Arts/Dolphin/MVP/Base/Dolphin MVP Base.pax index b4c1e7a5dd..d1b216b5ae 100644 --- a/Core/Object Arts/Dolphin/MVP/Base/Dolphin MVP Base.pax +++ b/Core/Object Arts/Dolphin/MVP/Base/Dolphin MVP Base.pax @@ -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' diff --git a/Core/Object Arts/Dolphin/MVP/Base/UI.DividerMenuItem.cls b/Core/Object Arts/Dolphin/MVP/Base/UI.DividerMenuItem.cls index 33453bd446..93c165e15f 100644 --- a/Core/Object Arts/Dolphin/MVP/Base/UI.DividerMenuItem.cls +++ b/Core/Object Arts/Dolphin/MVP/Base/UI.DividerMenuItem.cls @@ -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 . Separate singleton instances for the various styles are held in class variables and answered by the #separator, #break and #barBreak [instance creation] methods. @@ -49,8 +49,9 @@ displayOn: aPuttableStream "Append to the 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" @@ -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" @@ -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! !