Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ element editWithPyramid.
space editWithPyramid.
```

You can edit in Pyramid an opened BlSpace with `F12` keyboard shortcut, for that open a BlElement with `openInNewSpaceWithPyramidShortcut`.
You can edit in Pyramid all opened BlSpace with `F12` keyboard shortcut, this feature can be disable in the settings.

## Plugins

Expand Down
4 changes: 3 additions & 1 deletion src/Pyramid-Bloc/PyramidContextMenuPlugin.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ Class {
{ #category : #'class initialization' }
PyramidContextMenuPlugin class >> initialize [

self flag:'labordep: Why remove before add ?'.
"Remove the plugin in case of already install (reset)"
PyramidPluginManager uniqueInstance removePlugin: self.

"Add the plugin"
PyramidPluginManager uniqueInstance addPlugin: self
]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
Class {
#name : #PyramidEditOnRunningSystemSettings,
#superclass : #Object,
#category : #'Pyramid-plugin-edit-on-running'
#category : #'Pyramid-Bloc-plugin-edit-on-running'
}

{ #category : #dialog }
PyramidEditOnRunningSystemSettings class >> canEditDialog: aBuilder [

^ self theme newRowIn: self for: {
"Default shortcut is F12 because it is usually use to enter dev mode in webbrowsers"
self theme buttonLabelForText: 'with shortcut: F12' translated.
self theme buttonLabelForText: 'with key shortcut: F12' translated.
}
]

Expand All @@ -31,10 +31,10 @@ PyramidEditOnRunningSystemSettings class >> editOnRunningSettingOn: aBuilder [

(aBuilder setting: #editOnRunning)
parent: #pyramid;
label: '(Not working) Can edit opened BlSpaces';
label: 'Can edit Bloc opened windows';
target: self;
dialog: [self canEditDialog: aBuilder];
description: 'Setup availability to edit opened BlSpace in a Pyramid window.
description: 'Setup availability to edit opened BlSpace window in Pyramid editor.
Press the required shortcut key(s) on a focused BlSpace window to edit it in Pyramid.'
]

Expand Down
171 changes: 171 additions & 0 deletions src/Pyramid-Bloc/PyramidPluginEditOnRunning.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
Class {
#name : #PyramidPluginEditOnRunning,
#superclass : #Object,
#traits : 'TPyramidPlugin',
#classTraits : 'TPyramidPlugin classTrait',
#instVars : [
'editOnRunning'
],
#classInstVars : [
'editOnRunning',
'spaceIds',
'shortcut',
'shortcutFork',
'keyCombination'
],
#category : #'Pyramid-Bloc-plugin-edit-on-running'
}

{ #category : #private }
PyramidPluginEditOnRunning class >> addShortcutInSpace: aSpace [

(self canEditSpace: aSpace) ifFalse:[ ^ self ].
(self spaceIds includes: aSpace id) ifTrue:[ ^ self ].

self spaceIds add: aSpace id.
aSpace root addShortcut: self shortcut
]

{ #category : #testing }
PyramidPluginEditOnRunning class >> canEditSpace: aSpace [

aSpace ifNil:[ ^ false ].

"Not edit the editor space or already edited to prevent cycling"
aSpace userData at: #pyramid_isEditor ifPresent:[ ^ false ].
aSpace userData at: #pyramid_isOnEdition ifPresent:[ ^ false ].

^ true
]

{ #category : #initialization }
PyramidPluginEditOnRunning class >> cleanUp: anObject [

"do nothing"
]

{ #category : #private }
PyramidPluginEditOnRunning class >> doShortcutAction: anEvent [

| space editor whenClosedDo |

self flag:'labordep: this is a temporary processing because this fork is due to a Bloc opened issue'.
(shortcutFork notNil and:[ shortcutFork isTerminated not ]) ifTrue:[ ^ self ].

shortcutFork := [

self editOnRunning ifTrue:[
space := anEvent source space.
(self canEditSpace: space) ifTrue:[
editor := space editWithPyramid.
whenClosedDo := editor window whenClosedDo.
editor window whenClosedDo: [ whenClosedDo value ].
].
].

] forkAt: Processor userBackgroundPriority named: 'Pyramid edit-on-running plugin shortcut'
]

{ #category : #accessing }
PyramidPluginEditOnRunning class >> editOnRunning [

^ editOnRunning ifNil: [ editOnRunning := true ]
]

{ #category : #accessing }
PyramidPluginEditOnRunning class >> editOnRunning: aBoolean [

editOnRunning := aBoolean
]

{ #category : #initialization }
PyramidPluginEditOnRunning class >> install [
"Do some stuff here when the plugin used class oriented behavior"

self installBlUniverseListeners.

]

{ #category : #'universe management' }
PyramidPluginEditOnRunning class >> installBlUniverseListeners [

Beacon instance
when: BlParallelUniverseOpenSpaceRequestSignal
send: #receiveBlParallelUniverseHostSpaceSignal:
to: self
]

{ #category : #accessing }
PyramidPluginEditOnRunning class >> keyCombination [

^ keyCombination ifNil: [
keyCombination := (BlKeyCombination builder key: KeyboardKey F12) build ]
]

{ #category : #'universe management' }
PyramidPluginEditOnRunning class >> receiveBlParallelUniverseHostSpaceSignal: anEvent [

BlSpace spaceWithId: anEvent spaceId do: [ :e | self addShortcutInSpace: e ]
]

{ #category : #private }
PyramidPluginEditOnRunning class >> removeShortcutInSpace: aSpace [

aSpace ifNil: [ ^ self ].

aSpace root removeShortcut: self shortcut.
self spaceIds remove: aSpace id.
]

{ #category : #accessing }
PyramidPluginEditOnRunning class >> shortcut [

^ shortcut ifNil: [
shortcut := BlShortcutWithAction new
name: 'Pyramid edition shortcut';
combination: self keyCombination;
action: [ :event | self doShortcutAction: event ] ]
]

{ #category : #accessing }
PyramidPluginEditOnRunning class >> spaceIds [

^ spaceIds ifNil: [ spaceIds := Set new ]
]

{ #category : #initialization }
PyramidPluginEditOnRunning class >> uninstall [
"Undo some stuff here when the plugin used class oriented behavior"

self uninstallBlUniverseListeners.

self spaceIds do:[ :id | BlSpace spaceWithId: id do: [ :e | self removeShortcutInSpace: e ] ].
self spaceIds removeAll.
shortcutFork ifNotNil: [ shortcutFork terminate. shortcutFork := nil ].
shortcut := nil.
keyCombination := nil.
]

{ #category : #'universe management' }
PyramidPluginEditOnRunning class >> uninstallBlUniverseListeners [

Beacon instance unsubscribe: self
]

{ #category : #adding }
PyramidPluginEditOnRunning >> addPanelsOn: aPyramidSimpleWindow [

"do nothing"
]

{ #category : #actions }
PyramidPluginEditOnRunning >> configureBuilder: aPyramidEditorBuilder [

"do nothing"
]

{ #category : #connecting }
PyramidPluginEditOnRunning >> connectOn: aPyramidEditor [

"do nothing"
]
4 changes: 2 additions & 2 deletions src/Pyramid-Bloc/PyramidSavePlugin.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ Class {
PyramidSavePlugin class >> openOn: aCollectionOfBlElement saveModel: aSaveModel [

| editor savePlugin |
editor := PyramidEditorBuilder makeEditor.
editor := PyramidEditor buildEditor.
savePlugin := editor plugins select: [ :each | each class = self ].
savePlugin size = 1 ifFalse: [
Error signal:
'Wrong installation of SavePlugin. Should only be one instance.' ].
savePlugin := savePlugin asArray first.
editor projectModel roots addAll: aCollectionOfBlElement.
savePlugin openOn: aSaveModel.
editor window open
editor open
]

{ #category : #adding }
Expand Down
1 change: 1 addition & 0 deletions src/Pyramid-Bloc/PyramidSpaceBuilder.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ PyramidSpaceBuilder >> addOverlayNamed: aString [
PyramidSpaceBuilder >> build [

self space: BlSpace new.
self space userData at: #pyramid_isEditor put: true.

self overlays ifEmpty: [ ^ self space ].

Expand Down
13 changes: 7 additions & 6 deletions src/Pyramid-Bloc/PyramidVisualPystonForCly.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,10 @@ PyramidVisualPystonForCly >> build [
{ #category : #'as yet unclassified' }
PyramidVisualPystonForCly >> buttonEditor [

^ self buttonLabel: 'Edit' help: 'Open the design in Pyramid' action: [ self openEditor ].

^ self
buttonLabel: 'Edit'
help: 'Edit this design in Pyramid'
action: [ self openEditor ]
]

{ #category : #'as yet unclassified' }
Expand All @@ -123,10 +125,9 @@ PyramidVisualPystonForCly >> buttonLabel: aLabel help: aString action: aBlock [
PyramidVisualPystonForCly >> buttonOpen [

^ self
buttonLabel: 'Open in new Space'
help: 'Open this design in a new BlSpace'
buttonLabel: 'Open'
help: 'Open this design in a window'
action: [ self openInNewSpace ]

]

{ #category : #initialization }
Expand Down Expand Up @@ -200,7 +201,7 @@ PyramidVisualPystonForCly >> openInNewSpace [
elements isCollection ifFalse: [ elements := { elements } ].

elements ifEmpty: [ ^ self ].
space := elements first openInNewSpaceWithPyramidShortcut.
space := elements first openInNewSpace.
space root addChildren: elements allButFirst
]

Expand Down
6 changes: 4 additions & 2 deletions src/Pyramid-IDE/PyramidWorld.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ PyramidWorld class >> displayLoadedPlugins [
"Statistics"
stream
nextPutAll: (e pluginClasses size) asString;
nextPutAll: ' loaded plugin(s).';
nextPutAll: ' loaded / ';
nextPutAll: (PyramidPluginManager imagePluginClasses size) asString;
nextPutAll: ' available plugin(s)';
cr; cr.

"Details"
Expand Down Expand Up @@ -161,7 +163,7 @@ PyramidWorld class >> startBrowseSources [
{ #category : #actions }
PyramidWorld class >> startNewDesign [

PyramidPluginManager uniqueInstance makeEditor window open
PyramidEditor open
]

{ #category : #actions }
Expand Down
10 changes: 6 additions & 4 deletions src/Pyramid-Tests/PyramidEditorTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ PyramidEditorTest >> openFromBlSpace [
self assert: (editor projectModel roots includes: element).
self deny: (space root children includes: element).

editor window close.
editor close.
(Duration milliSeconds: 10) wait.

self assert: editor window isClosed.
Expand All @@ -34,14 +34,16 @@ PyramidEditorTest >> openFromBlSpace [
PyramidEditorTest >> openNewEditor [

| editor spec |
editor := PyramidPluginManager uniqueInstance makeEditor.
spec := editor window open.
editor := PyramidEditor buildEditor.
editor open.

spec := editor window spec.
(Duration milliSeconds: 10) wait.
self currentWorld doOneCycle.
self assert: editor window isOpen.
self assert: spec window isInWorld.

editor window close.
editor close.
(Duration milliSeconds: 10) wait.
self currentWorld doOneCycle.
self assert: editor window isClosed.
Expand Down
Loading