Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spike for 'context sensitive actions' #222

Draft
wants to merge 23 commits into
base: development
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ helpTexts
add: 'browse'->'Open a given class in the Browser.';
add: 'fileout'->'Generates a .st file in Resources of squeak image Folder';
add: 'open'->'Open an app, tool or morph';
add: 'saverepo'->'Saves to Repository with a working copy';
add: 'inspect'->'Open Inspector for an object';
add: 'explore'-> 'Open Explorer for an object or all intances of a given class';
add: 'front'-> 'Bring a given window to the front';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
filtering
keywords
^ Set newFrom: {'run'. 'browse'. 'fileout'.
'open'. 'saverepo'. 'do'.
'open'. 'do'.
'inspect'. 'explore'. '='.
'front'. 'expand'. 'collapse'.
'contract'. 'close' }
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"class" : {
"helpTexts" : "b 5/29/2021 09:18",
"keywords" : "lm 5/26/2021 19:46" },
"helpTexts" : "lm 7/6/2021 20:54",
"keywords" : "lm 7/6/2021 20:53" },
"instance" : {
"filter:given:" : "pw 8/4/2020 00:30" } }
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ handleActivationKeyEvent: anEvent

isTrigger
ifTrue: [
self saveLastFocus.
lastActivationKeyTimestamp := nil.
self toggleVisibility: anEvent ]
ifFalse: [
Expand Down
4 changes: 4 additions & 0 deletions packages/Algernon.package/ALGCore.class/instance/lastFocus.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
lastFocus

^ lastFocus
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
updating
saveLastFocus

lastFocus := ActiveHand keyboardFocus
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"firstOnSearchStack" : "jRo 6/14/2020 18:21",
"firstStep:" : "DS 5/21/2017 16:43",
"grabFocus:" : "b 6/2/2021 00:59",
"handleActivationKeyEvent:" : "NM 6/30/2021 14:43",
"handleActivationKeyEvent:" : "NL 7/7/2021 18:14",
"handleAsQuickAccess:" : "NM 6/7/2021 21:22",
"handleListenEvent:" : "NM 6/30/2021 14:45",
"handleTextEntered:" : "rk 8/3/2020 22:16",
Expand Down Expand Up @@ -95,6 +95,7 @@
"keyStroke:" : "NL 6/7/2021 20:05",
"lastActivationKeyTimestamp" : "fsa 6/16/2021 14:22",
"lastActivationKeyTimestamp:" : "fsa 6/16/2021 14:22",
"lastFocus" : "NL 7/7/2021 18:14",
"lastInputString" : "jRo 5/27/2020 17:35",
"lastInputString:" : "jRo 5/27/2020 17:35",
"moveCursorToEnd" : "beb 5/23/2020 15:58",
Expand All @@ -113,6 +114,7 @@
"registeredWithSystem" : "LK 7/14/2016 15:04",
"reset" : "beb 6/11/2020 15:13",
"resetFilteringThreshold" : "DS 5/21/2017 16:55",
"saveLastFocus" : "NL 7/7/2021 18:14",
"searchStack" : "J.J. 7/11/2015 21:40",
"searchStack:" : "J.J. 7/11/2015 21:40",
"selectNext" : "J.J. 7/27/2015 21:41",
Expand Down
3 changes: 2 additions & 1 deletion packages/Algernon.package/ALGCore.class/properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"textField",
"firstStep",
"lastInputString",
"lastActivationKeyTimestamp" ],
"lastActivationKeyTimestamp",
"lastFocus" ],
"name" : "ALGCore",
"pools" : [
],
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ initializeItems
addAll: ALGSettingsType algertemList;
addAll: ALGClassType algertemList;
addAll: ALGMethodType algertemList;
addAll: ALGStaticWorldMenuType algertemList;
addAll: ALGWindowOperationsType algertemList;
yourself
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
accessing
dynamicItems
^ (ALGExpressionType algertemList: self controller),
ALGDynamicWorldMenuType algertemList,
ALGWorldMenuType algertemList,
ALGWindowType algertemList
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"defaultItems" : "J.J. 7/27/2015 17:37",
"defaultSearchLevel" : "OH 5/20/2021 13:59",
"filters" : "beb 5/20/2020 17:57",
"initializeItems" : "lm 5/19/2021 10:54",
"initializeItems" : "NL 7/6/2021 11:59",
"maximumItemsToCompute" : "b 5/28/2021 15:43",
"newIn:" : "J.J. 7/30/2015 22:00",
"searchDelimeter" : "J.J. 7/28/2015 17:11" },
Expand All @@ -18,7 +18,7 @@
"controller:" : "beb 7/15/2020 16:47",
"createCategoriesFor:" : "jRo 7/2/2020 01:01",
"defaultItems" : "fsa 5/18/2021 17:37",
"dynamicItems" : "lm 5/25/2021 21:23",
"dynamicItems" : "NL 7/5/2021 19:32",
"filterItems:for:" : "OH 5/20/2021 14:37",
"filteredStaticItemsFor:" : "OH 5/20/2021 14:35",
"getCachedStaticItemsFor:" : "OH 5/20/2021 14:37",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
instance creation
newFrom: aMorph

^ self new
morph: aMorph;
yourself
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
instance creation
newFrom: aMorph inCategory: aString

^ (self newFrom: aMorph)
category: aString;
yourself

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
accessing
allEntries
| entries |

entries := OrderedCollection new.

entries addAll: (self menuEntries inject: OrderedCollection new into:
[ :accumulator :entry | accumulator addAll: {entry}, entry allEntries; yourself ]).

^ entries
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
category: aString
category := aString
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
category
^ category
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ accessing
enabledMenuSubmorphs

"Some submorphs can't be disabled (e.g. line, ...)"
^ self menuSubmorphs select: [:menuItem | (menuItem class canUnderstand: #isEnabled) not or: [menuItem isEnabled]]
^ (self menuSubmorphs, self subMenuSubmorphs) select: [:menuItem | (menuItem class canUnderstand: #isEnabled) not or: [menuItem isEnabled]]

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
action
execute

self morph doButtonAction
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
hasEntries

^ self menuEntries isEmpty not
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
ifDynamicItem: aBlock

self isDynamicItem ifTrue: [aBlock value]
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
ifDynamicMenu: aBlock

self isDynamicMenu ifTrue: [aBlock value]

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
isDynamicItem

^ self morph isKindOf: UpdatingMenuItemMorph
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
accessing
isDynamicMenu

| subMenu |
subMenu := self subMenuIfAbsent: [ ^ false ].

^ (subMenu isKindOf: DockingBarUpdatingMenuMorph)
or: [subMenu isKindOf: UpdatingMenuMorph]
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
isEnabled

^ (self morph class canUnderstand: #isEnabled) not or: [self morph isEnabled]
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
accessing
isMenu
"Some entries in the docking bar (project name) are not a real menu, but are only distinct by not having a menu morph"
^ self morph isNil not

self subMenuIfAbsent: [ ^ false ].

^ true
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
isValid

^ (self morph isKindOf: DockingBarItemMorph) or: [self morph isKindOf: MenuItemMorph]
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
accessing
menuEntries

(self isDynamic and: [self name = 'Windows'])
ifTrue: [^ self excludeDynamicWindows].

^ self enabledMenuSubmorphs
^ self menuSubmorphs
collect: [ :morph | ALGNamedWorldMenuEntry newFrom: morph inCategory: self category ]
thenSelect: [ :entry | entry isValid and: [entry isEnabled] ]
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
accessing
menuSubmorphs

^ self morph submorphs
| subMenu |

subMenu := self subMenuIfAbsent: [ ^ OrderedCollection new ].

self ifDynamicMenu: [subMenu updateMenu].
^ OrderedCollection newFrom: subMenu submorphs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
accessing
name
^ name
self ifDynamicItem: [self morph updateContents].
^ self morph contents
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
selector
^ (self morph selector
ifNil: [ String new.]) asString
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
accessing
subMenuIfAbsent: aBlock

^ (self morph class canUnderstand: #subMenu)
ifTrue: [ self morph subMenu ifNil: [^ aBlock value] ]
ifFalse: [ aBlock value ]
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
{
"class" : {
"newFrom:name:" : "NL 6/4/2021 16:16" },
"newFrom:" : "NL 7/12/2021 23:09",
"newFrom:inCategory:" : "lm 7/6/2021 22:54" },
"instance" : {
"enabledMenuSubmorphs" : "fsa 6/27/2021 11:29",
"excludeDynamicWindows" : "fsa 6/27/2021 10:55",
"isDynamic" : "fsa 6/27/2021 10:40",
"isMenu" : "fsa 6/27/2021 10:40",
"menuEntries" : "fsa 6/27/2021 10:56",
"menuSubmorphs" : "fsa 6/27/2021 11:09",
"allEntries" : "b 7/12/2021 15:15",
"category" : "NL 7/5/2021 19:20",
"category:" : "NL 7/5/2021 19:21",
"enabledMenuSubmorphs" : "lm 7/4/2021 22:36",
"execute" : "NL 7/6/2021 12:16",
"hasEntries" : "NL 7/5/2021 19:42",
"ifDynamicItem:" : "NL 7/12/2021 23:24",
"ifDynamicMenu:" : "NL 7/12/2021 23:24",
"isDynamicItem" : "b 7/12/2021 18:54",
"isDynamicMenu" : "b 7/12/2021 18:41",
"isEnabled" : "NL 7/5/2021 17:48",
"isMenu" : "NL 7/5/2021 17:54",
"isValid" : "b 7/5/2021 18:43",
"menuEntries" : "b 7/12/2021 15:04",
"menuSubmorphs" : "b 7/12/2021 20:26",
"morph" : "NL 6/4/2021 16:15",
"morph:" : "NL 6/4/2021 16:15",
"name" : "NL 6/4/2021 16:15",
"name:" : "NL 6/4/2021 16:15" } }
"name" : "b 7/12/2021 20:28",
"selector" : "NL 7/12/2021 23:12",
"subMenuIfAbsent:" : "b 7/5/2021 18:18" } }
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
],
"commentStamp" : "fsa 6/27/2021 10:38",
"instvars" : [
"name",
"morph" ],
"morph",
"category" ],
"name" : "ALGNamedWorldMenuEntry",
"pools" : [
],
Expand Down

This file was deleted.

Loading