From 40edd3ef502e35af14eabc8848037eea0d1a0b5f Mon Sep 17 00:00:00 2001 From: Kira Weinlein Date: Mon, 8 Feb 2021 18:52:14 +0100 Subject: [PATCH 01/31] Radial menu does only disappear if mouse clicks outside it --- .squot | 6 +++--- .../RadialMenuMorph.class/instance/privateRegisterItem..st | 2 +- .../RadialMenuMorph.class/methodProperties.json | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.squot b/.squot index 4cc9c7c..7136a80 100644 --- a/.squot +++ b/.squot @@ -1,5 +1,5 @@ OrderedDictionary { - 'src\/ColorContextMenu-Core.package' : #SquotCypressCodeSerializer, - 'src\/ColorContextMenu-Tests.package' : #SquotCypressCodeSerializer, - 'src\/BaselineOfColorContextMenu.package' : #SquotCypressCodeSerializer + 'src/ColorContextMenu-Core.package' : #SquotCypressCodeSerializer, + 'src/ColorContextMenu-Tests.package' : #SquotCypressCodeSerializer, + 'src/BaselineOfColorContextMenu.package' : #SquotCypressCodeSerializer } \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/privateRegisterItem..st b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/privateRegisterItem..st index 258e3cb..b625485 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/privateRegisterItem..st +++ b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/privateRegisterItem..st @@ -1,4 +1,4 @@ private privateRegisterItem: aRadialMenuItemMorph - aRadialMenuItemMorph when: #invokeItem send: #delete to: self. \ No newline at end of file + self flag: 'discuss' "aRadialMenuItemMorph when: #invokeItem send: #delete to: self." \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/methodProperties.json b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/methodProperties.json index 60d4efe..27f6288 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/methodProperties.json +++ b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/methodProperties.json @@ -26,7 +26,7 @@ "popUpAt:forHand:in:" : "ct 2/7/2021 20:57", "popUpAt:forHand:in:allowKeyboard:" : "ct 2/7/2021 20:57", "popUpFor:" : "ct 2/6/2021 00:16", - "privateRegisterItem:" : "ct 2/7/2021 19:30", + "privateRegisterItem:" : "Kiwi 2/8/2021 18:14", "privateRemove:" : "ct 2/7/2021 19:31", "privateUnregisterItem:" : "ct 2/7/2021 19:30", "removeAllMorphs" : "ct 2/7/2021 19:31", From 1e2ac92d855c56d43fa703a4b523e4917ec4fbd5 Mon Sep 17 00:00:00 2001 From: Kira Weinlein Date: Mon, 8 Feb 2021 18:53:14 +0100 Subject: [PATCH 02/31] Add ArcRingMorph functions to set radius and get angle of center --- .../ArcRingMorph.class/instance/centerAngle.st | 6 ++++++ .../ArcRingMorph.class/instance/radius..st | 4 ++++ .../ArcRingMorph.class/methodProperties.json | 2 ++ 3 files changed, 12 insertions(+) create mode 100644 src/ColorContextMenu-Core.package/ArcRingMorph.class/instance/centerAngle.st create mode 100644 src/ColorContextMenu-Core.package/ArcRingMorph.class/instance/radius..st diff --git a/src/ColorContextMenu-Core.package/ArcRingMorph.class/instance/centerAngle.st b/src/ColorContextMenu-Core.package/ArcRingMorph.class/instance/centerAngle.st new file mode 100644 index 0000000..a1cbdb8 --- /dev/null +++ b/src/ColorContextMenu-Core.package/ArcRingMorph.class/instance/centerAngle.st @@ -0,0 +1,6 @@ +as yet unclassified +centerAngle + + ^ self stopAngle > self startAngle + ifTrue: [{self startAngle . self stopAngle} average] + ifFalse: [{self startAngle . self stopAngle + (Float pi * 2)} average] \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/ArcRingMorph.class/instance/radius..st b/src/ColorContextMenu-Core.package/ArcRingMorph.class/instance/radius..st new file mode 100644 index 0000000..283b602 --- /dev/null +++ b/src/ColorContextMenu-Core.package/ArcRingMorph.class/instance/radius..st @@ -0,0 +1,4 @@ +accessing +radius: aNumber + + self extent: self extent * (aNumber / self radius) \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/ArcRingMorph.class/methodProperties.json b/src/ColorContextMenu-Core.package/ArcRingMorph.class/methodProperties.json index 9c4e822..e8ecf5d 100644 --- a/src/ColorContextMenu-Core.package/ArcRingMorph.class/methodProperties.json +++ b/src/ColorContextMenu-Core.package/ArcRingMorph.class/methodProperties.json @@ -3,6 +3,7 @@ }, "instance" : { "borderCorrectionOffset" : "ct 2/7/2021 21:20", + "centerAngle" : "Kiwi 2/8/2021 18:28", "changed" : "ct 2/7/2021 19:16", "containsAngle:" : "ct 2/5/2021 19:45", "containsPoint:" : "ct 2/7/2021 19:14", @@ -23,6 +24,7 @@ "outerFraction:" : "ct 2/7/2021 19:40", "outerRadius" : "ct 1/31/2021 00:55", "radius" : "ct 1/31/2021 18:50", + "radius:" : "Kiwi 2/8/2021 18:32", "startAngle" : "ct 1/31/2021 00:32", "startAngle:" : "ct 2/7/2021 19:38", "startAngle:stopAngle:" : "ct 2/7/2021 19:59", From 898c60d0e867f3c4b95d559bc02807cb66e637ae Mon Sep 17 00:00:00 2001 From: Kira Weinlein Date: Mon, 8 Feb 2021 18:54:13 +0100 Subject: [PATCH 03/31] Draft for automatic creation of discrete radial top-level menu --- .../instance/contextMenu.st | 2 +- .../instance/discreteRadialMenu.st | 25 ++++++++++--------- .../instance/labelGroups.st | 4 +++ .../methodProperties.json | 5 ++-- 4 files changed, 21 insertions(+), 15 deletions(-) create mode 100644 src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/labelGroups.st diff --git a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/contextMenu.st b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/contextMenu.st index 6031951..4e2f96f 100644 --- a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/contextMenu.st +++ b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/contextMenu.st @@ -8,7 +8,7 @@ contextMenu add: 'random' action: #setRandom; addLine. - #((red green blue) (hue saturation lightness brightness) (cyan magenta yellow black) (alpha)) + self labelGroups do: [:group | group do: [:attrib | menu diff --git a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/discreteRadialMenu.st b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/discreteRadialMenu.st index 83ea2b5..3723657 100644 --- a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/discreteRadialMenu.st +++ b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/discreteRadialMenu.st @@ -5,16 +5,17 @@ discreteRadialMenu | menu | menu := RadialMenuMorph new. menu target: self. - menu addItemMorph: (RadialMenuItemMorph new - label: 'random'; - action: #setRandom; - yourself). - menu addItemMorph: (RadialMenuItemMorph new - label: 'lighter'; - action: [self setBrightness: self color brightness + 0.2]; - yourself). - menu addItemMorph: (RadialMenuItemMorph new - label: 'darker'; - action: [self setBrightness: self color brightness - 0.2]; - yourself). + + self labelGroups + do: [:group | + group do: [:attribute | + menu addItemMorph: (RadialMenuItemMorph new + label: attribute asString; + action: #setRandom; + yourself). + self flag: 'TODO: add action open submenu'. + ]. + menu addItemMorph: (RadialMenuItemMorph new beSplitter) + ]. + ^ menu \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/labelGroups.st b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/labelGroups.st new file mode 100644 index 0000000..6642cdd --- /dev/null +++ b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/labelGroups.st @@ -0,0 +1,4 @@ +menus +labelGroups + + ^ #((red green blue) (hue saturation lightness brightness) (cyan magenta yellow black) (alpha)) \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/methodProperties.json b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/methodProperties.json index f2c47ba..18c7bc1 100644 --- a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/methodProperties.json +++ b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/methodProperties.json @@ -3,13 +3,14 @@ }, "instance" : { "color:" : "ct 2/4/2021 15:37", - "contextMenu" : "ct 2/4/2021 20:49", + "contextMenu" : "Kiwi 2/8/2021 15:57", "contextMenuWithLevels:forAttrib:" : "ct 2/4/2021 20:26", "contextMenuWithLevelsForAttrib:" : "ct 2/4/2021 20:18", - "discreteRadialMenu" : "ct 2/7/2021 19:22", + "discreteRadialMenu" : "Kiwi 2/8/2021 18:50", "drawOn:" : "ct 2/4/2021 21:26", "handlesMouseDown:" : "ct 2/4/2021 21:10", "hatchForm" : "ct 2/4/2021 21:31", + "labelGroups" : "Kiwi 2/8/2021 15:57", "menuMode" : "ct 2/5/2021 23:54", "menuMode:" : "ct 2/5/2021 23:54", "newHatchForm" : "ct 2/4/2021 21:34", From d228b3aa43ae6199b747924a61967e596733b0da Mon Sep 17 00:00:00 2001 From: Kira Weinlein Date: Mon, 8 Feb 2021 18:55:12 +0100 Subject: [PATCH 04/31] Add optional splitter functionality to RAdialMenuItemMorph (should later be moved to subclass) --- .../instance/beNoSplitter.st | 4 ++++ .../RadialMenuItemMorph.class/instance/beSplitter.st | 6 ++++++ .../RadialMenuItemMorph.class/instance/isSplitter.st | 4 ++++ .../instance/privateInteractionState..st | 12 +++++++----- .../instance/splitterColor.st | 4 ++++ .../RadialMenuItemMorph.class/methodProperties.json | 6 +++++- .../RadialMenuItemMorph.class/properties.json | 3 ++- 7 files changed, 32 insertions(+), 7 deletions(-) create mode 100644 src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/beNoSplitter.st create mode 100644 src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/beSplitter.st create mode 100644 src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/isSplitter.st create mode 100644 src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/splitterColor.st diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/beNoSplitter.st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/beNoSplitter.st new file mode 100644 index 0000000..69c8d54 --- /dev/null +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/beNoSplitter.st @@ -0,0 +1,4 @@ +layout +beNoSplitter + + isSplitter := false \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/beSplitter.st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/beSplitter.st new file mode 100644 index 0000000..85762c1 --- /dev/null +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/beSplitter.st @@ -0,0 +1,6 @@ +layout +beSplitter + + isSplitter := true. + self color: self splitterColor. + self label: '' \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/isSplitter.st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/isSplitter.st new file mode 100644 index 0000000..04df0ee --- /dev/null +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/isSplitter.st @@ -0,0 +1,4 @@ +layout +isSplitter + + ^ isSplitter ifNil: [self beNoSplitter. ^ isSplitter] \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/privateInteractionState..st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/privateInteractionState..st index 0259038..3690a37 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/privateInteractionState..st +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/privateInteractionState..st @@ -1,8 +1,10 @@ styling privateInteractionState: aSymbol - self color: (aSymbol caseOf: { - [nil] -> [self baseColor]. - [#hover] -> [self baseColor lighter]. - [#active] -> [self baseColor twiceLighter]. - }). \ No newline at end of file + self isSplitter + ifFalse: [ + self color: (aSymbol caseOf: { + [nil] -> [self baseColor]. + [#hover] -> [self baseColor lighter]. + [#active] -> [self baseColor twiceLighter]})] + ifTrue: [self color: self splitterColor] \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/splitterColor.st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/splitterColor.st new file mode 100644 index 0000000..5c66742 --- /dev/null +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/splitterColor.st @@ -0,0 +1,4 @@ +as yet unclassified +splitterColor + + ^ Color black \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/methodProperties.json b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/methodProperties.json index 47afa89..d53bde8 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/methodProperties.json +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/methodProperties.json @@ -5,6 +5,8 @@ "action" : "ct 2/7/2021 19:21", "action:" : "ct 2/7/2021 19:21", "baseColor" : "ct 2/5/2021 23:13", + "beNoSplitter" : "Kiwi 2/8/2021 16:48", + "beSplitter" : "Kiwi 2/8/2021 16:53", "defaultBorderWidth" : "ct 2/7/2021 21:12", "doButtonAction" : "ct 2/7/2021 19:21", "doLayoutIn:" : "ct 2/5/2021 23:22", @@ -14,6 +16,7 @@ "handlesMouseOver:" : "ct 2/5/2021 22:59", "handlesMouseOverDragging:" : "jrp 7/3/2005 18:13", "initialize" : "ct 2/7/2021 21:12", + "isSplitter" : "Kiwi 2/8/2021 16:37", "label" : "ct 2/5/2021 18:55", "label:" : "ct 2/5/2021 19:29", "labelMorph" : "ct 2/5/2021 18:55", @@ -24,8 +27,9 @@ "mouseLeaveDragging:" : "ct 5/5/2020 19:29", "mouseMove:" : "ct 2/7/2021 21:11", "mouseUp:" : "ct 2/7/2021 01:45", - "privateInteractionState:" : "ct 2/7/2021 01:42", + "privateInteractionState:" : "Kiwi 2/8/2021 16:52", "siblingButtons" : "ct 2/5/2021 23:16", + "splitterColor" : "Kiwi 2/8/2021 16:52", "takeMouseFocus:" : "ct 5/16/2020 18:43", "target" : "ct 2/5/2021 23:35", "target:" : "ct 2/5/2021 23:35" } } diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/properties.json b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/properties.json index 1025469..8eadca9 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/properties.json +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/properties.json @@ -10,7 +10,8 @@ "allButtons", "target", "messageSend", - "action" ], + "action", + "isSplitter" ], "name" : "RadialMenuItemMorph", "pools" : [ ], From 33763696a9399ee7309f2b98d64d4caec29e6388 Mon Sep 17 00:00:00 2001 From: Christoph Thiede Date: Mon, 8 Feb 2021 19:36:35 +0100 Subject: [PATCH 05/31] ArcRingMorph: Add #angleWidth, revise #centerAngle --- .squot | 6 +++--- .../ArcRingMorph.class/instance/angleWidth.st | 7 +++++++ .../ArcRingMorph.class/instance/centerAngle.st | 6 ++---- .../ArcRingMorph.class/instance/radius..st | 1 + .../ArcRingMorph.class/methodProperties.json | 5 +++-- 5 files changed, 16 insertions(+), 9 deletions(-) create mode 100644 src/ColorContextMenu-Core.package/ArcRingMorph.class/instance/angleWidth.st diff --git a/.squot b/.squot index 7136a80..4cc9c7c 100644 --- a/.squot +++ b/.squot @@ -1,5 +1,5 @@ OrderedDictionary { - 'src/ColorContextMenu-Core.package' : #SquotCypressCodeSerializer, - 'src/ColorContextMenu-Tests.package' : #SquotCypressCodeSerializer, - 'src/BaselineOfColorContextMenu.package' : #SquotCypressCodeSerializer + 'src\/ColorContextMenu-Core.package' : #SquotCypressCodeSerializer, + 'src\/ColorContextMenu-Tests.package' : #SquotCypressCodeSerializer, + 'src\/BaselineOfColorContextMenu.package' : #SquotCypressCodeSerializer } \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/ArcRingMorph.class/instance/angleWidth.st b/src/ColorContextMenu-Core.package/ArcRingMorph.class/instance/angleWidth.st new file mode 100644 index 0000000..9fb5175 --- /dev/null +++ b/src/ColorContextMenu-Core.package/ArcRingMorph.class/instance/angleWidth.st @@ -0,0 +1,7 @@ +accessing +angleWidth + + ^ (self startAngle <= self stopAngle + ifTrue: [self stopAngle] + ifFalse: [self stopAngle + (Float pi * 2)]) + - self startAngle \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/ArcRingMorph.class/instance/centerAngle.st b/src/ColorContextMenu-Core.package/ArcRingMorph.class/instance/centerAngle.st index a1cbdb8..63c8624 100644 --- a/src/ColorContextMenu-Core.package/ArcRingMorph.class/instance/centerAngle.st +++ b/src/ColorContextMenu-Core.package/ArcRingMorph.class/instance/centerAngle.st @@ -1,6 +1,4 @@ -as yet unclassified +accessing centerAngle - ^ self stopAngle > self startAngle - ifTrue: [{self startAngle . self stopAngle} average] - ifFalse: [{self startAngle . self stopAngle + (Float pi * 2)} average] \ No newline at end of file + ^ self startAngle + (self angleWidth / 2) \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/ArcRingMorph.class/instance/radius..st b/src/ColorContextMenu-Core.package/ArcRingMorph.class/instance/radius..st index 283b602..82ac3d5 100644 --- a/src/ColorContextMenu-Core.package/ArcRingMorph.class/instance/radius..st +++ b/src/ColorContextMenu-Core.package/ArcRingMorph.class/instance/radius..st @@ -1,4 +1,5 @@ accessing radius: aNumber + self flag: #deprecate. "ct: Do we need it?" self extent: self extent * (aNumber / self radius) \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/ArcRingMorph.class/methodProperties.json b/src/ColorContextMenu-Core.package/ArcRingMorph.class/methodProperties.json index e8ecf5d..e0f8f81 100644 --- a/src/ColorContextMenu-Core.package/ArcRingMorph.class/methodProperties.json +++ b/src/ColorContextMenu-Core.package/ArcRingMorph.class/methodProperties.json @@ -2,8 +2,9 @@ "class" : { }, "instance" : { + "angleWidth" : "ct 2/8/2021 19:11", "borderCorrectionOffset" : "ct 2/7/2021 21:20", - "centerAngle" : "Kiwi 2/8/2021 18:28", + "centerAngle" : "ct 2/8/2021 19:13", "changed" : "ct 2/7/2021 19:16", "containsAngle:" : "ct 2/5/2021 19:45", "containsPoint:" : "ct 2/7/2021 19:14", @@ -24,7 +25,7 @@ "outerFraction:" : "ct 2/7/2021 19:40", "outerRadius" : "ct 1/31/2021 00:55", "radius" : "ct 1/31/2021 18:50", - "radius:" : "Kiwi 2/8/2021 18:32", + "radius:" : "ct 2/8/2021 19:13", "startAngle" : "ct 1/31/2021 00:32", "startAngle:" : "ct 2/7/2021 19:38", "startAngle:stopAngle:" : "ct 2/7/2021 19:59", From 4b252e4d3644576842e9c73548137a6bc4adb26d Mon Sep 17 00:00:00 2001 From: Christoph Thiede Date: Mon, 8 Feb 2021 19:38:04 +0100 Subject: [PATCH 06/31] Radial menu: Extract splitter logic into separate class, provide basic construction protocol, add #radialFlexWeight --- .../instance/discreteRadialMenu.st | 11 +++-------- .../ColorChooserMorph.class/methodProperties.json | 2 +- .../instance/beNoSplitter.st | 4 ---- .../instance/beSplitter.st | 6 ------ .../instance/isSplitter.st | 4 ---- .../instance/privateInteractionState..st | 12 +++++------- .../instance/radialFlexWeight..st | 5 +++++ .../instance/radialFlexWeight.st | 4 ++++ .../instance/splitterColor.st | 4 ---- .../methodProperties.json | 8 +++----- .../RadialMenuItemMorph.class/properties.json | 3 +-- .../RadialMenuMorph.class/instance/add.action..st | 7 +++++++ .../RadialMenuMorph.class/instance/addLine.st | 4 ++++ .../instance/doRadialLayout.st | 11 +++++++---- .../RadialMenuMorph.class/instance/items.st | 4 +++- .../RadialMenuMorph.class/methodProperties.json | 6 ++++-- .../RadialMenuSplitterMorph.class/README.md | 0 .../instance/initialize.st | 7 +++++++ .../instance/radialFlexWeight.st | 4 ++++ .../methodProperties.json | 6 ++++++ .../RadialMenuSplitterMorph.class/properties.json | 14 ++++++++++++++ 21 files changed, 78 insertions(+), 48 deletions(-) delete mode 100644 src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/beNoSplitter.st delete mode 100644 src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/beSplitter.st delete mode 100644 src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/isSplitter.st create mode 100644 src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/radialFlexWeight..st create mode 100644 src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/radialFlexWeight.st delete mode 100644 src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/splitterColor.st create mode 100644 src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/add.action..st create mode 100644 src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/addLine.st create mode 100644 src/ColorContextMenu-Core.package/RadialMenuSplitterMorph.class/README.md create mode 100644 src/ColorContextMenu-Core.package/RadialMenuSplitterMorph.class/instance/initialize.st create mode 100644 src/ColorContextMenu-Core.package/RadialMenuSplitterMorph.class/instance/radialFlexWeight.st create mode 100644 src/ColorContextMenu-Core.package/RadialMenuSplitterMorph.class/methodProperties.json create mode 100644 src/ColorContextMenu-Core.package/RadialMenuSplitterMorph.class/properties.json diff --git a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/discreteRadialMenu.st b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/discreteRadialMenu.st index 3723657..6e50034 100644 --- a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/discreteRadialMenu.st +++ b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/discreteRadialMenu.st @@ -9,13 +9,8 @@ discreteRadialMenu self labelGroups do: [:group | group do: [:attribute | - menu addItemMorph: (RadialMenuItemMorph new - label: attribute asString; - action: #setRandom; - yourself). - self flag: 'TODO: add action open submenu'. - ]. - menu addItemMorph: (RadialMenuItemMorph new beSplitter) - ]. + menu add: attribute asString action: #setRandom. + self flag: #todo "add action open submenu"]] + separatedBy: [menu addLine]. ^ menu \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/methodProperties.json b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/methodProperties.json index 18c7bc1..de63677 100644 --- a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/methodProperties.json +++ b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/methodProperties.json @@ -6,7 +6,7 @@ "contextMenu" : "Kiwi 2/8/2021 15:57", "contextMenuWithLevels:forAttrib:" : "ct 2/4/2021 20:26", "contextMenuWithLevelsForAttrib:" : "ct 2/4/2021 20:18", - "discreteRadialMenu" : "Kiwi 2/8/2021 18:50", + "discreteRadialMenu" : "ct 2/8/2021 19:21", "drawOn:" : "ct 2/4/2021 21:26", "handlesMouseDown:" : "ct 2/4/2021 21:10", "hatchForm" : "ct 2/4/2021 21:31", diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/beNoSplitter.st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/beNoSplitter.st deleted file mode 100644 index 69c8d54..0000000 --- a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/beNoSplitter.st +++ /dev/null @@ -1,4 +0,0 @@ -layout -beNoSplitter - - isSplitter := false \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/beSplitter.st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/beSplitter.st deleted file mode 100644 index 85762c1..0000000 --- a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/beSplitter.st +++ /dev/null @@ -1,6 +0,0 @@ -layout -beSplitter - - isSplitter := true. - self color: self splitterColor. - self label: '' \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/isSplitter.st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/isSplitter.st deleted file mode 100644 index 04df0ee..0000000 --- a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/isSplitter.st +++ /dev/null @@ -1,4 +0,0 @@ -layout -isSplitter - - ^ isSplitter ifNil: [self beNoSplitter. ^ isSplitter] \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/privateInteractionState..st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/privateInteractionState..st index 3690a37..087c4d6 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/privateInteractionState..st +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/privateInteractionState..st @@ -1,10 +1,8 @@ styling privateInteractionState: aSymbol - self isSplitter - ifFalse: [ - self color: (aSymbol caseOf: { - [nil] -> [self baseColor]. - [#hover] -> [self baseColor lighter]. - [#active] -> [self baseColor twiceLighter]})] - ifTrue: [self color: self splitterColor] \ No newline at end of file + self color: (aSymbol caseOf: { + [nil] -> [self baseColor]. + [#hover] -> [self baseColor lighter]. + [#active] -> [self baseColor twiceLighter] + }). \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/radialFlexWeight..st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/radialFlexWeight..st new file mode 100644 index 0000000..1faa4e5 --- /dev/null +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/radialFlexWeight..st @@ -0,0 +1,5 @@ +accessing +radialFlexWeight: aNumber + + self setProperty: #radialFlexWeight toValue: aNumber. + self layoutChanged. \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/radialFlexWeight.st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/radialFlexWeight.st new file mode 100644 index 0000000..acb3693 --- /dev/null +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/radialFlexWeight.st @@ -0,0 +1,4 @@ +accessing +radialFlexWeight + + ^ self valueOfProperty: #radialFlexWeight ifAbsent: [1] \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/splitterColor.st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/splitterColor.st deleted file mode 100644 index 5c66742..0000000 --- a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/splitterColor.st +++ /dev/null @@ -1,4 +0,0 @@ -as yet unclassified -splitterColor - - ^ Color black \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/methodProperties.json b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/methodProperties.json index d53bde8..99cb869 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/methodProperties.json +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/methodProperties.json @@ -5,8 +5,6 @@ "action" : "ct 2/7/2021 19:21", "action:" : "ct 2/7/2021 19:21", "baseColor" : "ct 2/5/2021 23:13", - "beNoSplitter" : "Kiwi 2/8/2021 16:48", - "beSplitter" : "Kiwi 2/8/2021 16:53", "defaultBorderWidth" : "ct 2/7/2021 21:12", "doButtonAction" : "ct 2/7/2021 19:21", "doLayoutIn:" : "ct 2/5/2021 23:22", @@ -16,7 +14,6 @@ "handlesMouseOver:" : "ct 2/5/2021 22:59", "handlesMouseOverDragging:" : "jrp 7/3/2005 18:13", "initialize" : "ct 2/7/2021 21:12", - "isSplitter" : "Kiwi 2/8/2021 16:37", "label" : "ct 2/5/2021 18:55", "label:" : "ct 2/5/2021 19:29", "labelMorph" : "ct 2/5/2021 18:55", @@ -27,9 +24,10 @@ "mouseLeaveDragging:" : "ct 5/5/2020 19:29", "mouseMove:" : "ct 2/7/2021 21:11", "mouseUp:" : "ct 2/7/2021 01:45", - "privateInteractionState:" : "Kiwi 2/8/2021 16:52", + "privateInteractionState:" : "ct 2/8/2021 19:19", + "radialFlexWeight" : "ct 2/8/2021 19:29", + "radialFlexWeight:" : "ct 2/8/2021 19:34", "siblingButtons" : "ct 2/5/2021 23:16", - "splitterColor" : "Kiwi 2/8/2021 16:52", "takeMouseFocus:" : "ct 5/16/2020 18:43", "target" : "ct 2/5/2021 23:35", "target:" : "ct 2/5/2021 23:35" } } diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/properties.json b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/properties.json index 8eadca9..1025469 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/properties.json +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/properties.json @@ -10,8 +10,7 @@ "allButtons", "target", "messageSend", - "action", - "isSplitter" ], + "action" ], "name" : "RadialMenuItemMorph", "pools" : [ ], diff --git a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/add.action..st b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/add.action..st new file mode 100644 index 0000000..1dc52a7 --- /dev/null +++ b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/add.action..st @@ -0,0 +1,7 @@ +construction +add: aString action: evaluable + + ^ self addItemMorph: (RadialMenuItemMorph new + label: aString; + action: evaluable; + yourself) \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/addLine.st b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/addLine.st new file mode 100644 index 0000000..0ddf5e0 --- /dev/null +++ b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/addLine.st @@ -0,0 +1,4 @@ +construction +addLine + + ^ self addItemMorph: RadialMenuSplitterMorph new \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/doRadialLayout.st b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/doRadialLayout.st index 6e66512..06c7caf 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/doRadialLayout.st +++ b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/doRadialLayout.st @@ -1,11 +1,14 @@ layout doRadialLayout - | angles size | - size := self items size. + | flexValues flexPos angles | + flexValues := self items collect: [:item | item radialFlexWeight]. "Like a watch: CW starting at North" - angles := (1 to: self items size) collect: [:i | - self startAngle + Float pi - (Float pi * 2 * i / size)]. + flexPos := 0. + angles := flexValues collect: [:flex | + flexPos := flexPos + flex. + self startAngle + Float pi - (Float pi * 2 * (flexPos - flex) / flexValues sum)]. + self items withIndexDo: [:item :index | item startAngle: (angles atWrap: index + 1) diff --git a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/items.st b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/items.st index e113f3c..1135130 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/items.st +++ b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/items.st @@ -1,4 +1,6 @@ accessing items - ^ self submorphsSatisfying: [:morph | morph isKindOf: RadialMenuItemMorph] \ No newline at end of file + ^ self submorphsSatisfying: [:morph | morph + isKindOf: RadialMenuItemMorph + orOf: RadialMenuSplitterMorph] \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/methodProperties.json b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/methodProperties.json index 27f6288..b09e606 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/methodProperties.json +++ b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/methodProperties.json @@ -2,21 +2,23 @@ "class" : { "indicateKeyboardFocus" : "ct 2/7/2021 17:59" }, "instance" : { + "add:action:" : "ct 2/8/2021 19:23", "addItemMorph:" : "ct 2/7/2021 19:30", + "addLine" : "ct 2/8/2021 19:23", "defaultBorderWidth" : "ct 2/7/2021 21:06", "defaultColor" : "ct 2/7/2021 21:05", "defaultExtent" : "ct 2/7/2021 21:07", "defaultInnerFraction" : "ct 2/5/2021 18:47", "delete" : "ct 2/7/2021 21:03", "doLayoutIn:" : "ct 2/7/2021 20:38", - "doRadialLayout" : "ct 2/7/2021 21:07", + "doRadialLayout" : "ct 2/8/2021 19:33", "handleEvent:" : "ct 2/7/2021 21:15", "handlesMouseDown:" : "ct 2/6/2021 00:19", "handlesMouseWheel:" : "ct 2/7/2021 02:10", "hasHalo:" : "ct 2/7/2021 21:01", "initialize" : "ct 2/7/2021 21:06", "innerFractionForItems" : "ct 2/7/2021 02:02", - "items" : "ct 2/5/2021 19:28", + "items" : "ct 2/8/2021 19:25", "mouseDown:" : "ct 2/7/2021 21:20", "mouseUp:" : "ct 2/7/2021 01:44", "mouseWheel:" : "ct 2/7/2021 02:04", diff --git a/src/ColorContextMenu-Core.package/RadialMenuSplitterMorph.class/README.md b/src/ColorContextMenu-Core.package/RadialMenuSplitterMorph.class/README.md new file mode 100644 index 0000000..e69de29 diff --git a/src/ColorContextMenu-Core.package/RadialMenuSplitterMorph.class/instance/initialize.st b/src/ColorContextMenu-Core.package/RadialMenuSplitterMorph.class/instance/initialize.st new file mode 100644 index 0000000..6375a6c --- /dev/null +++ b/src/ColorContextMenu-Core.package/RadialMenuSplitterMorph.class/instance/initialize.st @@ -0,0 +1,7 @@ +initialization +initialize + + super initialize. + + self beTransparent. + self borderWidth: 0. \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuSplitterMorph.class/instance/radialFlexWeight.st b/src/ColorContextMenu-Core.package/RadialMenuSplitterMorph.class/instance/radialFlexWeight.st new file mode 100644 index 0000000..f3a820a --- /dev/null +++ b/src/ColorContextMenu-Core.package/RadialMenuSplitterMorph.class/instance/radialFlexWeight.st @@ -0,0 +1,4 @@ +accessing +radialFlexWeight + + ^ 1 / 4 \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuSplitterMorph.class/methodProperties.json b/src/ColorContextMenu-Core.package/RadialMenuSplitterMorph.class/methodProperties.json new file mode 100644 index 0000000..e875d31 --- /dev/null +++ b/src/ColorContextMenu-Core.package/RadialMenuSplitterMorph.class/methodProperties.json @@ -0,0 +1,6 @@ +{ + "class" : { + }, + "instance" : { + "initialize" : "ct 2/8/2021 19:18", + "radialFlexWeight" : "ct 2/8/2021 19:34" } } diff --git a/src/ColorContextMenu-Core.package/RadialMenuSplitterMorph.class/properties.json b/src/ColorContextMenu-Core.package/RadialMenuSplitterMorph.class/properties.json new file mode 100644 index 0000000..e2e4fe3 --- /dev/null +++ b/src/ColorContextMenu-Core.package/RadialMenuSplitterMorph.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "ColorContextMenu-Core", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "RadialMenuSplitterMorph", + "pools" : [ + ], + "super" : "ArcRingMorph", + "type" : "normal" } From 453aebde55fbf0d6be44544d7ef75b8e713aca05 Mon Sep 17 00:00:00 2001 From: Christoph Thiede Date: Tue, 9 Feb 2021 01:45:33 +0100 Subject: [PATCH 07/31] Extend and revise ArcRingMorph accessors --- .../ArcRingMorph.class/instance/angleWidth.st | 2 ++ .../ArcRingMorph.class/instance/centerAngle..st | 6 ++++++ .../ArcRingMorph.class/instance/centerAngle.angleWidth..st | 6 ++++++ .../ArcRingMorph.class/instance/innerRadius.outerRadius..st | 6 ++++++ .../ArcRingMorph.class/methodProperties.json | 5 ++++- 5 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 src/ColorContextMenu-Core.package/ArcRingMorph.class/instance/centerAngle..st create mode 100644 src/ColorContextMenu-Core.package/ArcRingMorph.class/instance/centerAngle.angleWidth..st create mode 100644 src/ColorContextMenu-Core.package/ArcRingMorph.class/instance/innerRadius.outerRadius..st diff --git a/src/ColorContextMenu-Core.package/ArcRingMorph.class/instance/angleWidth.st b/src/ColorContextMenu-Core.package/ArcRingMorph.class/instance/angleWidth.st index 9fb5175..3a530fb 100644 --- a/src/ColorContextMenu-Core.package/ArcRingMorph.class/instance/angleWidth.st +++ b/src/ColorContextMenu-Core.package/ArcRingMorph.class/instance/angleWidth.st @@ -1,6 +1,8 @@ accessing angleWidth + self isArc ifFalse: [^ Float pi * 2]. + ^ (self startAngle <= self stopAngle ifTrue: [self stopAngle] ifFalse: [self stopAngle + (Float pi * 2)]) diff --git a/src/ColorContextMenu-Core.package/ArcRingMorph.class/instance/centerAngle..st b/src/ColorContextMenu-Core.package/ArcRingMorph.class/instance/centerAngle..st new file mode 100644 index 0000000..4ce3dd5 --- /dev/null +++ b/src/ColorContextMenu-Core.package/ArcRingMorph.class/instance/centerAngle..st @@ -0,0 +1,6 @@ +accessing +centerAngle: radialNumber + + ^ self + centerAngle: radialNumber + angleWidth: self angleWidth \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/ArcRingMorph.class/instance/centerAngle.angleWidth..st b/src/ColorContextMenu-Core.package/ArcRingMorph.class/instance/centerAngle.angleWidth..st new file mode 100644 index 0000000..ebec30e --- /dev/null +++ b/src/ColorContextMenu-Core.package/ArcRingMorph.class/instance/centerAngle.angleWidth..st @@ -0,0 +1,6 @@ +accessing +centerAngle: radialNumberCenter angleWidth: radialNumberWidth + + ^ self + startAngle: radialNumberCenter - (radialNumberWidth / 2) + stopAngle: radialNumberCenter + (radialNumberWidth / 2) \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/ArcRingMorph.class/instance/innerRadius.outerRadius..st b/src/ColorContextMenu-Core.package/ArcRingMorph.class/instance/innerRadius.outerRadius..st new file mode 100644 index 0000000..a532599 --- /dev/null +++ b/src/ColorContextMenu-Core.package/ArcRingMorph.class/instance/innerRadius.outerRadius..st @@ -0,0 +1,6 @@ +accessing +innerRadius: innerRadius outerRadius: outerRadius + + self assert: innerRadius x / innerRadius y = (outerRadius x / outerRadius y). + self radius: outerRadius. + self innerFraction: innerRadius r / outerRadius r outerFraction: 1. \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/ArcRingMorph.class/methodProperties.json b/src/ColorContextMenu-Core.package/ArcRingMorph.class/methodProperties.json index e0f8f81..459e9a2 100644 --- a/src/ColorContextMenu-Core.package/ArcRingMorph.class/methodProperties.json +++ b/src/ColorContextMenu-Core.package/ArcRingMorph.class/methodProperties.json @@ -2,9 +2,11 @@ "class" : { }, "instance" : { - "angleWidth" : "ct 2/8/2021 19:11", + "angleWidth" : "ct 2/8/2021 20:10", "borderCorrectionOffset" : "ct 2/7/2021 21:20", "centerAngle" : "ct 2/8/2021 19:13", + "centerAngle:" : "ct 2/8/2021 20:45", + "centerAngle:angleWidth:" : "ct 2/8/2021 20:09", "changed" : "ct 2/7/2021 19:16", "containsAngle:" : "ct 2/5/2021 19:45", "containsPoint:" : "ct 2/7/2021 19:14", @@ -18,6 +20,7 @@ "innerFraction:" : "ct 2/7/2021 19:39", "innerFraction:outerFraction:" : "ct 2/7/2021 19:59", "innerRadius" : "ct 1/31/2021 00:53", + "innerRadius:outerRadius:" : "ct 2/8/2021 20:07", "isArc" : "ct 2/5/2021 19:44", "isCircle" : "ct 1/31/2021 18:51", "outerBounds" : "ct 2/7/2021 19:11", From becdd719435ce3352c01534d92b125f626abb5ea Mon Sep 17 00:00:00 2001 From: Christoph Thiede Date: Tue, 9 Feb 2021 01:46:54 +0100 Subject: [PATCH 08/31] Fax drawing issues on ArcRingMorph Not really sure about that "1e-10", but in some scenarios the difference was larger than Float epsilon but still very tiny so maxOctant was not increased correctly. --- .../ArcRingMorph.class/instance/changed.st | 5 ----- .../ArcRingMorph.class/instance/drawCircleOn..st | 2 +- .../ArcRingMorph.class/instance/drawEllipseOn..st | 2 +- .../ArcRingMorph.class/methodProperties.json | 5 ++--- 4 files changed, 4 insertions(+), 10 deletions(-) delete mode 100644 src/ColorContextMenu-Core.package/ArcRingMorph.class/instance/changed.st diff --git a/src/ColorContextMenu-Core.package/ArcRingMorph.class/instance/changed.st b/src/ColorContextMenu-Core.package/ArcRingMorph.class/instance/changed.st deleted file mode 100644 index 4863412..0000000 --- a/src/ColorContextMenu-Core.package/ArcRingMorph.class/instance/changed.st +++ /dev/null @@ -1,5 +0,0 @@ -updating -changed - - "See the hack in #outerBounds. Not necessarily a long-term solution." - self invalidRect: self outerBounds. \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/ArcRingMorph.class/instance/drawCircleOn..st b/src/ColorContextMenu-Core.package/ArcRingMorph.class/instance/drawCircleOn..st index 378238a..2fa87bf 100644 --- a/src/ColorContextMenu-Core.package/ArcRingMorph.class/instance/drawCircleOn..st +++ b/src/ColorContextMenu-Core.package/ArcRingMorph.class/instance/drawCircleOn..st @@ -7,7 +7,7 @@ drawCircleOn: aCanvas radius := self radius x min: self radius y. minOctant := (self startAngle / (Float pi * 2) * 8 \\ 8) floor. maxOctant := (self stopAngle / (Float pi * 2) * 8 \\ 8 - 1) ceiling. - self stopAngle - self startAngle > Float epsilon ifFalse: [ + self stopAngle - self startAngle > 1e-10 ifFalse: [ maxOctant := maxOctant + 8]. min := self startAngle sinCos * radius. max := self stopAngle sinCos * radius. diff --git a/src/ColorContextMenu-Core.package/ArcRingMorph.class/instance/drawEllipseOn..st b/src/ColorContextMenu-Core.package/ArcRingMorph.class/instance/drawEllipseOn..st index 5ec8cce..9ca6a24 100644 --- a/src/ColorContextMenu-Core.package/ArcRingMorph.class/instance/drawEllipseOn..st +++ b/src/ColorContextMenu-Core.package/ArcRingMorph.class/instance/drawEllipseOn..st @@ -6,7 +6,7 @@ drawEllipseOn: aCanvas radius := self radius. minQuadrant := (self startAngle / (Float pi * 2) * 4 \\ 4) floor. maxQuadrant := (self stopAngle / (Float pi * 2) * 4 \\ 4 - 1) ceiling. - self stopAngle - self startAngle > Float epsilon ifFalse: [ + self stopAngle - self startAngle > 1e-10 ifFalse: [ maxQuadrant := maxQuadrant + 4]. min := self startAngle sinCos * radius. max := self stopAngle sinCos * radius. diff --git a/src/ColorContextMenu-Core.package/ArcRingMorph.class/methodProperties.json b/src/ColorContextMenu-Core.package/ArcRingMorph.class/methodProperties.json index 459e9a2..e6b846e 100644 --- a/src/ColorContextMenu-Core.package/ArcRingMorph.class/methodProperties.json +++ b/src/ColorContextMenu-Core.package/ArcRingMorph.class/methodProperties.json @@ -7,11 +7,10 @@ "centerAngle" : "ct 2/8/2021 19:13", "centerAngle:" : "ct 2/8/2021 20:45", "centerAngle:angleWidth:" : "ct 2/8/2021 20:09", - "changed" : "ct 2/7/2021 19:16", "containsAngle:" : "ct 2/5/2021 19:45", "containsPoint:" : "ct 2/7/2021 19:14", - "drawCircleOn:" : "ct 2/7/2021 21:19", - "drawEllipseOn:" : "ct 2/7/2021 21:19", + "drawCircleOn:" : "ct 2/8/2021 22:39", + "drawEllipseOn:" : "ct 2/9/2021 01:44", "drawOn:" : "ct 1/31/2021 18:56", "effectiveBounds" : "ct 2/7/2021 19:14", "initialize" : "ct 2/5/2021 18:45", From dba43efdbc218c4e0d20dac6f90650302629a364 Mon Sep 17 00:00:00 2001 From: Christoph Thiede Date: Tue, 9 Feb 2021 01:50:29 +0100 Subject: [PATCH 09/31] Fix regressions in radial layout and remove #offsetAngle in favor of #centerAngle --- .../RadialMenuMorph.class/instance/doRadialLayout.st | 4 ++-- .../RadialMenuMorph.class/instance/initialize.st | 1 + .../RadialMenuMorph.class/instance/offsetAngle..st | 4 ---- .../RadialMenuMorph.class/instance/offsetAngle.st | 4 ---- .../RadialMenuMorph.class/instance/scroll..st | 2 +- .../RadialMenuMorph.class/methodProperties.json | 8 +++----- 6 files changed, 7 insertions(+), 16 deletions(-) delete mode 100644 src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/offsetAngle..st delete mode 100644 src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/offsetAngle.st diff --git a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/doRadialLayout.st b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/doRadialLayout.st index 06c7caf..a4ce904 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/doRadialLayout.st +++ b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/doRadialLayout.st @@ -5,9 +5,9 @@ doRadialLayout flexValues := self items collect: [:item | item radialFlexWeight]. "Like a watch: CW starting at North" flexPos := 0. - angles := flexValues collect: [:flex | + angles := (flexValues copyWith: 0) collect: [:flex | flexPos := flexPos + flex. - self startAngle + Float pi - (Float pi * 2 * (flexPos - flex) / flexValues sum)]. + self stopAngle - (self angleWidth * (flexPos - flex) / flexValues sum)]. self items withIndexDo: [:item :index | item diff --git a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/initialize.st b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/initialize.st index 5eeb7b5..a765e5f 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/initialize.st +++ b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/initialize.st @@ -4,6 +4,7 @@ initialize super initialize. self innerFraction: self defaultInnerFraction. + self centerAngle: 0. self borderWidth: self defaultBorderWidth. self extent: self defaultExtent. self changeProportionalLayout. \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/offsetAngle..st b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/offsetAngle..st deleted file mode 100644 index 64c0d04..0000000 --- a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/offsetAngle..st +++ /dev/null @@ -1,4 +0,0 @@ -accessing -offsetAngle: radialNumber - - self startAngle: radialNumber stopAngle: radialNumber. \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/offsetAngle.st b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/offsetAngle.st deleted file mode 100644 index aa2109b..0000000 --- a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/offsetAngle.st +++ /dev/null @@ -1,4 +0,0 @@ -accessing -offsetAngle - - ^ self startAngle \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/scroll..st b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/scroll..st index 0d3ffe6..79a046e 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/scroll..st +++ b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/scroll..st @@ -9,7 +9,7 @@ scroll: count endValue: self offsetAngle + (count * 0.6 / (Float pi * 2)); register; start: #deleteWhenFinished." - self offsetAngle: self offsetAngle + (count * 0.2 / (Float pi * 2)). + self centerAngle: self centerAngle + (count * 0.2 / (Float pi * 2)). self handleEvent: self currentEvent asMouseMove. self flag: #todo. "fix hover selection when mouse button is still down" \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/methodProperties.json b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/methodProperties.json index b09e606..3a65d68 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/methodProperties.json +++ b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/methodProperties.json @@ -11,19 +11,17 @@ "defaultInnerFraction" : "ct 2/5/2021 18:47", "delete" : "ct 2/7/2021 21:03", "doLayoutIn:" : "ct 2/7/2021 20:38", - "doRadialLayout" : "ct 2/8/2021 19:33", + "doRadialLayout" : "ct 2/8/2021 20:14", "handleEvent:" : "ct 2/7/2021 21:15", "handlesMouseDown:" : "ct 2/6/2021 00:19", "handlesMouseWheel:" : "ct 2/7/2021 02:10", "hasHalo:" : "ct 2/7/2021 21:01", - "initialize" : "ct 2/7/2021 21:06", + "initialize" : "ct 2/8/2021 23:18", "innerFractionForItems" : "ct 2/7/2021 02:02", "items" : "ct 2/8/2021 19:25", "mouseDown:" : "ct 2/7/2021 21:20", "mouseUp:" : "ct 2/7/2021 01:44", "mouseWheel:" : "ct 2/7/2021 02:04", - "offsetAngle" : "ct 2/7/2021 20:54", - "offsetAngle:" : "ct 2/7/2021 20:54", "outerFractionForItems" : "ct 2/7/2021 02:02", "popUpAt:forHand:in:" : "ct 2/7/2021 20:57", "popUpAt:forHand:in:allowKeyboard:" : "ct 2/7/2021 20:57", @@ -33,7 +31,7 @@ "privateUnregisterItem:" : "ct 2/7/2021 19:30", "removeAllMorphs" : "ct 2/7/2021 19:31", "removeAllMorphsIn:" : "ct 2/7/2021 19:31", - "scroll:" : "ct 2/7/2021 21:09", + "scroll:" : "ct 2/8/2021 20:45", "scrollDown:" : "ct 2/7/2021 02:05", "scrollUp:" : "ct 2/7/2021 02:05", "target" : "ct 2/7/2021 20:55", From f79042ac8f3eb9a6568eda193ef26b80d05e60f8 Mon Sep 17 00:00:00 2001 From: Christoph Thiede Date: Tue, 9 Feb 2021 01:53:00 +0100 Subject: [PATCH 10/31] Add basic sub-radial menu implementation, use consistent construction & popUp interface for all kinds of menus --- .../instance/buildDiscreteMenu..st | 17 +++++++++++++++++ .../instance/buildDiscreteMenu.attribute..st | 4 ++++ ...=> buildDiscreteMenu.attribute.levels..st} | 6 +++--- .../instance/contextMenu.st | 19 +++---------------- .../contextMenuWithLevelsForAttrib..st | 4 ---- .../instance/discreteRadialMenu.st | 16 +++------------- .../instance/yellowButtonActivity..st | 10 +++++----- .../methodProperties.json | 11 ++++++----- .../instance/add.subMenu..st | 16 ++++++++++++++++ .../instance/addItemMorph..st | 4 +++- .../instance/popUpFor..st | 7 ------- .../instance/popUpForHand.in..st | 7 +++++++ .../instance/popUpInWorld..st | 6 ++++++ .../instance/popUpInWorld.st | 4 ++++ .../methodProperties.json | 7 +++++-- 15 files changed, 82 insertions(+), 56 deletions(-) create mode 100644 src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/buildDiscreteMenu..st create mode 100644 src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/buildDiscreteMenu.attribute..st rename src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/{contextMenuWithLevels.forAttrib..st => buildDiscreteMenu.attribute.levels..st} (56%) delete mode 100644 src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/contextMenuWithLevelsForAttrib..st create mode 100644 src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/add.subMenu..st delete mode 100644 src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/popUpFor..st create mode 100644 src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/popUpForHand.in..st create mode 100644 src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/popUpInWorld..st create mode 100644 src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/popUpInWorld.st diff --git a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/buildDiscreteMenu..st b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/buildDiscreteMenu..st new file mode 100644 index 0000000..9e04c72 --- /dev/null +++ b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/buildDiscreteMenu..st @@ -0,0 +1,17 @@ +menus +buildDiscreteMenu: menuFactory + + | menu | + menu := menuFactory value. + + menu + add: 'random' action: #setRandom; + addLine. + + self labelGroups do: [:group | + group do: [:attrib | + menu add: attrib asString subMenu: ( + self buildDiscreteMenu: menuFactory attribute: attrib)]. + menu addLine]. + + ^ menu \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/buildDiscreteMenu.attribute..st b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/buildDiscreteMenu.attribute..st new file mode 100644 index 0000000..8aba0d1 --- /dev/null +++ b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/buildDiscreteMenu.attribute..st @@ -0,0 +1,4 @@ +menus +buildDiscreteMenu: menuFactory attribute: aSymbol + + ^ self buildDiscreteMenu: menuFactory attribute: aSymbol levels: 6 \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/contextMenuWithLevels.forAttrib..st b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/buildDiscreteMenu.attribute.levels..st similarity index 56% rename from src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/contextMenuWithLevels.forAttrib..st rename to src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/buildDiscreteMenu.attribute.levels..st index 490e9fb..2c28a54 100644 --- a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/contextMenuWithLevels.forAttrib..st +++ b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/buildDiscreteMenu.attribute.levels..st @@ -1,12 +1,12 @@ menus -contextMenuWithLevels: levels forAttrib: aSymbol +buildDiscreteMenu: menuFactory attribute: aSymbol levels: levels | menu setter | - menu := MenuMorph new defaultTarget: self. + menu := menuFactory value. setter := ('set{1}:' format: {aSymbol capitalized}) asSymbol. 0 to: levels - 1 do: [:level | menu add: ('{1}%' format: {(level / (levels - 1) * 100) rounded}) action: [ - menu defaultTarget perform: setter with: level / (levels - 1)]]. + self perform: setter with: level / (levels - 1)]]. ^ menu \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/contextMenu.st b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/contextMenu.st index 4e2f96f..940e9a7 100644 --- a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/contextMenu.st +++ b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/contextMenu.st @@ -1,19 +1,6 @@ menus contextMenu - | menu | - menu := MenuMorph new defaultTarget: self. - - menu - add: 'random' action: #setRandom; - addLine. - - self labelGroups - do: [:group | - group do: [:attrib | - menu - add: attrib asString - subMenu: (self contextMenuWithLevelsForAttrib: attrib)]] - separatedBy: [menu addLine]. - - ^ menu \ No newline at end of file + ^ self buildDiscreteMenu: [MenuMorph new + defaultTarget: self; + yourself] \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/contextMenuWithLevelsForAttrib..st b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/contextMenuWithLevelsForAttrib..st deleted file mode 100644 index 8e60c6c..0000000 --- a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/contextMenuWithLevelsForAttrib..st +++ /dev/null @@ -1,4 +0,0 @@ -menus -contextMenuWithLevelsForAttrib: aSymbol - - ^ self contextMenuWithLevels: 6 forAttrib: aSymbol \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/discreteRadialMenu.st b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/discreteRadialMenu.st index 6e50034..7e727ac 100644 --- a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/discreteRadialMenu.st +++ b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/discreteRadialMenu.st @@ -1,16 +1,6 @@ menus discreteRadialMenu - "Menu items are only chosen in an illustrative fashion. To be replaced soon in order to align with #contextMenu." - | menu | - menu := RadialMenuMorph new. - menu target: self. - - self labelGroups - do: [:group | - group do: [:attribute | - menu add: attribute asString action: #setRandom. - self flag: #todo "add action open submenu"]] - separatedBy: [menu addLine]. - - ^ menu \ No newline at end of file + ^ self buildDiscreteMenu: [RadialMenuMorph new + target: self; + yourself] \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/yellowButtonActivity..st b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/yellowButtonActivity..st index 2bd19ba..521c60f 100644 --- a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/yellowButtonActivity..st +++ b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/yellowButtonActivity..st @@ -1,8 +1,8 @@ event handling yellowButtonActivity: shiftState - self menuMode caseOf: { - [nil] -> [self flash]. - [#popUp] -> [self contextMenu popUpInWorld: self currentWorld]. - [#discrete] -> [self discreteRadialMenu popUpFor: self currentEvent]. - }. \ No newline at end of file + (self menuMode caseOf: { + [nil] -> [^ self flash]. + [#popUp] -> [self contextMenu]. + [#discrete] -> [self discreteRadialMenu]. + }) popUpInWorld. \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/methodProperties.json b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/methodProperties.json index de63677..f82001c 100644 --- a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/methodProperties.json +++ b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/methodProperties.json @@ -2,11 +2,12 @@ "class" : { }, "instance" : { + "buildDiscreteMenu:" : "ct 2/8/2021 19:49", + "buildDiscreteMenu:attribute:" : "ct 2/8/2021 19:43", + "buildDiscreteMenu:attribute:levels:" : "ct 2/8/2021 19:44", "color:" : "ct 2/4/2021 15:37", - "contextMenu" : "Kiwi 2/8/2021 15:57", - "contextMenuWithLevels:forAttrib:" : "ct 2/4/2021 20:26", - "contextMenuWithLevelsForAttrib:" : "ct 2/4/2021 20:18", - "discreteRadialMenu" : "ct 2/8/2021 19:21", + "contextMenu" : "ct 2/8/2021 19:46", + "discreteRadialMenu" : "ct 2/8/2021 19:46", "drawOn:" : "ct 2/4/2021 21:26", "handlesMouseDown:" : "ct 2/4/2021 21:10", "hatchForm" : "ct 2/4/2021 21:31", @@ -28,4 +29,4 @@ "setSaturation:" : "ct 2/4/2021 20:53", "setYellow:" : "ct 2/4/2021 21:02", "update:with:" : "ct 2/5/2021 23:54", - "yellowButtonActivity:" : "ct 2/6/2021 00:01" } } + "yellowButtonActivity:" : "ct 2/8/2021 19:52" } } diff --git a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/add.subMenu..st b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/add.subMenu..st new file mode 100644 index 0000000..49bfee1 --- /dev/null +++ b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/add.subMenu..st @@ -0,0 +1,16 @@ +construction +add: aString subMenu: aRadialMenuMorph + + | item | + item := nil. + self flag: #refactor. "ct: Consider moving this logic into RadialMenuMorph" + ^ item := self add: aString action: [ + aRadialMenuMorph + innerRadius: self outerRadius outerRadius: + self outerRadius * 2 - self innerRadius; + center: self center. + item ifNotNil: [ + aRadialMenuMorph + centerAngle: item centerAngle + angleWidth: Float pi / 2]. + self addMorph: aRadialMenuMorph openInWorld] \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/addItemMorph..st b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/addItemMorph..st index d4d913b..f0b992c 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/addItemMorph..st +++ b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/addItemMorph..st @@ -7,4 +7,6 @@ addItemMorph: aRadialMenuItemMorph self privateRegisterItem: aRadialMenuItemMorph. self addMorphBack: aRadialMenuItemMorph. - self doRadialLayout. \ No newline at end of file + self doRadialLayout. + + ^ aRadialMenuItemMorph \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/popUpFor..st b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/popUpFor..st deleted file mode 100644 index 7718cf3..0000000 --- a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/popUpFor..st +++ /dev/null @@ -1,7 +0,0 @@ -control -popUpFor: anEvent - - ^ self - popUpAt: anEvent position - forHand: anEvent hand - in: anEvent hand world \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/popUpForHand.in..st b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/popUpForHand.in..st new file mode 100644 index 0000000..665641f --- /dev/null +++ b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/popUpForHand.in..st @@ -0,0 +1,7 @@ +control +popUpForHand: aHand in: world + + ^ self + popUpAt: aHand position + forHand: aHand + in: world \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/popUpInWorld..st b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/popUpInWorld..st new file mode 100644 index 0000000..1c4243b --- /dev/null +++ b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/popUpInWorld..st @@ -0,0 +1,6 @@ +control +popUpInWorld: world + + ^ self + popUpForHand: world primaryHand + in: world \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/popUpInWorld.st b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/popUpInWorld.st new file mode 100644 index 0000000..2e118d8 --- /dev/null +++ b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/popUpInWorld.st @@ -0,0 +1,4 @@ +control +popUpInWorld + + ^ self popUpInWorld: self currentWorld \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/methodProperties.json b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/methodProperties.json index 3a65d68..000cf99 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/methodProperties.json +++ b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/methodProperties.json @@ -3,7 +3,8 @@ "indicateKeyboardFocus" : "ct 2/7/2021 17:59" }, "instance" : { "add:action:" : "ct 2/8/2021 19:23", - "addItemMorph:" : "ct 2/7/2021 19:30", + "add:subMenu:" : "ct 2/9/2021 01:47", + "addItemMorph:" : "ct 2/8/2021 19:57", "addLine" : "ct 2/8/2021 19:23", "defaultBorderWidth" : "ct 2/7/2021 21:06", "defaultColor" : "ct 2/7/2021 21:05", @@ -25,7 +26,9 @@ "outerFractionForItems" : "ct 2/7/2021 02:02", "popUpAt:forHand:in:" : "ct 2/7/2021 20:57", "popUpAt:forHand:in:allowKeyboard:" : "ct 2/7/2021 20:57", - "popUpFor:" : "ct 2/6/2021 00:16", + "popUpForHand:in:" : "ct 2/8/2021 19:53", + "popUpInWorld" : "ct 2/8/2021 19:54", + "popUpInWorld:" : "ct 2/8/2021 19:54", "privateRegisterItem:" : "Kiwi 2/8/2021 18:14", "privateRemove:" : "ct 2/7/2021 19:31", "privateUnregisterItem:" : "ct 2/7/2021 19:30", From e29f7915e2866f13e3292e0b04cacd349182f7cc Mon Sep 17 00:00:00 2001 From: Kira Weinlein Date: Tue, 9 Feb 2021 14:35:45 +0100 Subject: [PATCH 11/31] Add "lighter" and "darker" to top-level menu --- .squot | 6 +++--- .../ColorChooserMorph.class/instance/buildDiscreteMenu..st | 4 ++++ .../instance/buildDiscreteMenu.attribute..st | 2 +- .../instance/defaultNumberOfLevels.st | 4 ++++ .../ColorChooserMorph.class/instance/setDarker.st | 4 ++++ .../ColorChooserMorph.class/instance/setLighter.st | 4 ++++ .../ColorChooserMorph.class/methodProperties.json | 7 +++++-- 7 files changed, 25 insertions(+), 6 deletions(-) create mode 100644 src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/defaultNumberOfLevels.st create mode 100644 src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/setDarker.st create mode 100644 src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/setLighter.st diff --git a/.squot b/.squot index 4cc9c7c..7136a80 100644 --- a/.squot +++ b/.squot @@ -1,5 +1,5 @@ OrderedDictionary { - 'src\/ColorContextMenu-Core.package' : #SquotCypressCodeSerializer, - 'src\/ColorContextMenu-Tests.package' : #SquotCypressCodeSerializer, - 'src\/BaselineOfColorContextMenu.package' : #SquotCypressCodeSerializer + 'src/ColorContextMenu-Core.package' : #SquotCypressCodeSerializer, + 'src/ColorContextMenu-Tests.package' : #SquotCypressCodeSerializer, + 'src/BaselineOfColorContextMenu.package' : #SquotCypressCodeSerializer } \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/buildDiscreteMenu..st b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/buildDiscreteMenu..st index 9e04c72..5afb99b 100644 --- a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/buildDiscreteMenu..st +++ b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/buildDiscreteMenu..st @@ -4,8 +4,12 @@ buildDiscreteMenu: menuFactory | menu | menu := menuFactory value. + "These buttons do not open a submenu; hence they are handled separately." menu add: 'random' action: #setRandom; + addLine; + add: 'lighter' action: #setLighter; + add: 'darker' action: #setDarker; addLine. self labelGroups do: [:group | diff --git a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/buildDiscreteMenu.attribute..st b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/buildDiscreteMenu.attribute..st index 8aba0d1..2a475d7 100644 --- a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/buildDiscreteMenu.attribute..st +++ b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/buildDiscreteMenu.attribute..st @@ -1,4 +1,4 @@ menus buildDiscreteMenu: menuFactory attribute: aSymbol - ^ self buildDiscreteMenu: menuFactory attribute: aSymbol levels: 6 \ No newline at end of file + ^ self buildDiscreteMenu: menuFactory attribute: aSymbol levels: self defaultNumberOfLevels \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/defaultNumberOfLevels.st b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/defaultNumberOfLevels.st new file mode 100644 index 0000000..fee034e --- /dev/null +++ b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/defaultNumberOfLevels.st @@ -0,0 +1,4 @@ +as yet unclassified +defaultNumberOfLevels + + ^ 6 \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/setDarker.st b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/setDarker.st new file mode 100644 index 0000000..5cbad20 --- /dev/null +++ b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/setDarker.st @@ -0,0 +1,4 @@ +actions +setDarker + + self setBrightness: self color brightness - (1 / (self defaultNumberOfLevels - 1)) asFloat \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/setLighter.st b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/setLighter.st new file mode 100644 index 0000000..790f158 --- /dev/null +++ b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/setLighter.st @@ -0,0 +1,4 @@ +actions +setLighter + + self setBrightness: self color brightness + (1 / (self defaultNumberOfLevels - 1)) asFloat \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/methodProperties.json b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/methodProperties.json index f82001c..236b671 100644 --- a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/methodProperties.json +++ b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/methodProperties.json @@ -2,11 +2,12 @@ "class" : { }, "instance" : { - "buildDiscreteMenu:" : "ct 2/8/2021 19:49", - "buildDiscreteMenu:attribute:" : "ct 2/8/2021 19:43", + "buildDiscreteMenu:" : "Kiwi 2/9/2021 14:33", + "buildDiscreteMenu:attribute:" : "Kiwi 2/9/2021 14:17", "buildDiscreteMenu:attribute:levels:" : "ct 2/8/2021 19:44", "color:" : "ct 2/4/2021 15:37", "contextMenu" : "ct 2/8/2021 19:46", + "defaultNumberOfLevels" : "Kiwi 2/9/2021 14:16", "discreteRadialMenu" : "ct 2/8/2021 19:46", "drawOn:" : "ct 2/4/2021 21:26", "handlesMouseDown:" : "ct 2/4/2021 21:10", @@ -20,8 +21,10 @@ "setBlue:" : "ct 2/4/2021 20:32", "setBrightness:" : "ct 2/4/2021 20:53", "setCyan:" : "ct 2/4/2021 21:01", + "setDarker" : "Kiwi 2/9/2021 14:29", "setGreen:" : "ct 2/4/2021 20:32", "setHue:" : "ct 2/4/2021 20:52", + "setLighter" : "Kiwi 2/9/2021 14:29", "setLightness:" : "ct 2/4/2021 20:53", "setMagenta:" : "ct 2/4/2021 21:01", "setRandom" : "ct 2/4/2021 21:34", From 5eb72c8688ad244fb63ac9c2a9d35c70fa6d427a Mon Sep 17 00:00:00 2001 From: Kira Weinlein Date: Tue, 9 Feb 2021 14:59:38 +0100 Subject: [PATCH 12/31] #10: Rotate submenu with main menu --- .../instance/buildDiscreteMenu.attribute.levels..st | 1 + .../ColorChooserMorph.class/methodProperties.json | 2 +- .../RadialMenuMorph.class/instance/scroll..st | 3 +++ .../RadialMenuMorph.class/methodProperties.json | 2 +- 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/buildDiscreteMenu.attribute.levels..st b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/buildDiscreteMenu.attribute.levels..st index 2c28a54..913fe92 100644 --- a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/buildDiscreteMenu.attribute.levels..st +++ b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/buildDiscreteMenu.attribute.levels..st @@ -2,6 +2,7 @@ menus buildDiscreteMenu: menuFactory attribute: aSymbol levels: levels | menu setter | + self flag: 'Warum heißt es hier menuFactory und nicht aRadialMenuMorph?'. menu := menuFactory value. setter := ('set{1}:' format: {aSymbol capitalized}) asSymbol. diff --git a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/methodProperties.json b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/methodProperties.json index 236b671..ddc2740 100644 --- a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/methodProperties.json +++ b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/methodProperties.json @@ -4,7 +4,7 @@ "instance" : { "buildDiscreteMenu:" : "Kiwi 2/9/2021 14:33", "buildDiscreteMenu:attribute:" : "Kiwi 2/9/2021 14:17", - "buildDiscreteMenu:attribute:levels:" : "ct 2/8/2021 19:44", + "buildDiscreteMenu:attribute:levels:" : "Kiwi 2/9/2021 14:46", "color:" : "ct 2/4/2021 15:37", "contextMenu" : "ct 2/8/2021 19:46", "defaultNumberOfLevels" : "Kiwi 2/9/2021 14:16", diff --git a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/scroll..st b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/scroll..st index 79a046e..a34cfc4 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/scroll..st +++ b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/scroll..st @@ -10,6 +10,9 @@ scroll: count register; start: #deleteWhenFinished." self centerAngle: self centerAngle + (count * 0.2 / (Float pi * 2)). + self submorphs do: [ :submorph | + submorph class = RadialMenuMorph ifTrue: [ + submorph centerAngle: submorph centerAngle + (count * 0.2 / (Float pi * 2))]]. self handleEvent: self currentEvent asMouseMove. self flag: #todo. "fix hover selection when mouse button is still down" \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/methodProperties.json b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/methodProperties.json index 000cf99..e3f55d2 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/methodProperties.json +++ b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/methodProperties.json @@ -34,7 +34,7 @@ "privateUnregisterItem:" : "ct 2/7/2021 19:30", "removeAllMorphs" : "ct 2/7/2021 19:31", "removeAllMorphsIn:" : "ct 2/7/2021 19:31", - "scroll:" : "ct 2/8/2021 20:45", + "scroll:" : "Kiwi 2/9/2021 14:53", "scrollDown:" : "ct 2/7/2021 02:05", "scrollUp:" : "ct 2/7/2021 02:05", "target" : "ct 2/7/2021 20:55", From 2318a351dafed28aae8c9bbd1877a85f5f607107 Mon Sep 17 00:00:00 2001 From: Kira Weinlein Date: Tue, 9 Feb 2021 18:57:34 +0100 Subject: [PATCH 13/31] Turn labels depending on their menu item's angle, color background of top-level menu items --- .../instance/discreteRadialMenu.st | 1 + .../methodProperties.json | 6 +++--- .../instance/baseColor..st | 4 ++++ .../instance/baseColor.st | 2 +- .../instance/basicLabelMorph.st | 10 ++++++++++ .../instance/defaultBaseColor.st | 4 ++++ .../instance/initialize.st | 2 +- .../instance/label..st | 3 ++- .../instance/label.st | 2 +- .../instance/labelAngle..st | 4 ++++ .../instance/labelAngle.st | 4 ++++ .../instance/setBaseColorForLabel..st | 16 +++++++++++++++ .../instance/startAngle.stopAngle..st | 5 +++++ .../instance/updateLabelAngle.st | 10 ++++++++++ .../methodProperties.json | 20 +++++++++++++------ .../RadialMenuItemMorph.class/properties.json | 3 ++- .../instance/addItemMorph..st | 1 + .../RadialMenuMorph.class/instance/scroll..st | 2 ++ .../methodProperties.json | 6 +++--- .../instance/hasLabel.st | 4 ++++ .../methodProperties.json | 1 + 21 files changed, 93 insertions(+), 17 deletions(-) create mode 100644 src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/baseColor..st create mode 100644 src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/basicLabelMorph.st create mode 100644 src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/defaultBaseColor.st create mode 100644 src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/labelAngle..st create mode 100644 src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/labelAngle.st create mode 100644 src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/setBaseColorForLabel..st create mode 100644 src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/startAngle.stopAngle..st create mode 100644 src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/updateLabelAngle.st create mode 100644 src/ColorContextMenu-Core.package/RadialMenuSplitterMorph.class/instance/hasLabel.st diff --git a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/discreteRadialMenu.st b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/discreteRadialMenu.st index 7e727ac..aac5bd8 100644 --- a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/discreteRadialMenu.st +++ b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/discreteRadialMenu.st @@ -3,4 +3,5 @@ discreteRadialMenu ^ self buildDiscreteMenu: [RadialMenuMorph new target: self; + innerFraction: 0.35; yourself] \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/methodProperties.json b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/methodProperties.json index ddc2740..0ba0d8f 100644 --- a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/methodProperties.json +++ b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/methodProperties.json @@ -8,7 +8,7 @@ "color:" : "ct 2/4/2021 15:37", "contextMenu" : "ct 2/8/2021 19:46", "defaultNumberOfLevels" : "Kiwi 2/9/2021 14:16", - "discreteRadialMenu" : "ct 2/8/2021 19:46", + "discreteRadialMenu" : "Kiwi 2/9/2021 15:54", "drawOn:" : "ct 2/4/2021 21:26", "handlesMouseDown:" : "ct 2/4/2021 21:10", "hatchForm" : "ct 2/4/2021 21:31", @@ -21,10 +21,10 @@ "setBlue:" : "ct 2/4/2021 20:32", "setBrightness:" : "ct 2/4/2021 20:53", "setCyan:" : "ct 2/4/2021 21:01", - "setDarker" : "Kiwi 2/9/2021 14:29", + "setDarker" : "Kiwi 2/9/2021 16:22", "setGreen:" : "ct 2/4/2021 20:32", "setHue:" : "ct 2/4/2021 20:52", - "setLighter" : "Kiwi 2/9/2021 14:29", + "setLighter" : "Kiwi 2/9/2021 16:22", "setLightness:" : "ct 2/4/2021 20:53", "setMagenta:" : "ct 2/4/2021 21:01", "setRandom" : "ct 2/4/2021 21:34", diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/baseColor..st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/baseColor..st new file mode 100644 index 0000000..3ed6503 --- /dev/null +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/baseColor..st @@ -0,0 +1,4 @@ +accessing +baseColor: aColor + + ^ baseColor := aColor \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/baseColor.st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/baseColor.st index 8c68b2f..023cbea 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/baseColor.st +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/baseColor.st @@ -1,4 +1,4 @@ accessing baseColor - ^ Color gray: 0.15 \ No newline at end of file + ^ baseColor ifNil: [ self defaultBaseColor ] \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/basicLabelMorph.st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/basicLabelMorph.st new file mode 100644 index 0000000..058e649 --- /dev/null +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/basicLabelMorph.st @@ -0,0 +1,10 @@ +as yet unclassified +basicLabelMorph + + | transformMorph textMorph | + transformMorph := TransformationMorph new. + textMorph := TextMorph new lock. + textMorph color: Color white. + transformMorph extent: textMorph extent. + transformMorph addMorph: textMorph. + ^ transformMorph \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/defaultBaseColor.st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/defaultBaseColor.st new file mode 100644 index 0000000..bc407d2 --- /dev/null +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/defaultBaseColor.st @@ -0,0 +1,4 @@ +accessing +defaultBaseColor + + ^ Color gray: 0.3 \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/initialize.st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/initialize.st index aadbad2..6e16255 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/initialize.st +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/initialize.st @@ -6,5 +6,5 @@ initialize self privateInteractionState: nil. self borderWidth: self defaultBorderWidth. - self addMorph: (labelMorph := TextMorph new lock). + self addMorph: (labelMorph := self basicLabelMorph). labelMorph color: Color white. \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/label..st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/label..st index 30c0f20..0a8dd99 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/label..st +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/label..st @@ -1,4 +1,5 @@ accessing label: aStringOrText - self labelMorph contents: aStringOrText. \ No newline at end of file + self labelMorph submorphs first contents: aStringOrText capitalized. + self setBaseColorForLabel: aStringOrText asSymbol \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/label.st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/label.st index fa81614..393bdd1 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/label.st +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/label.st @@ -1,4 +1,4 @@ accessing label - ^ self labelMorph contents \ No newline at end of file + ^ self labelMorph submorphs first contents \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/labelAngle..st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/labelAngle..st new file mode 100644 index 0000000..fe5b955 --- /dev/null +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/labelAngle..st @@ -0,0 +1,4 @@ +accessing +labelAngle: aNumber "given in radiants" + + self labelMorph angle: aNumber \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/labelAngle.st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/labelAngle.st new file mode 100644 index 0000000..df1d2df --- /dev/null +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/labelAngle.st @@ -0,0 +1,4 @@ +accessing +labelAngle "given in radiants" + + self labelMorph angle \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/setBaseColorForLabel..st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/setBaseColorForLabel..st new file mode 100644 index 0000000..f9d6c7b --- /dev/null +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/setBaseColorForLabel..st @@ -0,0 +1,16 @@ +accessing +setBaseColorForLabel: aSymbol + + | rawColor | + + rawColor := self defaultBaseColor. + (Color class canUnderstand: aSymbol) ifTrue: [ rawColor := Color perform: aSymbol ]. + + aSymbol = #darker ifTrue: [ rawColor := Color veryVeryDarkGray ]. + aSymbol = #lighter ifTrue: [ rawColor := Color lightGray ]. + aSymbol = #random ifTrue: [ rawColor := self defaultBaseColor ]. + + self baseColor: (rawColor mixed: 0.6 with: self defaultBaseColor). + + self privateInteractionState: nil. + diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/startAngle.stopAngle..st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/startAngle.stopAngle..st new file mode 100644 index 0000000..c25e1d5 --- /dev/null +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/startAngle.stopAngle..st @@ -0,0 +1,5 @@ +accessing +startAngle: radialNumberStart stopAngle: radialNumberStop + + super startAngle: radialNumberStart stopAngle: radialNumberStop. + self updateLabelAngle. \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/updateLabelAngle.st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/updateLabelAngle.st new file mode 100644 index 0000000..427446a --- /dev/null +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/updateLabelAngle.st @@ -0,0 +1,10 @@ +as yet unclassified +updateLabelAngle + + | pi angleBelow2Pi | + pi := Float pi. + angleBelow2Pi := self centerAngle - (self centerAngle / (2 * pi)) floor. + angleBelow2Pi < pi + ifTrue: [ self labelAngle: self centerAngle - (0.5 * pi) ] + ifFalse: [ self labelAngle: self centerAngle + (0.5 * pi) ] + \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/methodProperties.json b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/methodProperties.json index 99cb869..4e03a81 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/methodProperties.json +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/methodProperties.json @@ -4,18 +4,23 @@ "instance" : { "action" : "ct 2/7/2021 19:21", "action:" : "ct 2/7/2021 19:21", - "baseColor" : "ct 2/5/2021 23:13", + "baseColor" : "Kiwi 2/9/2021 17:45", + "baseColor:" : "Kiwi 2/9/2021 17:37", + "basicLabelMorph" : "Kiwi 2/9/2021 18:54", + "defaultBaseColor" : "Kiwi 2/9/2021 17:44", "defaultBorderWidth" : "ct 2/7/2021 21:12", - "doButtonAction" : "ct 2/7/2021 19:21", + "doButtonAction" : "Kiwi 2/9/2021 14:31", "doLayoutIn:" : "ct 2/5/2021 23:22", "giveMouseFocusTo:event:" : "ct 2/7/2021 01:35", "handleMouseUp:" : "ct 2/7/2021 01:28", "handlesMouseDown:" : "ct 2/5/2021 23:03", "handlesMouseOver:" : "ct 2/5/2021 22:59", "handlesMouseOverDragging:" : "jrp 7/3/2005 18:13", - "initialize" : "ct 2/7/2021 21:12", - "label" : "ct 2/5/2021 18:55", - "label:" : "ct 2/5/2021 19:29", + "initialize" : "Kiwi 2/9/2021 15:25", + "label" : "Kiwi 2/9/2021 15:09", + "label:" : "Kiwi 2/9/2021 18:47", + "labelAngle" : "Kiwi 2/9/2021 15:10", + "labelAngle:" : "Kiwi 2/9/2021 15:10", "labelMorph" : "ct 2/5/2021 18:55", "mouseDown:" : "ct 2/5/2021 23:04", "mouseEnter:" : "ct 2/7/2021 01:40", @@ -27,7 +32,10 @@ "privateInteractionState:" : "ct 2/8/2021 19:19", "radialFlexWeight" : "ct 2/8/2021 19:29", "radialFlexWeight:" : "ct 2/8/2021 19:34", + "setBaseColorForLabel:" : "Kiwi 2/9/2021 18:48", "siblingButtons" : "ct 2/5/2021 23:16", + "startAngle:stopAngle:" : "Kiwi 2/9/2021 16:18", "takeMouseFocus:" : "ct 5/16/2020 18:43", "target" : "ct 2/5/2021 23:35", - "target:" : "ct 2/5/2021 23:35" } } + "target:" : "ct 2/5/2021 23:35", + "updateLabelAngle" : "Kiwi 2/9/2021 16:12" } } diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/properties.json b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/properties.json index 1025469..4457298 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/properties.json +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/properties.json @@ -10,7 +10,8 @@ "allButtons", "target", "messageSend", - "action" ], + "action", + "baseColor" ], "name" : "RadialMenuItemMorph", "pools" : [ ], diff --git a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/addItemMorph..st b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/addItemMorph..st index f0b992c..f24aee0 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/addItemMorph..st +++ b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/addItemMorph..st @@ -7,6 +7,7 @@ addItemMorph: aRadialMenuItemMorph self privateRegisterItem: aRadialMenuItemMorph. self addMorphBack: aRadialMenuItemMorph. + self addDependent: aRadialMenuItemMorph. self doRadialLayout. ^ aRadialMenuItemMorph \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/scroll..st b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/scroll..st index a34cfc4..8516066 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/scroll..st +++ b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/scroll..st @@ -10,9 +10,11 @@ scroll: count register; start: #deleteWhenFinished." self centerAngle: self centerAngle + (count * 0.2 / (Float pi * 2)). + self submorphs do: [ :submorph | submorph class = RadialMenuMorph ifTrue: [ submorph centerAngle: submorph centerAngle + (count * 0.2 / (Float pi * 2))]]. self handleEvent: self currentEvent asMouseMove. + self flag: #todo. "fix hover selection when mouse button is still down" \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/methodProperties.json b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/methodProperties.json index e3f55d2..a7dc447 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/methodProperties.json +++ b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/methodProperties.json @@ -2,9 +2,9 @@ "class" : { "indicateKeyboardFocus" : "ct 2/7/2021 17:59" }, "instance" : { - "add:action:" : "ct 2/8/2021 19:23", + "add:action:" : "Kiwi 2/9/2021 14:07", "add:subMenu:" : "ct 2/9/2021 01:47", - "addItemMorph:" : "ct 2/8/2021 19:57", + "addItemMorph:" : "Kiwi 2/9/2021 15:58", "addLine" : "ct 2/8/2021 19:23", "defaultBorderWidth" : "ct 2/7/2021 21:06", "defaultColor" : "ct 2/7/2021 21:05", @@ -34,7 +34,7 @@ "privateUnregisterItem:" : "ct 2/7/2021 19:30", "removeAllMorphs" : "ct 2/7/2021 19:31", "removeAllMorphsIn:" : "ct 2/7/2021 19:31", - "scroll:" : "Kiwi 2/9/2021 14:53", + "scroll:" : "Kiwi 2/9/2021 16:18", "scrollDown:" : "ct 2/7/2021 02:05", "scrollUp:" : "ct 2/7/2021 02:05", "target" : "ct 2/7/2021 20:55", diff --git a/src/ColorContextMenu-Core.package/RadialMenuSplitterMorph.class/instance/hasLabel.st b/src/ColorContextMenu-Core.package/RadialMenuSplitterMorph.class/instance/hasLabel.st new file mode 100644 index 0000000..9141098 --- /dev/null +++ b/src/ColorContextMenu-Core.package/RadialMenuSplitterMorph.class/instance/hasLabel.st @@ -0,0 +1,4 @@ +accessing +hasLabel + + ^ false \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuSplitterMorph.class/methodProperties.json b/src/ColorContextMenu-Core.package/RadialMenuSplitterMorph.class/methodProperties.json index e875d31..aa9015d 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuSplitterMorph.class/methodProperties.json +++ b/src/ColorContextMenu-Core.package/RadialMenuSplitterMorph.class/methodProperties.json @@ -2,5 +2,6 @@ "class" : { }, "instance" : { + "hasLabel" : "Kiwi 2/9/2021 15:40", "initialize" : "ct 2/8/2021 19:18", "radialFlexWeight" : "ct 2/8/2021 19:34" } } From 1bde2e83938bddad2fa68956e39482ac0a95b084 Mon Sep 17 00:00:00 2001 From: Christoph Thiede <38782922+LinqLover@users.noreply.github.com> Date: Thu, 11 Feb 2021 14:57:06 +0100 Subject: [PATCH 14/31] Recategorize some selectors --- .../ColorChooserMorph.class/instance/defaultNumberOfLevels.st | 4 ++-- .../RadialMenuItemMorph.class/instance/basicLabelMorph.st | 4 ++-- .../RadialMenuItemMorph.class/instance/defaultBaseColor.st | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/defaultNumberOfLevels.st b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/defaultNumberOfLevels.st index fee034e..4cd8783 100644 --- a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/defaultNumberOfLevels.st +++ b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/defaultNumberOfLevels.st @@ -1,4 +1,4 @@ -as yet unclassified +private defaultNumberOfLevels - ^ 6 \ No newline at end of file + ^ 6 diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/basicLabelMorph.st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/basicLabelMorph.st index 058e649..98fbca8 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/basicLabelMorph.st +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/basicLabelMorph.st @@ -1,4 +1,4 @@ -as yet unclassified +initialization basicLabelMorph | transformMorph textMorph | @@ -7,4 +7,4 @@ basicLabelMorph textMorph color: Color white. transformMorph extent: textMorph extent. transformMorph addMorph: textMorph. - ^ transformMorph \ No newline at end of file + ^ transformMorph diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/defaultBaseColor.st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/defaultBaseColor.st index bc407d2..d57f97b 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/defaultBaseColor.st +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/defaultBaseColor.st @@ -1,4 +1,4 @@ accessing -defaultBaseColor +initialization - ^ Color gray: 0.3 \ No newline at end of file + ^ Color gray: 0.3 From 5d99df057e4e3095dda84c002b414b9be4120c15 Mon Sep 17 00:00:00 2001 From: Christoph Thiede Date: Thu, 11 Feb 2021 14:02:17 +0000 Subject: [PATCH 15/31] Fix a small slip from 1bde2e8 --- .../RadialMenuItemMorph.class/instance/defaultBaseColor.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/defaultBaseColor.st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/defaultBaseColor.st index d57f97b..10c859a 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/defaultBaseColor.st +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/defaultBaseColor.st @@ -1,4 +1,4 @@ -accessing initialization +defaultBaseColor ^ Color gray: 0.3 From b88e24d1dda917e7f350eba88c3ef330c2854ff8 Mon Sep 17 00:00:00 2001 From: Christoph Thiede Date: Thu, 11 Feb 2021 15:04:13 +0100 Subject: [PATCH 16/31] Refactor RadialMenuMorph>>scroll: --- .squot | 6 +++--- .../RadialMenuMorph.class/instance/scroll..st | 7 ++++--- .../RadialMenuMorph.class/methodProperties.json | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.squot b/.squot index 7136a80..4cc9c7c 100644 --- a/.squot +++ b/.squot @@ -1,5 +1,5 @@ OrderedDictionary { - 'src/ColorContextMenu-Core.package' : #SquotCypressCodeSerializer, - 'src/ColorContextMenu-Tests.package' : #SquotCypressCodeSerializer, - 'src/BaselineOfColorContextMenu.package' : #SquotCypressCodeSerializer + 'src\/ColorContextMenu-Core.package' : #SquotCypressCodeSerializer, + 'src\/ColorContextMenu-Tests.package' : #SquotCypressCodeSerializer, + 'src\/BaselineOfColorContextMenu.package' : #SquotCypressCodeSerializer } \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/scroll..st b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/scroll..st index 8516066..fc8d4ca 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/scroll..st +++ b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/scroll..st @@ -11,9 +11,10 @@ scroll: count start: #deleteWhenFinished." self centerAngle: self centerAngle + (count * 0.2 / (Float pi * 2)). - self submorphs do: [ :submorph | - submorph class = RadialMenuMorph ifTrue: [ - submorph centerAngle: submorph centerAngle + (count * 0.2 / (Float pi * 2))]]. + self submorphs + select: [:morph | morph isKindOf: RadialMenuMorph] + thenDo: [:menu | + menu centerAngle: menu centerAngle + (count * 0.2 / (Float pi * 2))]. self handleEvent: self currentEvent asMouseMove. diff --git a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/methodProperties.json b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/methodProperties.json index a7dc447..b5da59a 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/methodProperties.json +++ b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/methodProperties.json @@ -34,7 +34,7 @@ "privateUnregisterItem:" : "ct 2/7/2021 19:30", "removeAllMorphs" : "ct 2/7/2021 19:31", "removeAllMorphsIn:" : "ct 2/7/2021 19:31", - "scroll:" : "Kiwi 2/9/2021 16:18", + "scroll:" : "ct 2/11/2021 15:00", "scrollDown:" : "ct 2/7/2021 02:05", "scrollUp:" : "ct 2/7/2021 02:05", "target" : "ct 2/7/2021 20:55", From c306cde31ac672f50ea8153036d481654fecf5ff Mon Sep 17 00:00:00 2001 From: Christoph Thiede Date: Wed, 17 Feb 2021 19:59:01 +0100 Subject: [PATCH 17/31] Extend color chooser tests Unfortunately, we won't be able to write UI tests for the dragging control of the radial menu, see comment in #testDiscreteRadialDrag :( --- .../instance/chooseDiscreteRadial.st | 4 ++++ .../instance/chooseMode..st | 10 ++++++++++ .../instance/choosePopUp.st | 4 ++++ .../instance/expectedFailures.st | 4 ++++ .../instance/findMenu.st | 9 +++++++++ .../instance/initialize.st | 3 ++- .../instance/openMenu.st | 9 +++++++++ .../instance/shouldChangeColor..st | 10 ++++++++++ .../instance/tearDown.st | 1 + .../instance/testDiscreteRadialDrag.st | 17 +++++++++++++++++ .../instance/testDiscreteRadialMenu.st | 9 +++------ .../instance/testDiscreteRadialRandom.st | 9 +++++++++ .../instance/testDiscreteRadialRed.st | 14 ++++++++++++++ .../instance/testPopUpMenu.st | 9 +++------ .../instance/testPopUpRandom.st | 10 ++++++++++ .../methodProperties.json | 19 +++++++++++++++---- .../ColorChooserTest.class/properties.json | 3 ++- 17 files changed, 126 insertions(+), 18 deletions(-) create mode 100644 src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/chooseDiscreteRadial.st create mode 100644 src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/chooseMode..st create mode 100644 src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/choosePopUp.st create mode 100644 src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/expectedFailures.st create mode 100644 src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/findMenu.st create mode 100644 src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/openMenu.st create mode 100644 src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/shouldChangeColor..st create mode 100644 src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/testDiscreteRadialDrag.st create mode 100644 src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/testDiscreteRadialRandom.st create mode 100644 src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/testDiscreteRadialRed.st create mode 100644 src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/testPopUpRandom.st diff --git a/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/chooseDiscreteRadial.st b/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/chooseDiscreteRadial.st new file mode 100644 index 0000000..2d37e25 --- /dev/null +++ b/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/chooseDiscreteRadial.st @@ -0,0 +1,4 @@ +support +chooseDiscreteRadial + + ^ self chooseMode: 'Radial menu (discrete)' \ No newline at end of file diff --git a/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/chooseMode..st b/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/chooseMode..st new file mode 100644 index 0000000..17fba11 --- /dev/null +++ b/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/chooseMode..st @@ -0,0 +1,10 @@ +support +chooseMode: label + + | button | + button := self subject findByLabel: label. + + button getModelState + ifFalse: [button click]. + + self assert: button getModelState description: ['Cannot choose mode {1}' format: {label}]. \ No newline at end of file diff --git a/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/choosePopUp.st b/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/choosePopUp.st new file mode 100644 index 0000000..163c142 --- /dev/null +++ b/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/choosePopUp.st @@ -0,0 +1,4 @@ +support +choosePopUp + + ^ self chooseMode: 'Pop-up menu' \ No newline at end of file diff --git a/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/expectedFailures.st b/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/expectedFailures.st new file mode 100644 index 0000000..99f618d --- /dev/null +++ b/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/expectedFailures.st @@ -0,0 +1,4 @@ +failures +expectedFailures + + ^ super expectedFailures , #(testDiscreteRadialDrag) \ No newline at end of file diff --git a/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/findMenu.st b/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/findMenu.st new file mode 100644 index 0000000..8fc80f2 --- /dev/null +++ b/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/findMenu.st @@ -0,0 +1,9 @@ +support +findMenu + + | menu | + menu := self findTopMorph. + ([menu target] ifError: [menu defaultTarget]) class category = chooser model class category ifTrue: [ + morphsToDelete add: menu]. + + ^ self subject createWrapperFor: {menu} \ No newline at end of file diff --git a/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/initialize.st b/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/initialize.st index 840bb1e..0fcd7bd 100644 --- a/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/initialize.st +++ b/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/initialize.st @@ -3,4 +3,5 @@ initialize super initialize. - morphsToRestore := OrderedCollection new. \ No newline at end of file + morphsToRestore := OrderedCollection new. + morphsToDelete := OrderedCollection new. \ No newline at end of file diff --git a/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/openMenu.st b/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/openMenu.st new file mode 100644 index 0000000..9e4c88b --- /dev/null +++ b/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/openMenu.st @@ -0,0 +1,9 @@ +support +openMenu + + (self subject createWrapperFor: { + (self subject findByPosition: self subject center) + morphs detectMax: [:m | m ownerChain size]}) + rightClick. + + ^ self findMenu \ No newline at end of file diff --git a/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/shouldChangeColor..st b/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/shouldChangeColor..st new file mode 100644 index 0000000..6a02789 --- /dev/null +++ b/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/shouldChangeColor..st @@ -0,0 +1,10 @@ +asserting +shouldChangeColor: aBlock + + | newColor oldColor | + oldColor := chooser model color. + + aBlock value. + newColor := chooser model color. + + self deny: oldColor equals: newColor. \ No newline at end of file diff --git a/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/tearDown.st b/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/tearDown.st index 67d532b..75a24e9 100644 --- a/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/tearDown.st +++ b/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/tearDown.st @@ -2,5 +2,6 @@ running tearDown [morphsToRestore removeAllSuchThat: [:m | m show. true]. + morphsToDelete removeAllSuchThat: [:m | m abandon. true]. chooser delete] ensure: [super tearDown]. \ No newline at end of file diff --git a/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/testDiscreteRadialDrag.st b/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/testDiscreteRadialDrag.st new file mode 100644 index 0000000..c5c2d35 --- /dev/null +++ b/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/testDiscreteRadialDrag.st @@ -0,0 +1,17 @@ +tests +testDiscreteRadialDrag + + | menu item | + self fail: #notImplemented. "Goes beyond capabilities of MTF at the moment, see: https://github.com/hpi-swa-lab/squeak/issues/57" + + self chooseDiscreteRadial. + (self subject createWrapperFor: { + (self subject findByPosition: self subject center) + morphs detectMax: [:m | m ownerChain size]}) + rightMouseDown: 0. + menu := self findMenu. + + item := menu findByLabel: 'Random'. + item halt sendMouseMoveEventForButton: item class rightButton modifiers: 0 position: item effectiveBounds center. + self flag: #todo. "We need more elaborate simulation, try out MorphicEventTests?" + self shouldChangeColor: [item sendMouseEvent: #mouseUp button: item class rightButton modifiers: 0 position: item effectiveBounds center]. \ No newline at end of file diff --git a/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/testDiscreteRadialMenu.st b/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/testDiscreteRadialMenu.st index 938c947..c645a1a 100644 --- a/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/testDiscreteRadialMenu.st +++ b/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/testDiscreteRadialMenu.st @@ -3,14 +3,11 @@ testDiscreteRadialMenu "Smoke test" | menu | - (self subject findByLabel: 'Radial menu (discrete)') in: [:button | - [button click] doWhileFalse: [button getModelState]]. + self chooseDiscreteRadial. + self openMenu. - (MTFMorphWrapper newWith: { - (self subject findByPosition: self subject center) - morphs detectMax: [:m | m ownerChain size]}) - rightClick. self assert: [(menu := self findTopMorph) isKindOf: RadialMenuMorph] description: ['Expected a RadialMenuMorph but found {1}' format: {menu}]. + menu delete. \ No newline at end of file diff --git a/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/testDiscreteRadialRandom.st b/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/testDiscreteRadialRandom.st new file mode 100644 index 0000000..f79076a --- /dev/null +++ b/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/testDiscreteRadialRandom.st @@ -0,0 +1,9 @@ +tests +testDiscreteRadialRandom + + | menu item | + self chooseDiscreteRadial. + menu := self openMenu. + + item := menu findByLabel: 'Random'. + self shouldChangeColor: [item clickButton: item class leftButton with: 0 at: item effectiveBounds center]. \ No newline at end of file diff --git a/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/testDiscreteRadialRed.st b/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/testDiscreteRadialRed.st new file mode 100644 index 0000000..c449aa1 --- /dev/null +++ b/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/testDiscreteRadialRed.st @@ -0,0 +1,14 @@ +tests +testDiscreteRadialRed + + | menu item | + self chooseDiscreteRadial. + chooser model color: Color green. + menu := self openMenu. + + item := menu findByLabel: 'Red'. + item clickButton: item class leftButton with: 0 at: item effectiveBounds center. + item := menu findByLabel: '80%'. + item clickButton: item class leftButton with: 0 at: item effectiveBounds center. + + self assert: (chooser model color red - 0.8) abs < 0.1. \ No newline at end of file diff --git a/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/testPopUpMenu.st b/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/testPopUpMenu.st index f479941..13f6dae 100644 --- a/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/testPopUpMenu.st +++ b/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/testPopUpMenu.st @@ -3,14 +3,11 @@ testPopUpMenu "Smoke test" | menu | - (self subject findByLabel: 'Pop-up menu') in: [:button | - [button click] doWhileFalse: [button getModelState]]. + self choosePopUp. + self openMenu. - (MTFMorphWrapper newWith: { - (self subject findByPosition: self subject center) - morphs detectMax: [:m | m ownerChain size]}) - rightClick. self assert: [(menu := self findTopMorph) isKindOf: MenuMorph] description: ['Expected a MenuMorph but found {1}' format: {menu}]. + menu delete. \ No newline at end of file diff --git a/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/testPopUpRandom.st b/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/testPopUpRandom.st new file mode 100644 index 0000000..1e1fb9f --- /dev/null +++ b/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/testPopUpRandom.st @@ -0,0 +1,10 @@ +tests +testPopUpRandom + + | menu item | + self choosePopUp. + menu := self openMenu. + + item := menu findByCriteria: [:morph | [morph contents = 'random'] ifError: [false]]. + self shouldChangeColor: [item invokeWithEvent: (menu + generateMouseEvent: #mouseUp button: menu class leftButton modifiers: 0 on: item)]. \ No newline at end of file diff --git a/src/ColorContextMenu-Tests.package/ColorChooserTest.class/methodProperties.json b/src/ColorContextMenu-Tests.package/ColorChooserTest.class/methodProperties.json index 17ec2fb..9464145 100644 --- a/src/ColorContextMenu-Tests.package/ColorChooserTest.class/methodProperties.json +++ b/src/ColorContextMenu-Tests.package/ColorChooserTest.class/methodProperties.json @@ -2,11 +2,22 @@ "class" : { }, "instance" : { + "chooseDiscreteRadial" : "ct 2/11/2021 15:11", + "chooseMode:" : "ct 2/11/2021 15:10", + "choosePopUp" : "ct 2/11/2021 15:09", + "expectedFailures" : "ct 2/17/2021 19:53", + "findMenu" : "ct 2/11/2021 19:55", "findTopMorph" : "ct 2/5/2021 00:41", - "initialize" : "ct 2/5/2021 00:38", + "initialize" : "ct 2/11/2021 15:49", + "openMenu" : "ct 2/11/2021 19:55", "performTest" : "ct 2/4/2021 23:53", "setUp" : "ct 2/5/2021 00:38", - "tearDown" : "ct 2/5/2021 00:39", - "testDiscreteRadialMenu" : "ct 2/7/2021 21:27", + "shouldChangeColor:" : "ct 2/11/2021 15:27", + "tearDown" : "ct 2/11/2021 15:50", + "testDiscreteRadialDrag" : "ct 2/17/2021 19:54", + "testDiscreteRadialMenu" : "ct 2/11/2021 15:29", + "testDiscreteRadialRandom" : "ct 2/11/2021 15:46", + "testDiscreteRadialRed" : "ct 2/11/2021 19:52", "testOpen" : "ct 2/4/2021 19:26", - "testPopUpMenu" : "ct 2/5/2021 00:40" } } + "testPopUpMenu" : "ct 2/11/2021 15:30", + "testPopUpRandom" : "ct 2/11/2021 15:30" } } diff --git a/src/ColorContextMenu-Tests.package/ColorChooserTest.class/properties.json b/src/ColorContextMenu-Tests.package/ColorChooserTest.class/properties.json index 8eafe29..4526e40 100644 --- a/src/ColorContextMenu-Tests.package/ColorChooserTest.class/properties.json +++ b/src/ColorContextMenu-Tests.package/ColorChooserTest.class/properties.json @@ -7,7 +7,8 @@ "commentStamp" : "", "instvars" : [ "chooser", - "morphsToRestore" ], + "morphsToRestore", + "morphsToDelete" ], "name" : "ColorChooserTest", "pools" : [ ], From f977ceb70db674c6249857e8791175ad2f628c2e Mon Sep 17 00:00:00 2001 From: Christoph Thiede Date: Wed, 17 Feb 2021 21:58:45 +0100 Subject: [PATCH 18/31] Add missing extensions for test (1) --- .../instance/testDiscreteRadialDrag.st | 2 +- .../instance/testDiscreteRadialRandom.st | 2 +- .../instance/testDiscreteRadialRed.st | 4 ++-- .../ColorChooserTest.class/methodProperties.json | 6 +++--- .../instance/ccmClickButton.with.at..st | 9 +++++++++ ...cmGenerateMouseEvent.button.modifiers.position..st | 11 +++++++++++ .../ccmSendMouseEvent.button.modifiers.position..st | 9 +++++++++ .../MTFMorphWrapper.extension/methodProperties.json | 4 +++- 8 files changed, 39 insertions(+), 8 deletions(-) create mode 100644 src/ColorContextMenu-Tests.package/MTFMorphWrapper.extension/instance/ccmClickButton.with.at..st create mode 100644 src/ColorContextMenu-Tests.package/MTFMorphWrapper.extension/instance/ccmGenerateMouseEvent.button.modifiers.position..st create mode 100644 src/ColorContextMenu-Tests.package/MTFMorphWrapper.extension/instance/ccmSendMouseEvent.button.modifiers.position..st diff --git a/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/testDiscreteRadialDrag.st b/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/testDiscreteRadialDrag.st index c5c2d35..d22ae1f 100644 --- a/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/testDiscreteRadialDrag.st +++ b/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/testDiscreteRadialDrag.st @@ -14,4 +14,4 @@ testDiscreteRadialDrag item := menu findByLabel: 'Random'. item halt sendMouseMoveEventForButton: item class rightButton modifiers: 0 position: item effectiveBounds center. self flag: #todo. "We need more elaborate simulation, try out MorphicEventTests?" - self shouldChangeColor: [item sendMouseEvent: #mouseUp button: item class rightButton modifiers: 0 position: item effectiveBounds center]. \ No newline at end of file + self shouldChangeColor: [item ccmSendMouseEvent: #mouseUp button: item class rightButton modifiers: 0 position: item effectiveBounds center]. \ No newline at end of file diff --git a/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/testDiscreteRadialRandom.st b/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/testDiscreteRadialRandom.st index f79076a..9f4340e 100644 --- a/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/testDiscreteRadialRandom.st +++ b/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/testDiscreteRadialRandom.st @@ -6,4 +6,4 @@ testDiscreteRadialRandom menu := self openMenu. item := menu findByLabel: 'Random'. - self shouldChangeColor: [item clickButton: item class leftButton with: 0 at: item effectiveBounds center]. \ No newline at end of file + self shouldChangeColor: [item ccmClickButton: item class leftButton with: 0 at: item effectiveBounds center]. \ No newline at end of file diff --git a/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/testDiscreteRadialRed.st b/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/testDiscreteRadialRed.st index c449aa1..7758c50 100644 --- a/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/testDiscreteRadialRed.st +++ b/src/ColorContextMenu-Tests.package/ColorChooserTest.class/instance/testDiscreteRadialRed.st @@ -7,8 +7,8 @@ testDiscreteRadialRed menu := self openMenu. item := menu findByLabel: 'Red'. - item clickButton: item class leftButton with: 0 at: item effectiveBounds center. + item ccmClickButton: item class leftButton with: 0 at: item effectiveBounds center. item := menu findByLabel: '80%'. - item clickButton: item class leftButton with: 0 at: item effectiveBounds center. + item ccmClickButton: item class leftButton with: 0 at: item effectiveBounds center. self assert: (chooser model color red - 0.8) abs < 0.1. \ No newline at end of file diff --git a/src/ColorContextMenu-Tests.package/ColorChooserTest.class/methodProperties.json b/src/ColorContextMenu-Tests.package/ColorChooserTest.class/methodProperties.json index 9464145..3e39004 100644 --- a/src/ColorContextMenu-Tests.package/ColorChooserTest.class/methodProperties.json +++ b/src/ColorContextMenu-Tests.package/ColorChooserTest.class/methodProperties.json @@ -14,10 +14,10 @@ "setUp" : "ct 2/5/2021 00:38", "shouldChangeColor:" : "ct 2/11/2021 15:27", "tearDown" : "ct 2/11/2021 15:50", - "testDiscreteRadialDrag" : "ct 2/17/2021 19:54", + "testDiscreteRadialDrag" : "ct 2/17/2021 21:50", "testDiscreteRadialMenu" : "ct 2/11/2021 15:29", - "testDiscreteRadialRandom" : "ct 2/11/2021 15:46", - "testDiscreteRadialRed" : "ct 2/11/2021 19:52", + "testDiscreteRadialRandom" : "ct 2/17/2021 21:48", + "testDiscreteRadialRed" : "ct 2/17/2021 21:48", "testOpen" : "ct 2/4/2021 19:26", "testPopUpMenu" : "ct 2/11/2021 15:30", "testPopUpRandom" : "ct 2/11/2021 15:30" } } diff --git a/src/ColorContextMenu-Tests.package/MTFMorphWrapper.extension/instance/ccmClickButton.with.at..st b/src/ColorContextMenu-Tests.package/MTFMorphWrapper.extension/instance/ccmClickButton.with.at..st new file mode 100644 index 0000000..5cd0d54 --- /dev/null +++ b/src/ColorContextMenu-Tests.package/MTFMorphWrapper.extension/instance/ccmClickButton.with.at..st @@ -0,0 +1,9 @@ +*ColorContextMenu-Tests-interacting +ccmClickButton: button with: modifiers at: aPoint + + self morphs do: [:morph | + | wrapper | + wrapper := self createWrapperFor: {morph}. + wrapper ccmSendMouseEvent: #mouseDown button: button modifiers: modifiers position: aPoint. + self waitShort. + wrapper ccmSendMouseEvent: #mouseUp button: button modifiers: modifiers position: aPoint]. \ No newline at end of file diff --git a/src/ColorContextMenu-Tests.package/MTFMorphWrapper.extension/instance/ccmGenerateMouseEvent.button.modifiers.position..st b/src/ColorContextMenu-Tests.package/MTFMorphWrapper.extension/instance/ccmGenerateMouseEvent.button.modifiers.position..st new file mode 100644 index 0000000..8f24379 --- /dev/null +++ b/src/ColorContextMenu-Tests.package/MTFMorphWrapper.extension/instance/ccmGenerateMouseEvent.button.modifiers.position..st @@ -0,0 +1,11 @@ +*ColorContextMenu-Tests-private-event-generation +ccmGenerateMouseEvent: aSymbol button: aMouseButton modifiers: modifiersValue position: aPoint + "aSymbol can be: #mouseMove, #mouseUp, #mouseDown" + + ^MouseButtonEvent new + setType: aSymbol + position: aPoint + which: 0 + buttons: aMouseButton + modifiersValue + hand: self hand + stamp: Time millisecondClockValue \ No newline at end of file diff --git a/src/ColorContextMenu-Tests.package/MTFMorphWrapper.extension/instance/ccmSendMouseEvent.button.modifiers.position..st b/src/ColorContextMenu-Tests.package/MTFMorphWrapper.extension/instance/ccmSendMouseEvent.button.modifiers.position..st new file mode 100644 index 0000000..74ebe39 --- /dev/null +++ b/src/ColorContextMenu-Tests.package/MTFMorphWrapper.extension/instance/ccmSendMouseEvent.button.modifiers.position..st @@ -0,0 +1,9 @@ +*ColorContextMenu-Tests-interacting +ccmSendMouseEvent: eventType button: button modifiers: modifiers position: aPoint + + self morphs do: [:morph | + morph handleEvent: (self + ccmGenerateMouseEvent: eventType + button: button + modifiers: modifiers + position: aPoint)]. \ No newline at end of file diff --git a/src/ColorContextMenu-Tests.package/MTFMorphWrapper.extension/methodProperties.json b/src/ColorContextMenu-Tests.package/MTFMorphWrapper.extension/methodProperties.json index 600b645..4cfaf6c 100644 --- a/src/ColorContextMenu-Tests.package/MTFMorphWrapper.extension/methodProperties.json +++ b/src/ColorContextMenu-Tests.package/MTFMorphWrapper.extension/methodProperties.json @@ -3,4 +3,6 @@ "classesWithLabel" : "GT 5/10/2019 11:14", "yellowButton" : "CT 7/13/2019 15:56" }, "instance" : { - } } + "ccmClickButton:with:at:" : "ct 2/17/2021 21:50", + "ccmGenerateMouseEvent:button:modifiers:position:" : "ct 2/17/2021 21:49", + "ccmSendMouseEvent:button:modifiers:position:" : "ct 2/17/2021 21:49" } } From 6355460e78a390fd68aca2f253099da19370caed Mon Sep 17 00:00:00 2001 From: Christoph Thiede Date: Tue, 23 Feb 2021 00:29:56 +0100 Subject: [PATCH 19/31] RadialMenuMorph>>items & RadialMenuMorph>>allItems Revise protocol for items access for the purpose of avoiding null messages on RadialMenuSplitterMorph. --- .../RadialMenuMorph.class/instance/allItems.st | 6 ++++++ .../RadialMenuMorph.class/instance/doRadialLayout.st | 4 ++-- .../RadialMenuMorph.class/instance/items.st | 5 ++--- .../RadialMenuMorph.class/methodProperties.json | 5 +++-- 4 files changed, 13 insertions(+), 7 deletions(-) create mode 100644 src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/allItems.st diff --git a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/allItems.st b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/allItems.st new file mode 100644 index 0000000..dac93d5 --- /dev/null +++ b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/allItems.st @@ -0,0 +1,6 @@ +accessing +allItems + + ^ self submorphsSatisfying: [:morph | morph + isKindOf: RadialMenuItemMorph + orOf: RadialMenuSplitterMorph] \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/doRadialLayout.st b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/doRadialLayout.st index a4ce904..4bb7f96 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/doRadialLayout.st +++ b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/doRadialLayout.st @@ -2,14 +2,14 @@ layout doRadialLayout | flexValues flexPos angles | - flexValues := self items collect: [:item | item radialFlexWeight]. + flexValues := self allItems collect: [:item | item radialFlexWeight]. "Like a watch: CW starting at North" flexPos := 0. angles := (flexValues copyWith: 0) collect: [:flex | flexPos := flexPos + flex. self stopAngle - (self angleWidth * (flexPos - flex) / flexValues sum)]. - self items withIndexDo: [:item :index | + self allItems withIndexDo: [:item :index | item startAngle: (angles atWrap: index + 1) stopAngle: (angles at: index). diff --git a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/items.st b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/items.st index 1135130..c05d214 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/items.st +++ b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/items.st @@ -1,6 +1,5 @@ accessing items - ^ self submorphsSatisfying: [:morph | morph - isKindOf: RadialMenuItemMorph - orOf: RadialMenuSplitterMorph] \ No newline at end of file + ^ self submorphsSatisfying: [:morph | + morph isKindOf: RadialMenuItemMorph] \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/methodProperties.json b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/methodProperties.json index b5da59a..36790d1 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/methodProperties.json +++ b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/methodProperties.json @@ -6,20 +6,21 @@ "add:subMenu:" : "ct 2/9/2021 01:47", "addItemMorph:" : "Kiwi 2/9/2021 15:58", "addLine" : "ct 2/8/2021 19:23", + "allItems" : "ct 2/23/2021 00:20", "defaultBorderWidth" : "ct 2/7/2021 21:06", "defaultColor" : "ct 2/7/2021 21:05", "defaultExtent" : "ct 2/7/2021 21:07", "defaultInnerFraction" : "ct 2/5/2021 18:47", "delete" : "ct 2/7/2021 21:03", "doLayoutIn:" : "ct 2/7/2021 20:38", - "doRadialLayout" : "ct 2/8/2021 20:14", + "doRadialLayout" : "ct 2/23/2021 00:21", "handleEvent:" : "ct 2/7/2021 21:15", "handlesMouseDown:" : "ct 2/6/2021 00:19", "handlesMouseWheel:" : "ct 2/7/2021 02:10", "hasHalo:" : "ct 2/7/2021 21:01", "initialize" : "ct 2/8/2021 23:18", "innerFractionForItems" : "ct 2/7/2021 02:02", - "items" : "ct 2/8/2021 19:25", + "items" : "ct 2/23/2021 00:21", "mouseDown:" : "ct 2/7/2021 21:20", "mouseUp:" : "ct 2/7/2021 01:44", "mouseWheel:" : "ct 2/7/2021 02:04", From ee1229ce8aee95a67e281637367f957fe380161b Mon Sep 17 00:00:00 2001 From: Christoph Thiede Date: Tue, 23 Feb 2021 00:30:53 +0100 Subject: [PATCH 20/31] Remove obsolete #hasLabel Resolves https://github.com/LinqLover/ColorContextMenu/pull/9#discussion_r574517867. --- .../RadialMenuSplitterMorph.class/instance/hasLabel.st | 4 ---- .../RadialMenuSplitterMorph.class/methodProperties.json | 1 - 2 files changed, 5 deletions(-) delete mode 100644 src/ColorContextMenu-Core.package/RadialMenuSplitterMorph.class/instance/hasLabel.st diff --git a/src/ColorContextMenu-Core.package/RadialMenuSplitterMorph.class/instance/hasLabel.st b/src/ColorContextMenu-Core.package/RadialMenuSplitterMorph.class/instance/hasLabel.st deleted file mode 100644 index 9141098..0000000 --- a/src/ColorContextMenu-Core.package/RadialMenuSplitterMorph.class/instance/hasLabel.st +++ /dev/null @@ -1,4 +0,0 @@ -accessing -hasLabel - - ^ false \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuSplitterMorph.class/methodProperties.json b/src/ColorContextMenu-Core.package/RadialMenuSplitterMorph.class/methodProperties.json index aa9015d..e875d31 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuSplitterMorph.class/methodProperties.json +++ b/src/ColorContextMenu-Core.package/RadialMenuSplitterMorph.class/methodProperties.json @@ -2,6 +2,5 @@ "class" : { }, "instance" : { - "hasLabel" : "Kiwi 2/9/2021 15:40", "initialize" : "ct 2/8/2021 19:18", "radialFlexWeight" : "ct 2/8/2021 19:34" } } From c49139484b167ddbb8211037973be39efd76d76c Mon Sep 17 00:00:00 2001 From: Christoph Thiede Date: Tue, 23 Feb 2021 00:40:50 +0100 Subject: [PATCH 21/31] Rework mouse focus handling Submenus should be accessible by now. Aligned event handling implementation to MenuMorph. Improved yellow-button handling. --- .../instance/newMouseFocus..st | 13 +++++++++++++ .../HandMorph.extension/methodProperties.json | 5 +++++ .../HandMorph.extension/properties.json | 2 ++ .../instance/mouseFocusChange..st | 3 +++ .../Morph.extension/methodProperties.json | 5 +++++ .../Morph.extension/properties.json | 2 ++ .../instance/mouseMove..st | 5 +++-- .../methodProperties.json | 2 +- .../instance/handleEvent..st | 17 ----------------- .../instance/mouseDown..st | 5 +++-- .../instance/mouseFocusChange..st | 10 ++++++++++ .../RadialMenuMorph.class/instance/mouseUp..st | 3 +-- .../instance/processFocusEvent.using..st | 4 ++++ .../instance/yellowButtonActivity..st | 3 +++ .../RadialMenuMorph.class/methodProperties.json | 10 ++++++---- .../instance/handleMouseDown..st | 3 +++ .../methodProperties.json | 1 + 17 files changed, 65 insertions(+), 28 deletions(-) create mode 100644 src/ColorContextMenu-Core.package/HandMorph.extension/instance/newMouseFocus..st create mode 100644 src/ColorContextMenu-Core.package/HandMorph.extension/methodProperties.json create mode 100644 src/ColorContextMenu-Core.package/HandMorph.extension/properties.json create mode 100644 src/ColorContextMenu-Core.package/Morph.extension/instance/mouseFocusChange..st create mode 100644 src/ColorContextMenu-Core.package/Morph.extension/methodProperties.json create mode 100644 src/ColorContextMenu-Core.package/Morph.extension/properties.json delete mode 100644 src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/handleEvent..st create mode 100644 src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/mouseFocusChange..st create mode 100644 src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/processFocusEvent.using..st create mode 100644 src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/yellowButtonActivity..st create mode 100644 src/ColorContextMenu-Core.package/RadialMenuSplitterMorph.class/instance/handleMouseDown..st diff --git a/src/ColorContextMenu-Core.package/HandMorph.extension/instance/newMouseFocus..st b/src/ColorContextMenu-Core.package/HandMorph.extension/instance/newMouseFocus..st new file mode 100644 index 0000000..160199a --- /dev/null +++ b/src/ColorContextMenu-Core.package/HandMorph.extension/instance/newMouseFocus..st @@ -0,0 +1,13 @@ +*ColorContextMenu-Core-focus handling-override +newMouseFocus: aMorphOrNil + "Make the given morph the new mouse focus, canceling the previous mouse focus if any. If the argument is nil, the current mouse focus is cancelled." + + | newFocus oldFocus | + oldFocus := self mouseFocus. + newFocus := aMorphOrNil. + + self mouseFocus: newFocus. + + oldFocus == newFocus ifFalse: [ + oldFocus ifNotNil: [:m | m mouseFocusChange: false]. + newFocus ifNotNil: [:m | m mouseFocusChange: true]]. \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/HandMorph.extension/methodProperties.json b/src/ColorContextMenu-Core.package/HandMorph.extension/methodProperties.json new file mode 100644 index 0000000..67878fb --- /dev/null +++ b/src/ColorContextMenu-Core.package/HandMorph.extension/methodProperties.json @@ -0,0 +1,5 @@ +{ + "class" : { + }, + "instance" : { + "newMouseFocus:" : "ct 2/17/2021 20:24" } } diff --git a/src/ColorContextMenu-Core.package/HandMorph.extension/properties.json b/src/ColorContextMenu-Core.package/HandMorph.extension/properties.json new file mode 100644 index 0000000..f75019e --- /dev/null +++ b/src/ColorContextMenu-Core.package/HandMorph.extension/properties.json @@ -0,0 +1,2 @@ +{ + "name" : "HandMorph" } diff --git a/src/ColorContextMenu-Core.package/Morph.extension/instance/mouseFocusChange..st b/src/ColorContextMenu-Core.package/Morph.extension/instance/mouseFocusChange..st new file mode 100644 index 0000000..c74980e --- /dev/null +++ b/src/ColorContextMenu-Core.package/Morph.extension/instance/mouseFocusChange..st @@ -0,0 +1,3 @@ +*ColorContextMenu-Core-event handling-pseudo-override +mouseFocusChange: aBoolean + "The message is sent to a morph when its mouse focus change. The given argument indicates that the receiver is gaining mouse focus (versus losing) the mouse focus." \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/Morph.extension/methodProperties.json b/src/ColorContextMenu-Core.package/Morph.extension/methodProperties.json new file mode 100644 index 0000000..efd9a43 --- /dev/null +++ b/src/ColorContextMenu-Core.package/Morph.extension/methodProperties.json @@ -0,0 +1,5 @@ +{ + "class" : { + }, + "instance" : { + "mouseFocusChange:" : "ct 2/17/2021 20:24" } } diff --git a/src/ColorContextMenu-Core.package/Morph.extension/properties.json b/src/ColorContextMenu-Core.package/Morph.extension/properties.json new file mode 100644 index 0000000..58989fd --- /dev/null +++ b/src/ColorContextMenu-Core.package/Morph.extension/properties.json @@ -0,0 +1,2 @@ +{ + "name" : "Morph" } diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/mouseMove..st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/mouseMove..st index 3bc81ef..845b97c 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/mouseMove..st +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/mouseMove..st @@ -13,6 +13,7 @@ mouseMove: anEvent and: [m containsPoint: anEvent position]] ifFound: [:m | "Transfer mouse focus to new button. Detour through common owner and call #processMouseOver: to have enter/leave events sent correctly." - anEvent hand newMouseFocus: self owner. - anEvent hand mouseOverHandler processMouseOver: anEvent. + (m hasOwner: self) ifFalse: [ + anEvent hand newMouseFocus: self owner. + anEvent hand mouseOverHandler processMouseOver: anEvent]. self giveMouseFocusTo: m event: anEvent]. \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/methodProperties.json b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/methodProperties.json index 4e03a81..ac21ef4 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/methodProperties.json +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/methodProperties.json @@ -27,7 +27,7 @@ "mouseEnterDragging:" : "ct 2/7/2021 01:56", "mouseLeave:" : "ct 2/5/2021 23:00", "mouseLeaveDragging:" : "ct 5/5/2020 19:29", - "mouseMove:" : "ct 2/7/2021 21:11", + "mouseMove:" : "ct 2/22/2021 20:42", "mouseUp:" : "ct 2/7/2021 01:45", "privateInteractionState:" : "ct 2/8/2021 19:19", "radialFlexWeight" : "ct 2/8/2021 19:29", diff --git a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/handleEvent..st b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/handleEvent..st deleted file mode 100644 index 2dac689..0000000 --- a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/handleEvent..st +++ /dev/null @@ -1,17 +0,0 @@ -event handling -handleEvent: anEvent - - super handleEvent: anEvent. - - (anEvent hand mouseFocus == self - and: [anEvent isMouse] - and: [anEvent wasHandled not]) - ifTrue: [ - "Share focus events with children and keep #priorMouseFocus in sync." - | result | - result := self defaultEventDispatcher dispatchEvent: anEvent toSubmorphsOf: self. - (self hasMouseFocus: anEvent hand) ifFalse: [ - anEvent hand mouseFocus setProperty: #priorMouseFocus toValue: self]. - result == #rejected ifFalse: [^ result]]. - - ^ anEvent \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/mouseDown..st b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/mouseDown..st index 247cb23..68cb738 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/mouseDown..st +++ b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/mouseDown..st @@ -1,6 +1,7 @@ event handling mouseDown: anEvent - (self wantsToStayUp not and: [(self containsPoint: anEvent position) not]) ifTrue: [ + (self wantsToStayUp or: [self fullContainsPoint: anEvent position]) ifFalse: [ ^ self delete]. - anEvent wasHandled: false. \ No newline at end of file + + ^ super mouseDown: anEvent \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/mouseFocusChange..st b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/mouseFocusChange..st new file mode 100644 index 0000000..4af0a00 --- /dev/null +++ b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/mouseFocusChange..st @@ -0,0 +1,10 @@ +event handling +mouseFocusChange: aBoolean + + | focus | + self rootMenu == self ifFalse: [^ self]. + aBoolean ifTrue: [^ self]. + + focus := self currentHand mouseFocus. + (focus isKindOf: RadialMenuItemMorph) ifTrue: [ + focus setProperty: #priorMouseFocus toValue: self]. \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/mouseUp..st b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/mouseUp..st index d56366c..0ab0bac 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/mouseUp..st +++ b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/mouseUp..st @@ -2,5 +2,4 @@ event handling mouseUp: anEvent self wantsToStayUp ifFalse: [ - anEvent hand newMouseFocus: self]. - anEvent wasHandled: false. \ No newline at end of file + anEvent hand newMouseFocus: self]. \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/processFocusEvent.using..st b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/processFocusEvent.using..st new file mode 100644 index 0000000..bf7cf35 --- /dev/null +++ b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/processFocusEvent.using..st @@ -0,0 +1,4 @@ +event handling +processFocusEvent: evt using: dispatcher + + ^ dispatcher dispatchFocusEventFully: evt with: self \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/yellowButtonActivity..st b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/yellowButtonActivity..st new file mode 100644 index 0000000..f739bc7 --- /dev/null +++ b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/yellowButtonActivity..st @@ -0,0 +1,3 @@ +event handling +yellowButtonActivity: shiftState + "Do nothing. Menus on menus are a fancy meta tool, but would actually confuse too many people. ;(" \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/methodProperties.json b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/methodProperties.json index 36790d1..b5108ee 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/methodProperties.json +++ b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/methodProperties.json @@ -14,15 +14,15 @@ "delete" : "ct 2/7/2021 21:03", "doLayoutIn:" : "ct 2/7/2021 20:38", "doRadialLayout" : "ct 2/23/2021 00:21", - "handleEvent:" : "ct 2/7/2021 21:15", "handlesMouseDown:" : "ct 2/6/2021 00:19", "handlesMouseWheel:" : "ct 2/7/2021 02:10", "hasHalo:" : "ct 2/7/2021 21:01", "initialize" : "ct 2/8/2021 23:18", "innerFractionForItems" : "ct 2/7/2021 02:02", "items" : "ct 2/23/2021 00:21", - "mouseDown:" : "ct 2/7/2021 21:20", - "mouseUp:" : "ct 2/7/2021 01:44", + "mouseDown:" : "ct 2/17/2021 20:11", + "mouseFocusChange:" : "ct 2/17/2021 22:19", + "mouseUp:" : "ct 2/23/2021 00:32", "mouseWheel:" : "ct 2/7/2021 02:04", "outerFractionForItems" : "ct 2/7/2021 02:02", "popUpAt:forHand:in:" : "ct 2/7/2021 20:57", @@ -33,6 +33,7 @@ "privateRegisterItem:" : "Kiwi 2/8/2021 18:14", "privateRemove:" : "ct 2/7/2021 19:31", "privateUnregisterItem:" : "ct 2/7/2021 19:30", + "processFocusEvent:using:" : "ct 2/17/2021 20:03", "removeAllMorphs" : "ct 2/7/2021 19:31", "removeAllMorphsIn:" : "ct 2/7/2021 19:31", "scroll:" : "ct 2/11/2021 15:00", @@ -41,4 +42,5 @@ "target" : "ct 2/7/2021 20:55", "target:" : "ct 2/7/2021 20:55", "wantsToStayUp" : "ct 2/6/2021 00:05", - "wantsToStayUp:" : "ct 2/7/2021 21:01" } } + "wantsToStayUp:" : "ct 2/7/2021 21:01", + "yellowButtonActivity:" : "ct 2/23/2021 00:13" } } diff --git a/src/ColorContextMenu-Core.package/RadialMenuSplitterMorph.class/instance/handleMouseDown..st b/src/ColorContextMenu-Core.package/RadialMenuSplitterMorph.class/instance/handleMouseDown..st new file mode 100644 index 0000000..1eec021 --- /dev/null +++ b/src/ColorContextMenu-Core.package/RadialMenuSplitterMorph.class/instance/handleMouseDown..st @@ -0,0 +1,3 @@ +event handling +handleMouseDown: anEvent + "Not at all." \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuSplitterMorph.class/methodProperties.json b/src/ColorContextMenu-Core.package/RadialMenuSplitterMorph.class/methodProperties.json index e875d31..272be9d 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuSplitterMorph.class/methodProperties.json +++ b/src/ColorContextMenu-Core.package/RadialMenuSplitterMorph.class/methodProperties.json @@ -2,5 +2,6 @@ "class" : { }, "instance" : { + "handleMouseDown:" : "ct 2/22/2021 22:42", "initialize" : "ct 2/8/2021 19:18", "radialFlexWeight" : "ct 2/8/2021 19:34" } } From 06fb084e80e375e9e3a395b33984d2978cac7262 Mon Sep 17 00:00:00 2001 From: Christoph Thiede Date: Tue, 23 Feb 2021 00:45:50 +0100 Subject: [PATCH 22/31] Revise radial menu scrolling Fix mouse focus handling and update interactionState of hovered items. Don't scroll submenus but always keep them in sync with the #rootMenu. --- .../instance/ownerMenu.st | 6 ++++++ .../instance/rootMenu.st | 4 ++++ .../instance/startAngle.stopAngle..st | 4 +++- .../instance/subMenus.st | 4 ++++ .../methodProperties.json | 5 ++++- .../RadialMenuMorph.class/instance/rootMenu.st | 6 ++++++ .../RadialMenuMorph.class/instance/scroll..st | 15 +++++++++------ .../RadialMenuMorph.class/methodProperties.json | 3 ++- 8 files changed, 38 insertions(+), 9 deletions(-) create mode 100644 src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/ownerMenu.st create mode 100644 src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/rootMenu.st create mode 100644 src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/subMenus.st create mode 100644 src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/rootMenu.st diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/ownerMenu.st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/ownerMenu.st new file mode 100644 index 0000000..573e78b --- /dev/null +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/ownerMenu.st @@ -0,0 +1,6 @@ +accessing +ownerMenu + + ^ (self owner isKindOf: RadialMenuMorph) + ifTrue: [self owner] + ifFalse: [nil] \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/rootMenu.st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/rootMenu.st new file mode 100644 index 0000000..21d3a7f --- /dev/null +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/rootMenu.st @@ -0,0 +1,4 @@ +accessing +rootMenu + + ^ self ownerMenu ifNotNil: #rootMenu \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/startAngle.stopAngle..st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/startAngle.stopAngle..st index c25e1d5..f7b7823 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/startAngle.stopAngle..st +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/startAngle.stopAngle..st @@ -2,4 +2,6 @@ accessing startAngle: radialNumberStart stopAngle: radialNumberStop super startAngle: radialNumberStart stopAngle: radialNumberStop. - self updateLabelAngle. \ No newline at end of file + + self updateLabelAngle. + self subMenus do: [:menu | menu centerAngle: self centerAngle]. \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/subMenus.st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/subMenus.st new file mode 100644 index 0000000..48e4082 --- /dev/null +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/subMenus.st @@ -0,0 +1,4 @@ +submorphs-accessing +subMenus + + ^ self submorphsSatisfying: [:m | m isKindOf: RadialMenuMorph] \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/methodProperties.json b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/methodProperties.json index ac21ef4..80d1f58 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/methodProperties.json +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/methodProperties.json @@ -29,12 +29,15 @@ "mouseLeaveDragging:" : "ct 5/5/2020 19:29", "mouseMove:" : "ct 2/22/2021 20:42", "mouseUp:" : "ct 2/7/2021 01:45", + "ownerMenu" : "ct 2/22/2021 23:47", "privateInteractionState:" : "ct 2/8/2021 19:19", "radialFlexWeight" : "ct 2/8/2021 19:29", "radialFlexWeight:" : "ct 2/8/2021 19:34", + "rootMenu" : "ct 2/22/2021 23:47", "setBaseColorForLabel:" : "Kiwi 2/9/2021 18:48", "siblingButtons" : "ct 2/5/2021 23:16", - "startAngle:stopAngle:" : "Kiwi 2/9/2021 16:18", + "startAngle:stopAngle:" : "ct 2/23/2021 00:44", + "subMenus" : "ct 2/22/2021 23:56", "takeMouseFocus:" : "ct 5/16/2020 18:43", "target" : "ct 2/5/2021 23:35", "target:" : "ct 2/5/2021 23:35", diff --git a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/rootMenu.st b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/rootMenu.st new file mode 100644 index 0000000..9df6ef5 --- /dev/null +++ b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/rootMenu.st @@ -0,0 +1,6 @@ +accessing +rootMenu + + ^ (self owner isKindOf: RadialMenuItemMorph) + ifTrue: [self owner rootMenu] + ifFalse: [self] \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/scroll..st b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/scroll..st index fc8d4ca..6c130c3 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/scroll..st +++ b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/scroll..st @@ -1,6 +1,10 @@ event handling scroll: count + self rootMenu == self ifFalse: [ + "Don't rotate from submenus. Would be too confusing to pull the rug from under your own feet. (Also, it make's synchronization of startAngle with submenus much easier.)" + ^ self]. + "AnimPropertyAnimation new duration: 50; target: self; @@ -11,11 +15,10 @@ scroll: count start: #deleteWhenFinished." self centerAngle: self centerAngle + (count * 0.2 / (Float pi * 2)). - self submorphs - select: [:morph | morph isKindOf: RadialMenuMorph] - thenDo: [:menu | - menu centerAngle: menu centerAngle + (count * 0.2 / (Float pi * 2))]. - - self handleEvent: self currentEvent asMouseMove. + self currentHand mouseFocus in: [:mouseFocus | + (mouseFocus notNil and: [mouseFocus hasOwner: self]) ifTrue: [ + "Give the focused item a chance to pass focus to another item. See RadialMenuMorph >> #mouseMove:. Make sure to update layout first." + self fullBounds. + self currentHand sendMouseEvent: self currentEvent asMouseMove]]. self flag: #todo. "fix hover selection when mouse button is still down" \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/methodProperties.json b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/methodProperties.json index b5108ee..37c483d 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/methodProperties.json +++ b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/methodProperties.json @@ -36,7 +36,8 @@ "processFocusEvent:using:" : "ct 2/17/2021 20:03", "removeAllMorphs" : "ct 2/7/2021 19:31", "removeAllMorphsIn:" : "ct 2/7/2021 19:31", - "scroll:" : "ct 2/11/2021 15:00", + "rootMenu" : "ct 2/17/2021 23:10", + "scroll:" : "ct 2/18/2021 01:48", "scrollDown:" : "ct 2/7/2021 02:05", "scrollUp:" : "ct 2/7/2021 02:05", "target" : "ct 2/7/2021 20:55", From 49395d882ce24501c91924e22f1e97fc0cfc0dc0 Mon Sep 17 00:00:00 2001 From: Christoph Thiede Date: Tue, 23 Feb 2021 00:55:00 +0100 Subject: [PATCH 23/31] Revise submenu opening and closing - Discard submenus when a competing item has been selected - Moved submenu construction and handling into RadialMenuItemMorph and improved polymorphy with MenuMorph - Drag-to-open submenus now works analogously to MenuMorphs --- .../instance/closeCompetingSubmenus.st | 4 +++ .../instance/closeSubmenus.st | 4 +++ .../instance/closeSubmenusBesides..st | 9 ++++++ .../instance/doButtonAction.st | 6 ++-- .../instance/hasSubMenu.st | 4 +++ .../instance/interactionState..st | 7 +++++ .../instance/interactionState.st | 4 +++ .../instance/mouseDown..st | 8 ++++- .../instance/mouseEnter..st | 2 +- .../instance/mouseEnterDragging..st | 12 +++++++- .../instance/mouseLeave..st | 2 +- .../instance/mouseUp..st | 7 +++-- .../instance/noteNewOwner..st | 8 +++++ .../instance/openSubmenu..st | 15 ++++++++++ .../instance/privateInteractionState..st | 1 + .../instance/removedMorph..st | 7 +++++ .../instance/siblingButtons.st | 2 +- .../instance/subMenu..st | 4 +++ .../instance/updateLabelAngle.st | 2 +- .../instance/veryDeepInner..st | 10 +++++++ .../methodProperties.json | 29 +++++++++++++------ .../RadialMenuItemMorph.class/properties.json | 3 +- .../instance/add.subMenu..st | 19 ++++-------- .../instance/closeSubmenus.st | 4 +++ .../instance/closeSubmenusBesides..st | 4 +++ .../RadialMenuMorph.class/instance/delete.st | 3 ++ .../instance/privateRegisterItem..st | 4 ++- .../methodProperties.json | 8 +++-- 28 files changed, 153 insertions(+), 39 deletions(-) create mode 100644 src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/closeCompetingSubmenus.st create mode 100644 src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/closeSubmenus.st create mode 100644 src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/closeSubmenusBesides..st create mode 100644 src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/hasSubMenu.st create mode 100644 src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/interactionState..st create mode 100644 src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/interactionState.st create mode 100644 src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/noteNewOwner..st create mode 100644 src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/openSubmenu..st create mode 100644 src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/removedMorph..st create mode 100644 src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/subMenu..st create mode 100644 src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/veryDeepInner..st create mode 100644 src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/closeSubmenus.st create mode 100644 src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/closeSubmenusBesides..st diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/closeCompetingSubmenus.st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/closeCompetingSubmenus.st new file mode 100644 index 0000000..e8a3452 --- /dev/null +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/closeCompetingSubmenus.st @@ -0,0 +1,4 @@ +submorphs-add/remove +closeCompetingSubmenus + + ^ (self rootMenu ifNil: [self]) closeSubmenusBesides: self \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/closeSubmenus.st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/closeSubmenus.st new file mode 100644 index 0000000..6b32339 --- /dev/null +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/closeSubmenus.st @@ -0,0 +1,4 @@ +submorphs-add/remove +closeSubmenus + + self subMenus do: #delete. \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/closeSubmenusBesides..st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/closeSubmenusBesides..st new file mode 100644 index 0000000..ac5a209 --- /dev/null +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/closeSubmenusBesides..st @@ -0,0 +1,9 @@ +submorphs-add/remove +closeSubmenusBesides: aRadialMenuItemMorph + + self == aRadialMenuItemMorph ifTrue: [^ self]. + + self subMenus do: [:subMenu | + (aRadialMenuItemMorph hasOwner: subMenu) + ifTrue: [subMenu closeSubmenusBesides: aRadialMenuItemMorph] + ifFalse: [subMenu delete]]. \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/doButtonAction.st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/doButtonAction.st index f93e028..f6ed3a1 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/doButtonAction.st +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/doButtonAction.st @@ -1,6 +1,8 @@ button doButtonAction - self action ifNotNil: [:evaluable | - evaluable cull: self target]. + self action ifNotNil: [:evaluableOrSubmenu | + self hasSubMenu ifTrue: [ + ^ self openSubmenu: evaluableOrSubmenu]. + evaluableOrSubmenu cull: self target]. self triggerEvent: #invokeItem with: self. \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/hasSubMenu.st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/hasSubMenu.st new file mode 100644 index 0000000..90e9e57 --- /dev/null +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/hasSubMenu.st @@ -0,0 +1,4 @@ +testing +hasSubMenu + + ^ self action isKindOf: RadialMenuMorph \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/interactionState..st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/interactionState..st new file mode 100644 index 0000000..8a9bb56 --- /dev/null +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/interactionState..st @@ -0,0 +1,7 @@ +styling +interactionState: aSymbol + + (self interactionState = #active and: [self subMenus notEmpty]) + ifTrue: [^ self]. + + ^ self privateInteractionState: aSymbol \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/interactionState.st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/interactionState.st new file mode 100644 index 0000000..a1ea703 --- /dev/null +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/interactionState.st @@ -0,0 +1,4 @@ +styling +interactionState + + ^ interactionState \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/mouseDown..st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/mouseDown..st index 27320e6..eb1cf6c 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/mouseDown..st +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/mouseDown..st @@ -1,4 +1,10 @@ event handling mouseDown: anEvent - self privateInteractionState: #active. \ No newline at end of file + self interactionState: #active. + + self closeCompetingSubmenus. + self hasSubMenu ifTrue: [ + self doButtonAction]. + + self interactionState: #active. \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/mouseEnter..st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/mouseEnter..st index fca2451..9f37770 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/mouseEnter..st +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/mouseEnter..st @@ -1,4 +1,4 @@ event handling mouseEnter: anEvent - self privateInteractionState: #hover. \ No newline at end of file + self interactionState: #hover. \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/mouseEnterDragging..st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/mouseEnterDragging..st index 280d86d..729e6bd 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/mouseEnterDragging..st +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/mouseEnterDragging..st @@ -1,5 +1,15 @@ event handling mouseEnterDragging: anEvent + | wasActive | self takeMouseFocus: anEvent. - self privateInteractionState: #active. \ No newline at end of file + + wasActive := self interactionState = #active. + self interactionState: #active. + + wasActive ifFalse: [ + self closeCompetingSubmenus. + self hasSubMenu ifTrue: [ + self doButtonAction]. + + self interactionState: #active]. \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/mouseLeave..st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/mouseLeave..st index 21a37e1..e7ed6db 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/mouseLeave..st +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/mouseLeave..st @@ -1,4 +1,4 @@ event handling mouseLeave: anEvent - self privateInteractionState: nil. \ No newline at end of file + self interactionState: nil. \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/mouseUp..st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/mouseUp..st index 2e73a98..648703d 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/mouseUp..st +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/mouseUp..st @@ -2,7 +2,8 @@ event handling mouseUp: anEvent (self containsPoint: anEvent position) ifFalse: [ - ^ self privateInteractionState: nil]. + ^ self interactionState: nil]. - self privateInteractionState: #hover. - self doButtonAction. \ No newline at end of file + self interactionState: #hover. + self hasSubMenu ifFalse: [ + self doButtonAction]. \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/noteNewOwner..st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/noteNewOwner..st new file mode 100644 index 0000000..3a3bf74 --- /dev/null +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/noteNewOwner..st @@ -0,0 +1,8 @@ +submorphs-accessing +noteNewOwner: aMorph + + target ifNil: [target := self target]. + + super noteNewOwner: aMorph. + + allButtons := nil. \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/openSubmenu..st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/openSubmenu..st new file mode 100644 index 0000000..64970db --- /dev/null +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/openSubmenu..st @@ -0,0 +1,15 @@ +button +openSubmenu: aRadialMenuMorph + + | outerRadius | + aRadialMenuMorph owner == self ifTrue: [ + ^ aRadialMenuMorph delete]. + + outerRadius := (self ownerMenu ifNil: [self]) outerRadius. + aRadialMenuMorph + innerRadius: outerRadius outerRadius: outerRadius * 2 - self innerRadius; + center: self center. + aRadialMenuMorph + centerAngle: self centerAngle + angleWidth: Float pi / 2. + self addMorph: aRadialMenuMorph. \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/privateInteractionState..st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/privateInteractionState..st index 087c4d6..8827011 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/privateInteractionState..st +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/privateInteractionState..st @@ -1,6 +1,7 @@ styling privateInteractionState: aSymbol + interactionState := aSymbol. self color: (aSymbol caseOf: { [nil] -> [self baseColor]. [#hover] -> [self baseColor lighter]. diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/removedMorph..st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/removedMorph..st new file mode 100644 index 0000000..de04366 --- /dev/null +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/removedMorph..st @@ -0,0 +1,7 @@ +submorphs-add/remove +removedMorph: aMorph + + (aMorph isKindOf: RadialMenuMorph) ifTrue: [ + self interactionState: nil]. + + ^ super removedMorph: aMorph \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/siblingButtons.st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/siblingButtons.st index b9c6465..6506e4c 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/siblingButtons.st +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/siblingButtons.st @@ -3,5 +3,5 @@ siblingButtons "Make a list of buttons (including the receiver) for mouseMove feedback. This allows a simple radio-button effect among the button submorphs of a given morph." ^ allButtons ifNil: [allButtons := - self owner submorphsSatisfying: [:m | + (self rootMenu ifNil: [self owner]) allMorphs select: [:m | m species = self species and: [m isLocked not]]] \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/subMenu..st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/subMenu..st new file mode 100644 index 0000000..c124c69 --- /dev/null +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/subMenu..st @@ -0,0 +1,4 @@ +accessing +subMenu: aRadialMenuMorph + + ^ self action: aRadialMenuMorph \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/updateLabelAngle.st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/updateLabelAngle.st index 427446a..a400e8f 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/updateLabelAngle.st +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/updateLabelAngle.st @@ -1,4 +1,4 @@ -as yet unclassified +layout updateLabelAngle | pi angleBelow2Pi | diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/veryDeepInner..st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/veryDeepInner..st new file mode 100644 index 0000000..c32ffd5 --- /dev/null +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/veryDeepInner..st @@ -0,0 +1,10 @@ +copying +veryDeepInner: deepCopier + + target ifNil: [target := self target]. + + super veryDeepInner: deepCopier. + + self closeSubmenus. + allButtons := nil. "Cache" + interactionState := nil. "Cache" \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/methodProperties.json b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/methodProperties.json index 80d1f58..8fa73e6 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/methodProperties.json +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/methodProperties.json @@ -7,38 +7,49 @@ "baseColor" : "Kiwi 2/9/2021 17:45", "baseColor:" : "Kiwi 2/9/2021 17:37", "basicLabelMorph" : "Kiwi 2/9/2021 18:54", + "closeCompetingSubmenus" : "ct 2/23/2021 00:07", + "closeSubmenus" : "ct 2/22/2021 23:55", + "closeSubmenusBesides:" : "ct 2/23/2021 00:00", "defaultBaseColor" : "Kiwi 2/9/2021 17:44", "defaultBorderWidth" : "ct 2/7/2021 21:12", - "doButtonAction" : "Kiwi 2/9/2021 14:31", + "doButtonAction" : "ct 2/17/2021 23:22", "doLayoutIn:" : "ct 2/5/2021 23:22", "giveMouseFocusTo:event:" : "ct 2/7/2021 01:35", "handleMouseUp:" : "ct 2/7/2021 01:28", "handlesMouseDown:" : "ct 2/5/2021 23:03", "handlesMouseOver:" : "ct 2/5/2021 22:59", "handlesMouseOverDragging:" : "jrp 7/3/2005 18:13", + "hasSubMenu" : "ct 2/17/2021 23:22", "initialize" : "Kiwi 2/9/2021 15:25", + "interactionState" : "ct 2/23/2021 00:06", + "interactionState:" : "ct 2/23/2021 00:06", "label" : "Kiwi 2/9/2021 15:09", "label:" : "Kiwi 2/9/2021 18:47", "labelAngle" : "Kiwi 2/9/2021 15:10", "labelAngle:" : "Kiwi 2/9/2021 15:10", "labelMorph" : "ct 2/5/2021 18:55", - "mouseDown:" : "ct 2/5/2021 23:04", - "mouseEnter:" : "ct 2/7/2021 01:40", - "mouseEnterDragging:" : "ct 2/7/2021 01:56", - "mouseLeave:" : "ct 2/5/2021 23:00", + "mouseDown:" : "ct 2/23/2021 00:10", + "mouseEnter:" : "ct 2/23/2021 00:06", + "mouseEnterDragging:" : "ct 2/23/2021 00:10", + "mouseLeave:" : "ct 2/23/2021 00:06", "mouseLeaveDragging:" : "ct 5/5/2020 19:29", "mouseMove:" : "ct 2/22/2021 20:42", - "mouseUp:" : "ct 2/7/2021 01:45", + "mouseUp:" : "ct 2/23/2021 00:06", + "noteNewOwner:" : "ct 2/18/2021 00:01", + "openSubmenu:" : "ct 2/22/2021 23:48", "ownerMenu" : "ct 2/22/2021 23:47", - "privateInteractionState:" : "ct 2/8/2021 19:19", + "privateInteractionState:" : "ct 2/22/2021 20:37", "radialFlexWeight" : "ct 2/8/2021 19:29", "radialFlexWeight:" : "ct 2/8/2021 19:34", + "removedMorph:" : "ct 2/23/2021 00:10", "rootMenu" : "ct 2/22/2021 23:47", "setBaseColorForLabel:" : "Kiwi 2/9/2021 18:48", - "siblingButtons" : "ct 2/5/2021 23:16", + "siblingButtons" : "ct 2/22/2021 20:14", "startAngle:stopAngle:" : "ct 2/23/2021 00:44", + "subMenu:" : "ct 2/17/2021 22:49", "subMenus" : "ct 2/22/2021 23:56", "takeMouseFocus:" : "ct 5/16/2020 18:43", "target" : "ct 2/5/2021 23:35", "target:" : "ct 2/5/2021 23:35", - "updateLabelAngle" : "Kiwi 2/9/2021 16:12" } } + "updateLabelAngle" : "Kiwi 2/9/2021 16:12", + "veryDeepInner:" : "ct 2/22/2021 23:43" } } diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/properties.json b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/properties.json index 4457298..a50455a 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/properties.json +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/properties.json @@ -11,7 +11,8 @@ "target", "messageSend", "action", - "baseColor" ], + "baseColor", + "interactionState" ], "name" : "RadialMenuItemMorph", "pools" : [ ], diff --git a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/add.subMenu..st b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/add.subMenu..st index 49bfee1..c0b69c5 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/add.subMenu..st +++ b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/add.subMenu..st @@ -1,16 +1,7 @@ construction -add: aString subMenu: aRadialMenuMorph +add: aString subMenu: evaluable - | item | - item := nil. - self flag: #refactor. "ct: Consider moving this logic into RadialMenuMorph" - ^ item := self add: aString action: [ - aRadialMenuMorph - innerRadius: self outerRadius outerRadius: - self outerRadius * 2 - self innerRadius; - center: self center. - item ifNotNil: [ - aRadialMenuMorph - centerAngle: item centerAngle - angleWidth: Float pi / 2]. - self addMorph: aRadialMenuMorph openInWorld] \ No newline at end of file + ^ self addItemMorph: (RadialMenuItemMorph new + label: aString; + subMenu: evaluable; + yourself) \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/closeSubmenus.st b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/closeSubmenus.st new file mode 100644 index 0000000..5ba7338 --- /dev/null +++ b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/closeSubmenus.st @@ -0,0 +1,4 @@ +control +closeSubmenus + + self items do: #closeSubmenus. \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/closeSubmenusBesides..st b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/closeSubmenusBesides..st new file mode 100644 index 0000000..479c352 --- /dev/null +++ b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/closeSubmenusBesides..st @@ -0,0 +1,4 @@ +control +closeSubmenusBesides: aRadialMenuItemMorph + + self items do: [:item | item closeSubmenusBesides: aRadialMenuItemMorph]. \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/delete.st b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/delete.st index 8dab3b1..e6f86ca 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/delete.st +++ b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/delete.st @@ -1,6 +1,9 @@ submorphs-add/remove delete + self closeSubmenus. + super delete. + self wantsToStayUp ifTrue: [ self currentHand newKeyboardFocus: originalFocusHolder]. \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/privateRegisterItem..st b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/privateRegisterItem..st index b625485..d3997d4 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/privateRegisterItem..st +++ b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/privateRegisterItem..st @@ -1,4 +1,6 @@ private privateRegisterItem: aRadialMenuItemMorph - self flag: 'discuss' "aRadialMenuItemMorph when: #invokeItem send: #delete to: self." \ No newline at end of file + self flag: #discuss. "Edge case for top-level menus?" + "self rootMenu == self ifFalse: [ + aRadialMenuItemMorph when: #invokeItem send: #delete to: self]." \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/methodProperties.json b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/methodProperties.json index 37c483d..60cbf1c 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/methodProperties.json +++ b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/methodProperties.json @@ -3,15 +3,17 @@ "indicateKeyboardFocus" : "ct 2/7/2021 17:59" }, "instance" : { "add:action:" : "Kiwi 2/9/2021 14:07", - "add:subMenu:" : "ct 2/9/2021 01:47", + "add:subMenu:" : "ct 2/17/2021 23:19", "addItemMorph:" : "Kiwi 2/9/2021 15:58", "addLine" : "ct 2/8/2021 19:23", "allItems" : "ct 2/23/2021 00:20", + "closeSubmenus" : "ct 2/17/2021 23:03", + "closeSubmenusBesides:" : "ct 2/17/2021 23:03", "defaultBorderWidth" : "ct 2/7/2021 21:06", "defaultColor" : "ct 2/7/2021 21:05", "defaultExtent" : "ct 2/7/2021 21:07", "defaultInnerFraction" : "ct 2/5/2021 18:47", - "delete" : "ct 2/7/2021 21:03", + "delete" : "ct 2/23/2021 00:34", "doLayoutIn:" : "ct 2/7/2021 20:38", "doRadialLayout" : "ct 2/23/2021 00:21", "handlesMouseDown:" : "ct 2/6/2021 00:19", @@ -30,7 +32,7 @@ "popUpForHand:in:" : "ct 2/8/2021 19:53", "popUpInWorld" : "ct 2/8/2021 19:54", "popUpInWorld:" : "ct 2/8/2021 19:54", - "privateRegisterItem:" : "Kiwi 2/8/2021 18:14", + "privateRegisterItem:" : "ct 2/23/2021 00:52", "privateRemove:" : "ct 2/7/2021 19:31", "privateUnregisterItem:" : "ct 2/7/2021 19:30", "processFocusEvent:using:" : "ct 2/17/2021 20:03", From e9ccd8a3b7d36a7e60ea7b5e7f46e02cac706681 Mon Sep 17 00:00:00 2001 From: Christoph Thiede Date: Tue, 23 Feb 2021 00:55:42 +0100 Subject: [PATCH 24/31] Implement RadialMenuItemMorph>>knownName --- .../RadialMenuItemMorph.class/instance/knownName.st | 4 ++++ .../RadialMenuItemMorph.class/methodProperties.json | 1 + 2 files changed, 5 insertions(+) create mode 100644 src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/knownName.st diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/knownName.st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/knownName.st new file mode 100644 index 0000000..b240948 --- /dev/null +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/knownName.st @@ -0,0 +1,4 @@ +accessing +knownName + + ^ self label asString \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/methodProperties.json b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/methodProperties.json index 8fa73e6..0339996 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/methodProperties.json +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/methodProperties.json @@ -23,6 +23,7 @@ "initialize" : "Kiwi 2/9/2021 15:25", "interactionState" : "ct 2/23/2021 00:06", "interactionState:" : "ct 2/23/2021 00:06", + "knownName" : "ct 2/22/2021 23:35", "label" : "Kiwi 2/9/2021 15:09", "label:" : "Kiwi 2/9/2021 18:47", "labelAngle" : "Kiwi 2/9/2021 15:10", From a0d715d87e94a624042346b84af2b5d18333210b Mon Sep 17 00:00:00 2001 From: Christoph Thiede Date: Tue, 23 Feb 2021 00:56:27 +0100 Subject: [PATCH 25/31] Fix a slip from 6355460 --- .../RadialMenuMorph.class/instance/addItemMorph..st | 3 ++- .../RadialMenuMorph.class/methodProperties.json | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/addItemMorph..st b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/addItemMorph..st index f24aee0..3457ba4 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/addItemMorph..st +++ b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/addItemMorph..st @@ -4,7 +4,8 @@ addItemMorph: aRadialMenuItemMorph aRadialMenuItemMorph layoutFrame: LayoutFrame fullFrame; hResizing: #spaceFill; vResizing: #spaceFill. - self privateRegisterItem: aRadialMenuItemMorph. + (aRadialMenuItemMorph isKindOf: RadialMenuItemMorph) ifTrue: [ + self privateRegisterItem: aRadialMenuItemMorph]. self addMorphBack: aRadialMenuItemMorph. self addDependent: aRadialMenuItemMorph. diff --git a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/methodProperties.json b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/methodProperties.json index 60cbf1c..4e314cb 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/methodProperties.json +++ b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/methodProperties.json @@ -4,7 +4,7 @@ "instance" : { "add:action:" : "Kiwi 2/9/2021 14:07", "add:subMenu:" : "ct 2/17/2021 23:19", - "addItemMorph:" : "Kiwi 2/9/2021 15:58", + "addItemMorph:" : "ct 2/23/2021 00:51", "addLine" : "ct 2/8/2021 19:23", "allItems" : "ct 2/23/2021 00:20", "closeSubmenus" : "ct 2/17/2021 23:03", From 17ce4b0be9cc3398a37c445535ad86b829265839 Mon Sep 17 00:00:00 2001 From: Christoph Thiede Date: Tue, 23 Feb 2021 00:57:16 +0100 Subject: [PATCH 26/31] Recategorizations --- .../Number.extension/instance/sinCos.st | 2 +- .../Point.extension/instance/sinCos.st | 2 +- .../Point.extension/instance/squared.st | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ColorContextMenu-Core.package/Number.extension/instance/sinCos.st b/src/ColorContextMenu-Core.package/Number.extension/instance/sinCos.st index fd8b07c..70ae83f 100644 --- a/src/ColorContextMenu-Core.package/Number.extension/instance/sinCos.st +++ b/src/ColorContextMenu-Core.package/Number.extension/instance/sinCos.st @@ -1,4 +1,4 @@ -*ColorContextMenu-Core-mathematical functions-override +*ColorContextMenu-Core-mathematical functions-pseudo-override sinCos ^ self asPoint sinCos \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/Point.extension/instance/sinCos.st b/src/ColorContextMenu-Core.package/Point.extension/instance/sinCos.st index 9e31a2e..0dde71c 100644 --- a/src/ColorContextMenu-Core.package/Point.extension/instance/sinCos.st +++ b/src/ColorContextMenu-Core.package/Point.extension/instance/sinCos.st @@ -1,4 +1,4 @@ -*ColorContextMenu-Core-polar coordinates-override +*ColorContextMenu-Core-polar coordinates-pseudo-override sinCos ^ x sin @ y cos \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/Point.extension/instance/squared.st b/src/ColorContextMenu-Core.package/Point.extension/instance/squared.st index 8bb20a9..88e5ae8 100644 --- a/src/ColorContextMenu-Core.package/Point.extension/instance/squared.st +++ b/src/ColorContextMenu-Core.package/Point.extension/instance/squared.st @@ -1,4 +1,4 @@ -*ColorContextMenu-Core-arithmetic-override +*ColorContextMenu-Core-arithmetic-pseudo-override squared ^ self dotProduct: self \ No newline at end of file From 6b8da91401067baa5219f33b3ccdfb35d107d0da Mon Sep 17 00:00:00 2001 From: Christoph Thiede <38782922+LinqLover@users.noreply.github.com> Date: Tue, 23 Feb 2021 10:05:41 +0100 Subject: [PATCH 27/31] Remove question comment --- .../instance/buildDiscreteMenu.attribute.levels..st | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/buildDiscreteMenu.attribute.levels..st b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/buildDiscreteMenu.attribute.levels..st index 913fe92..13f11d8 100644 --- a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/buildDiscreteMenu.attribute.levels..st +++ b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/buildDiscreteMenu.attribute.levels..st @@ -2,7 +2,6 @@ menus buildDiscreteMenu: menuFactory attribute: aSymbol levels: levels | menu setter | - self flag: 'Warum heißt es hier menuFactory und nicht aRadialMenuMorph?'. menu := menuFactory value. setter := ('set{1}:' format: {aSymbol capitalized}) asSymbol. @@ -10,4 +9,4 @@ buildDiscreteMenu: menuFactory attribute: aSymbol levels: levels menu add: ('{1}%' format: {(level / (levels - 1) * 100) rounded}) action: [ self perform: setter with: level / (levels - 1)]]. - ^ menu \ No newline at end of file + ^ menu From 93e183836906f1d561716a564a20db261ebaa3ed Mon Sep 17 00:00:00 2001 From: Christoph Thiede <38782922+LinqLover@users.noreply.github.com> Date: Tue, 23 Feb 2021 10:06:35 +0100 Subject: [PATCH 28/31] Minor refactorings --- .../ColorChooserMorph.class/methodProperties.json | 2 +- .../RadialMenuItemMorph.class/instance/updateLabelAngle.st | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/methodProperties.json b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/methodProperties.json index 0ba0d8f..c5f536c 100644 --- a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/methodProperties.json +++ b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/methodProperties.json @@ -4,7 +4,7 @@ "instance" : { "buildDiscreteMenu:" : "Kiwi 2/9/2021 14:33", "buildDiscreteMenu:attribute:" : "Kiwi 2/9/2021 14:17", - "buildDiscreteMenu:attribute:levels:" : "Kiwi 2/9/2021 14:46", + "buildDiscreteMenu:attribute:levels:" : "ct 2/8/2021 19:44", "color:" : "ct 2/4/2021 15:37", "contextMenu" : "ct 2/8/2021 19:46", "defaultNumberOfLevels" : "Kiwi 2/9/2021 14:16", diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/updateLabelAngle.st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/updateLabelAngle.st index a400e8f..b793646 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/updateLabelAngle.st +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/updateLabelAngle.st @@ -4,7 +4,6 @@ updateLabelAngle | pi angleBelow2Pi | pi := Float pi. angleBelow2Pi := self centerAngle - (self centerAngle / (2 * pi)) floor. - angleBelow2Pi < pi - ifTrue: [ self labelAngle: self centerAngle - (0.5 * pi) ] - ifFalse: [ self labelAngle: self centerAngle + (0.5 * pi) ] - \ No newline at end of file + self labelAngle: (angleBelow2Pi < pi + ifTrue: [self centerAngle - (0.5 * pi)] + ifFalse: [self centerAngle + (0.5 * pi)] From ef873d0659c8212630d61cf2ea83f919e6e83493 Mon Sep 17 00:00:00 2001 From: Christoph Thiede Date: Tue, 23 Feb 2021 10:33:13 +0100 Subject: [PATCH 29/31] Move label colorization out of RadialMenuItemMorph and revise #labelMorph to return TransformMorph Resolves https://github.com/LinqLover/ColorContextMenu/pull/9/files#r574515275 and https://github.com/LinqLover/ColorContextMenu/pull/9/files#r574514223 --- .../instance/addToMenu.coloredItem.action..st | 9 +++++++++ .../instance/addToMenu.coloredItem.subMenu..st | 9 +++++++++ .../instance/buildDiscreteMenu..st | 9 +++++---- .../instance/colorForLabel..st | 13 +++++++++++++ .../methodProperties.json | 5 ++++- .../instance/baseColor..st | 3 ++- .../RadialMenuItemMorph.class/instance/label..st | 3 +-- .../RadialMenuItemMorph.class/instance/label.st | 2 +- .../instance/labelAngle..st | 2 +- .../instance/labelAngle.st | 2 +- .../instance/labelMorph.st | 2 +- .../instance/setBaseColorForLabel..st | 16 ---------------- .../instance/updateLabelAngle.st | 2 +- .../methodProperties.json | 13 ++++++------- 14 files changed, 54 insertions(+), 36 deletions(-) create mode 100644 src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/addToMenu.coloredItem.action..st create mode 100644 src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/addToMenu.coloredItem.subMenu..st create mode 100644 src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/colorForLabel..st delete mode 100644 src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/setBaseColorForLabel..st diff --git a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/addToMenu.coloredItem.action..st b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/addToMenu.coloredItem.action..st new file mode 100644 index 0000000..2731efa --- /dev/null +++ b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/addToMenu.coloredItem.action..st @@ -0,0 +1,9 @@ +menus +addToMenu: menu coloredItem: label action: action + + | item | + item := menu add: label subMenu: action. + + (item isKindOf: RadialMenuItemMorph) ifTrue: [ + (self colorForLabel: label) ifNotNil: [:labelColor | + item baseColor: (labelColor mixed: 0.6 with: item defaultBaseColor)]]. \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/addToMenu.coloredItem.subMenu..st b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/addToMenu.coloredItem.subMenu..st new file mode 100644 index 0000000..b29bae6 --- /dev/null +++ b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/addToMenu.coloredItem.subMenu..st @@ -0,0 +1,9 @@ +menus +addToMenu: menu coloredItem: label subMenu: subMenu + + | item | + item := menu add: label subMenu: subMenu. + + (item isKindOf: RadialMenuItemMorph) ifTrue: [ + (self colorForLabel: label) ifNotNil: [:labelColor | + item baseColor: (labelColor mixed: 0.6 with: item defaultBaseColor)]]. \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/buildDiscreteMenu..st b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/buildDiscreteMenu..st index 5afb99b..6c6d621 100644 --- a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/buildDiscreteMenu..st +++ b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/buildDiscreteMenu..st @@ -7,14 +7,15 @@ buildDiscreteMenu: menuFactory "These buttons do not open a submenu; hence they are handled separately." menu add: 'random' action: #setRandom; - addLine; - add: 'lighter' action: #setLighter; - add: 'darker' action: #setDarker; addLine. + self + addToMenu: menu coloredItem: 'lighter' action: #setLighter; + addToMenu: menu coloredItem: 'darker' action: #setDarker. + menu addLine. self labelGroups do: [:group | group do: [:attrib | - menu add: attrib asString subMenu: ( + self addToMenu: menu coloredItem: attrib asString subMenu: ( self buildDiscreteMenu: menuFactory attribute: attrib)]. menu addLine]. diff --git a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/colorForLabel..st b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/colorForLabel..st new file mode 100644 index 0000000..d64b7e5 --- /dev/null +++ b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/colorForLabel..st @@ -0,0 +1,13 @@ +menus +colorForLabel: label + + | symbol | + symbol := label asSymbol. + + symbol = #darker ifTrue: [ ^ Color veryVeryDarkGray ]. + symbol = #lighter ifTrue: [ ^ Color lightGray ]. + symbol = #random ifTrue: [ ^ nil ]. + + (Color class canUnderstand: symbol) ifTrue: [ ^ Color perform: symbol ]. + + ^ nil \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/methodProperties.json b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/methodProperties.json index c5f536c..06cdab4 100644 --- a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/methodProperties.json +++ b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/methodProperties.json @@ -2,10 +2,13 @@ "class" : { }, "instance" : { - "buildDiscreteMenu:" : "Kiwi 2/9/2021 14:33", + "addToMenu:coloredItem:action:" : "ct 2/23/2021 10:28", + "addToMenu:coloredItem:subMenu:" : "ct 2/23/2021 10:28", + "buildDiscreteMenu:" : "ct 2/23/2021 10:29", "buildDiscreteMenu:attribute:" : "Kiwi 2/9/2021 14:17", "buildDiscreteMenu:attribute:levels:" : "ct 2/8/2021 19:44", "color:" : "ct 2/4/2021 15:37", + "colorForLabel:" : "ct 2/23/2021 10:25", "contextMenu" : "ct 2/8/2021 19:46", "defaultNumberOfLevels" : "Kiwi 2/9/2021 14:16", "discreteRadialMenu" : "Kiwi 2/9/2021 15:54", diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/baseColor..st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/baseColor..st index 3ed6503..afc3c30 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/baseColor..st +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/baseColor..st @@ -1,4 +1,5 @@ accessing baseColor: aColor - ^ baseColor := aColor \ No newline at end of file + baseColor := aColor. + self interactionState: self interactionState. \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/label..st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/label..st index 0a8dd99..e816c25 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/label..st +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/label..st @@ -1,5 +1,4 @@ accessing label: aStringOrText - self labelMorph submorphs first contents: aStringOrText capitalized. - self setBaseColorForLabel: aStringOrText asSymbol \ No newline at end of file + self labelMorph contents: aStringOrText capitalized. \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/label.st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/label.st index 393bdd1..fa81614 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/label.st +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/label.st @@ -1,4 +1,4 @@ accessing label - ^ self labelMorph submorphs first contents \ No newline at end of file + ^ self labelMorph contents \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/labelAngle..st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/labelAngle..st index fe5b955..34cddb3 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/labelAngle..st +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/labelAngle..st @@ -1,4 +1,4 @@ accessing labelAngle: aNumber "given in radiants" - self labelMorph angle: aNumber \ No newline at end of file + labelMorph angle: aNumber. \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/labelAngle.st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/labelAngle.st index df1d2df..e919b5c 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/labelAngle.st +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/labelAngle.st @@ -1,4 +1,4 @@ accessing labelAngle "given in radiants" - self labelMorph angle \ No newline at end of file + ^ labelMorph angle \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/labelMorph.st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/labelMorph.st index 85860b0..05c4e38 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/labelMorph.st +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/labelMorph.st @@ -1,4 +1,4 @@ private labelMorph - ^ labelMorph \ No newline at end of file + ^ labelMorph firstSubmorph \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/setBaseColorForLabel..st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/setBaseColorForLabel..st deleted file mode 100644 index f9d6c7b..0000000 --- a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/setBaseColorForLabel..st +++ /dev/null @@ -1,16 +0,0 @@ -accessing -setBaseColorForLabel: aSymbol - - | rawColor | - - rawColor := self defaultBaseColor. - (Color class canUnderstand: aSymbol) ifTrue: [ rawColor := Color perform: aSymbol ]. - - aSymbol = #darker ifTrue: [ rawColor := Color veryVeryDarkGray ]. - aSymbol = #lighter ifTrue: [ rawColor := Color lightGray ]. - aSymbol = #random ifTrue: [ rawColor := self defaultBaseColor ]. - - self baseColor: (rawColor mixed: 0.6 with: self defaultBaseColor). - - self privateInteractionState: nil. - diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/updateLabelAngle.st b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/updateLabelAngle.st index b793646..e472bd6 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/updateLabelAngle.st +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/instance/updateLabelAngle.st @@ -6,4 +6,4 @@ updateLabelAngle angleBelow2Pi := self centerAngle - (self centerAngle / (2 * pi)) floor. self labelAngle: (angleBelow2Pi < pi ifTrue: [self centerAngle - (0.5 * pi)] - ifFalse: [self centerAngle + (0.5 * pi)] + ifFalse: [self centerAngle + (0.5 * pi)]). \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/methodProperties.json b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/methodProperties.json index 0339996..fbaf3ca 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/methodProperties.json +++ b/src/ColorContextMenu-Core.package/RadialMenuItemMorph.class/methodProperties.json @@ -5,7 +5,7 @@ "action" : "ct 2/7/2021 19:21", "action:" : "ct 2/7/2021 19:21", "baseColor" : "Kiwi 2/9/2021 17:45", - "baseColor:" : "Kiwi 2/9/2021 17:37", + "baseColor:" : "ct 2/23/2021 10:17", "basicLabelMorph" : "Kiwi 2/9/2021 18:54", "closeCompetingSubmenus" : "ct 2/23/2021 00:07", "closeSubmenus" : "ct 2/22/2021 23:55", @@ -24,11 +24,11 @@ "interactionState" : "ct 2/23/2021 00:06", "interactionState:" : "ct 2/23/2021 00:06", "knownName" : "ct 2/22/2021 23:35", - "label" : "Kiwi 2/9/2021 15:09", - "label:" : "Kiwi 2/9/2021 18:47", - "labelAngle" : "Kiwi 2/9/2021 15:10", - "labelAngle:" : "Kiwi 2/9/2021 15:10", - "labelMorph" : "ct 2/5/2021 18:55", + "label" : "ct 2/23/2021 10:08", + "label:" : "ct 2/23/2021 10:18", + "labelAngle" : "ct 2/23/2021 10:07", + "labelAngle:" : "ct 2/23/2021 10:08", + "labelMorph" : "ct 2/23/2021 10:08", "mouseDown:" : "ct 2/23/2021 00:10", "mouseEnter:" : "ct 2/23/2021 00:06", "mouseEnterDragging:" : "ct 2/23/2021 00:10", @@ -44,7 +44,6 @@ "radialFlexWeight:" : "ct 2/8/2021 19:34", "removedMorph:" : "ct 2/23/2021 00:10", "rootMenu" : "ct 2/22/2021 23:47", - "setBaseColorForLabel:" : "Kiwi 2/9/2021 18:48", "siblingButtons" : "ct 2/22/2021 20:14", "startAngle:stopAngle:" : "ct 2/23/2021 00:44", "subMenu:" : "ct 2/17/2021 22:49", From 777fc4c7801fd91fffe32fc9648f89a646c79bc9 Mon Sep 17 00:00:00 2001 From: Christoph Thiede Date: Tue, 23 Feb 2021 10:34:29 +0100 Subject: [PATCH 30/31] Nuke redundant #addDependent: Resolves https://github.com/LinqLover/ColorContextMenu/pull/9/files#r574517583 --- .../RadialMenuMorph.class/instance/addItemMorph..st | 1 - .../RadialMenuMorph.class/methodProperties.json | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/addItemMorph..st b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/addItemMorph..st index 3457ba4..d57547d 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/addItemMorph..st +++ b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/addItemMorph..st @@ -8,7 +8,6 @@ addItemMorph: aRadialMenuItemMorph self privateRegisterItem: aRadialMenuItemMorph]. self addMorphBack: aRadialMenuItemMorph. - self addDependent: aRadialMenuItemMorph. self doRadialLayout. ^ aRadialMenuItemMorph \ No newline at end of file diff --git a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/methodProperties.json b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/methodProperties.json index 4e314cb..378bec1 100644 --- a/src/ColorContextMenu-Core.package/RadialMenuMorph.class/methodProperties.json +++ b/src/ColorContextMenu-Core.package/RadialMenuMorph.class/methodProperties.json @@ -4,7 +4,7 @@ "instance" : { "add:action:" : "Kiwi 2/9/2021 14:07", "add:subMenu:" : "ct 2/17/2021 23:19", - "addItemMorph:" : "ct 2/23/2021 00:51", + "addItemMorph:" : "ct 2/23/2021 10:34", "addLine" : "ct 2/8/2021 19:23", "allItems" : "ct 2/23/2021 00:20", "closeSubmenus" : "ct 2/17/2021 23:03", From bd3ea35273f83553a86e96b0e30a1037a0588a14 Mon Sep 17 00:00:00 2001 From: Christoph Thiede Date: Tue, 23 Feb 2021 10:44:27 +0100 Subject: [PATCH 31/31] Fix a copy'n'paste slip for context submenus --- .../instance/addToMenu.coloredItem.action..st | 2 +- .../ColorChooserMorph.class/methodProperties.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/addToMenu.coloredItem.action..st b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/addToMenu.coloredItem.action..st index 2731efa..8570538 100644 --- a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/addToMenu.coloredItem.action..st +++ b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/instance/addToMenu.coloredItem.action..st @@ -2,7 +2,7 @@ menus addToMenu: menu coloredItem: label action: action | item | - item := menu add: label subMenu: action. + item := menu add: label action: action. (item isKindOf: RadialMenuItemMorph) ifTrue: [ (self colorForLabel: label) ifNotNil: [:labelColor | diff --git a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/methodProperties.json b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/methodProperties.json index 06cdab4..55903fb 100644 --- a/src/ColorContextMenu-Core.package/ColorChooserMorph.class/methodProperties.json +++ b/src/ColorContextMenu-Core.package/ColorChooserMorph.class/methodProperties.json @@ -2,7 +2,7 @@ "class" : { }, "instance" : { - "addToMenu:coloredItem:action:" : "ct 2/23/2021 10:28", + "addToMenu:coloredItem:action:" : "ct 2/23/2021 10:43", "addToMenu:coloredItem:subMenu:" : "ct 2/23/2021 10:28", "buildDiscreteMenu:" : "ct 2/23/2021 10:29", "buildDiscreteMenu:attribute:" : "Kiwi 2/9/2021 14:17",