From bfe7a31ad9458a511a7528accc6bd53eb090712b Mon Sep 17 00:00:00 2001 From: YannLEGOFF Date: Thu, 29 Jun 2023 08:51:33 +0200 Subject: [PATCH 01/14] [Fix] - baseline load ide package --- src/BaselineOfPyramid/BaselineOfPyramid.class.st | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/BaselineOfPyramid/BaselineOfPyramid.class.st b/src/BaselineOfPyramid/BaselineOfPyramid.class.st index a721f719..74879fc6 100644 --- a/src/BaselineOfPyramid/BaselineOfPyramid.class.st +++ b/src/BaselineOfPyramid/BaselineOfPyramid.class.st @@ -12,10 +12,11 @@ BaselineOfPyramid >> baseline: spec [ spec postLoadDoIt: #postload:package:. self dependencies: spec. spec - package: #Pyramid - with: [ spec requires: #( #BlocSerialization ) ]; - package: #'Pyramid-Bloc' with: [ spec requires: #( #Pyramid #Bloc ) ]; - package: #'Pyramid-Tests' with: [ spec requires: #( #Pyramid ) ] ] + package: #Pyramid with: [ spec requires: #( #BlocSerialization ) ]; + package: #'Pyramid-Bloc' + with: [ spec requires: #( #Pyramid #Bloc ) ]; + package: #'Pyramid-Tests' with: [ spec requires: #( #Pyramid ) ]; + package: #'Pyramid-IDE' with: [ spec requires: #( #Pyramid ) ] ] ] { #category : #baselines } From 8a31cdce767c1684269615f0f47e5e0ce872a877 Mon Sep 17 00:00:00 2001 From: YannLEGOFF Date: Thu, 29 Jun 2023 09:38:42 +0200 Subject: [PATCH 02/14] [Clean] - removing some old files and changing some package --- .../PyramidTreePresenter.class.st | 2 +- .../PyramidTreeToFlat.class.st | 2 +- src/Pyramid/PyTest.class.st | 17 --- src/Pyramid/PyramidClassMethodModel.class.st | 65 -------- .../PyramidPCMWithPreviewPresenter.class.st | 80 ---------- ...PyramidPCMWithTextFieldsPresenter.class.st | 85 ----------- ...yramidPackageClassMethodPresenter.class.st | 140 ------------------ 7 files changed, 2 insertions(+), 389 deletions(-) rename src/{Pyramid => Pyramid-Bloc}/PyramidTreeToFlat.class.st (93%) delete mode 100644 src/Pyramid/PyTest.class.st delete mode 100644 src/Pyramid/PyramidClassMethodModel.class.st delete mode 100644 src/Pyramid/PyramidPCMWithPreviewPresenter.class.st delete mode 100644 src/Pyramid/PyramidPCMWithTextFieldsPresenter.class.st delete mode 100644 src/Pyramid/PyramidPackageClassMethodPresenter.class.st diff --git a/src/Pyramid-Bloc/PyramidTreePresenter.class.st b/src/Pyramid-Bloc/PyramidTreePresenter.class.st index ea1db32c..9d4dcca4 100644 --- a/src/Pyramid-Bloc/PyramidTreePresenter.class.st +++ b/src/Pyramid-Bloc/PyramidTreePresenter.class.st @@ -77,7 +77,7 @@ PyramidTreePresenter >> initializePresenters [ roots: { }; children: [ :each | each children ]; contextMenu: [ self contextMenu ]; - expandRoots. + expandAll. self columns do: [ :each | treePresenter addColumn: each ] ] diff --git a/src/Pyramid/PyramidTreeToFlat.class.st b/src/Pyramid-Bloc/PyramidTreeToFlat.class.st similarity index 93% rename from src/Pyramid/PyramidTreeToFlat.class.st rename to src/Pyramid-Bloc/PyramidTreeToFlat.class.st index d1af97ec..ce4ab30e 100644 --- a/src/Pyramid/PyramidTreeToFlat.class.st +++ b/src/Pyramid-Bloc/PyramidTreeToFlat.class.st @@ -1,7 +1,7 @@ Class { #name : #PyramidTreeToFlat, #superclass : #Object, - #category : #'Pyramid-utils' + #category : #'Pyramid-Bloc-utils' } { #category : #'as yet unclassified' } diff --git a/src/Pyramid/PyTest.class.st b/src/Pyramid/PyTest.class.st deleted file mode 100644 index e0b19850..00000000 --- a/src/Pyramid/PyTest.class.st +++ /dev/null @@ -1,17 +0,0 @@ -Class { - #name : #PyTest, - #superclass : #Object, - #category : #'Pyramid-properties-custom' -} - -{ #category : #'as yet unclassified' } -PyTest class >> test [ - - ^ self iconNamed: #pharoBig -] - -{ #category : #'as yet unclassified' } -PyTest >> test [ - - ^ self iconNamed: #pharoBig -] diff --git a/src/Pyramid/PyramidClassMethodModel.class.st b/src/Pyramid/PyramidClassMethodModel.class.st deleted file mode 100644 index 3c5e17f8..00000000 --- a/src/Pyramid/PyramidClassMethodModel.class.st +++ /dev/null @@ -1,65 +0,0 @@ -Class { - #name : #PyramidClassMethodModel, - #superclass : #Object, - #instVars : [ - 'targetClass', - 'methodString', - 'methodSelector', - 'methodArguments' - ], - #category : #'Pyramid-properties-custom' -} - -{ #category : #initialization } -PyramidClassMethodModel >> initialize [ - -methodArguments := { } -] - -{ #category : #accessing } -PyramidClassMethodModel >> methodArguments [ - - ^ methodArguments -] - -{ #category : #accessing } -PyramidClassMethodModel >> methodArguments: anArray [ - - methodArguments := anArray -] - -{ #category : #accessing } -PyramidClassMethodModel >> methodSelector [ - - ^ methodSelector -] - -{ #category : #accessing } -PyramidClassMethodModel >> methodSelector: anObject [ - - methodSelector := anObject -] - -{ #category : #accessing } -PyramidClassMethodModel >> methodString [ - - ^ methodString -] - -{ #category : #accessing } -PyramidClassMethodModel >> methodString: anObject [ - - methodString := anObject -] - -{ #category : #accessing } -PyramidClassMethodModel >> targetClass [ - - ^ targetClass -] - -{ #category : #accessing } -PyramidClassMethodModel >> targetClass: anObject [ - - targetClass := anObject -] diff --git a/src/Pyramid/PyramidPCMWithPreviewPresenter.class.st b/src/Pyramid/PyramidPCMWithPreviewPresenter.class.st deleted file mode 100644 index 5ec996eb..00000000 --- a/src/Pyramid/PyramidPCMWithPreviewPresenter.class.st +++ /dev/null @@ -1,80 +0,0 @@ -Class { - #name : #PyramidPCMWithPreviewPresenter, - #superclass : #SpPresenter, - #instVars : [ - 'pcm', - 'preview', - 'presenterFromModelBlock' - ], - #category : #'Pyramid-properties-custom' -} - -{ #category : #layout } -PyramidPCMWithPreviewPresenter >> defaultLayout [ - - ^ SpPanedLayout newVertical - add: self pcm; - add: self preview; - yourself -] - -{ #category : #initialization } -PyramidPCMWithPreviewPresenter >> initializePresenters [ - - pcm := PyramidPCMWithTextFieldsPresenter new - packages: RPackage organizer packages; - yourself. - pcm whenSelectionChangedDo: [ :model | self updatePreviewWith: model ]. - preview := SpNullPresenter new. -] - -{ #category : #accessing } -PyramidPCMWithPreviewPresenter >> pcm [ - ^ pcm -] - -{ #category : #accessing } -PyramidPCMWithPreviewPresenter >> presenterFromModelBlock [ - - presenterFromModelBlock ifNil: [ presenterFromModelBlock := [ :model | SpNullPresenter new ] ]. - ^ presenterFromModelBlock -] - -{ #category : #accessing } -PyramidPCMWithPreviewPresenter >> presenterFromModelBlock: anObject [ -presenterFromModelBlock:= anObject -] - -{ #category : #accessing } -PyramidPCMWithPreviewPresenter >> preview [ - - ^ preview -] - -{ #category : #accessing } -PyramidPCMWithPreviewPresenter >> preview: aPresenter [ - - self layout second: aPresenter. - preview := aPresenter -] - -{ #category : #'as yet unclassified' } -PyramidPCMWithPreviewPresenter >> selectFromExternalRessource: anExternalRessource [ - - self pcm selectFromExternalRessource: anExternalRessource -] - -{ #category : #'as yet unclassified' } -PyramidPCMWithPreviewPresenter >> updatePreviewWith: model [ - - | presenter | - presenter := self presenterFromModelBlock - value: model. self - preview: presenter -] - -{ #category : #initialization } -PyramidPCMWithPreviewPresenter >> whenSelectionChangedDo: aBlock [ - - self pcm whenSelectionChangedDo: [ :model | self updatePreviewWith: model. aBlock value: model ] -] diff --git a/src/Pyramid/PyramidPCMWithTextFieldsPresenter.class.st b/src/Pyramid/PyramidPCMWithTextFieldsPresenter.class.st deleted file mode 100644 index e21c50a7..00000000 --- a/src/Pyramid/PyramidPCMWithTextFieldsPresenter.class.st +++ /dev/null @@ -1,85 +0,0 @@ -Class { - #name : #PyramidPCMWithTextFieldsPresenter, - #superclass : #PyramidPackageClassMethodPresenter, - #instVars : [ - 'methodInputPresenter', - 'classInputPresenter', - 'packageInputPresenter' - ], - #category : #'Pyramid-properties-custom' -} - -{ #category : #accessing } -PyramidPCMWithTextFieldsPresenter >> classInputPresenter [ - - ^ classInputPresenter -] - -{ #category : #layout } -PyramidPCMWithTextFieldsPresenter >> defaultLayout [ - - ^ SpPanedLayout newLeftToRight - positionOfSlider: 1 / 3; - add: (SpBoxLayout newVertical spacing: 4; add: self packageListPresenter expand: true; add: self packageInputPresenter expand: false; yourself); - add: (SpPanedLayout newLeftToRight - positionOfSlider: 1 / 2; - add: (SpBoxLayout newVertical spacing: 4; add: self classListPresenter expand: true; add: self classInputPresenter expand: false; yourself); - add: (SpBoxLayout newVertical spacing: 4; add: self methodListPresenter expand: true; add: self methodInputPresenter expand: false; yourself); - yourself); - yourself -] - -{ #category : #initialization } -PyramidPCMWithTextFieldsPresenter >> initializePresenters [ - - super initializePresenters. - methodInputPresenter := SpTextInputFieldPresenter new. - classInputPresenter := SpTextInputFieldPresenter new. - packageInputPresenter := SpTextInputFieldPresenter new. - - packageInputPresenter whenTextChangedDo: [ :text | - | packages | - packages := self packageListPresenter items select: [ :each | - each name = text ]. - packages - ifEmpty: [ self packageListPresenter unselectAll ] - ifNotEmpty: [ self packageListPresenter selectItem: packages first ] ]. - classInputPresenter whenTextChangedDo: [ :text | - | classes | - classes := self classListPresenter items select: [ :each | - each name = text ]. - classes - ifEmpty: [ self classListPresenter unselectAll ] - ifNotEmpty: [ self classListPresenter selectItem: classes first ] ]. - methodInputPresenter whenTextChangedDo: [ :text | - | methods | - methods := self methodListPresenter items select: [ :each | - each selector = text ]. - methods - ifEmpty: [ self methodListPresenter unselectAll ] - ifNotEmpty: [ self methodListPresenter selectItem: methods first ] ]. - - self packageListPresenter whenSelectedItemChangedDo: [ :package | - package ifNotNil: [ self packageInputPresenter text: package name ] ]. - self classListPresenter whenSelectedItemChangedDo: [ :class | - class ifNotNil: [ self classInputPresenter text: class name ] ]. - self methodListPresenter whenSelectedItemChangedDo: [ :method | - method ifNotNil: [ self methodInputPresenter text: method selector ]. - self actionSelection ]. - self focusOrder - add: packageInputPresenter; - add: classInputPresenter; - add: methodInputPresenter -] - -{ #category : #accessing } -PyramidPCMWithTextFieldsPresenter >> methodInputPresenter [ - - ^ methodInputPresenter -] - -{ #category : #accessing } -PyramidPCMWithTextFieldsPresenter >> packageInputPresenter [ - - ^ packageInputPresenter -] diff --git a/src/Pyramid/PyramidPackageClassMethodPresenter.class.st b/src/Pyramid/PyramidPackageClassMethodPresenter.class.st deleted file mode 100644 index 333c0d15..00000000 --- a/src/Pyramid/PyramidPackageClassMethodPresenter.class.st +++ /dev/null @@ -1,140 +0,0 @@ -Class { - #name : #PyramidPackageClassMethodPresenter, - #superclass : #SpPresenter, - #instVars : [ - 'methodListPresenter', - 'classListPresenter', - 'packageListPresenter', - 'whenSelectionChangedDo' - ], - #category : #'Pyramid-properties-custom' -} - -{ #category : #'as yet unclassified' } -PyramidPackageClassMethodPresenter >> actionSelection [ - - self whenSelectionChangedDo value: self model -] - -{ #category : #accessing } -PyramidPackageClassMethodPresenter >> classListPresenter [ - - ^ classListPresenter -] - -{ #category : #initialization } -PyramidPackageClassMethodPresenter >> connectPresenters [ - - self packageListPresenter - transmitTo: self classListPresenter - transform: [ :package | - package - ifNil: [ #( ) ] - ifNotNil: [ package classes asArray sort: #name ascending ] ] - postTransmission: [ :destination | destination selectIndex: 1 ]. - - self classListPresenter - transmitTo: self methodListPresenter - transform: [ :class | - class - ifNil: [ #( ) ] - ifNotNil: [ class class methods sort: #selector descending ] ] - postTransmission: [ :destination | ] -] - -{ #category : #layout } -PyramidPackageClassMethodPresenter >> defaultLayout [ - - ^ SpPanedLayout newLeftToRight - positionOfSlider: 1 / 3; - add: self packageListPresenter; - add: (SpPanedLayout newLeftToRight - positionOfSlider: 1 / 2; - add: self classListPresenter; - add: self methodListPresenter; - yourself); - yourself -] - -{ #category : #initialization } -PyramidPackageClassMethodPresenter >> initializePresenters [ - - classListPresenter := self newList. - methodListPresenter := self newList. - packageListPresenter := self newList. - - packageListPresenter display: #name. - packageListPresenter displayIcon: [ :aPackage | - self iconNamed: #package ]. - - methodListPresenter display: #selector. - classListPresenter displayIcon: [ :aClass | - aClass iconNamed: aClass systemIconName ]. - - methodListPresenter whenSelectedItemChangedDo: [ :item | - self actionSelection ]. - - self focusOrder - add: packageListPresenter; - add: classListPresenter; - add: methodListPresenter -] - -{ #category : #accessing } -PyramidPackageClassMethodPresenter >> methodListPresenter [ - - ^ methodListPresenter -] - -{ #category : #'as yet unclassified' } -PyramidPackageClassMethodPresenter >> model [ - - | model | - model := PyramidClassMethodModel new - targetClass: self classListPresenter selectedItem; - yourself. - self methodListPresenter selectedItem ifNotNil: [ - model methodSelector: self methodListPresenter selectedItem selector ]. - ^ model -] - -{ #category : #accessing } -PyramidPackageClassMethodPresenter >> packageListPresenter [ - - ^ packageListPresenter -] - -{ #category : #api } -PyramidPackageClassMethodPresenter >> packages: aList [ - - | newItems | - newItems := aList sorted: #name ascending. - self packageListPresenter items = newItems ifTrue: [ ^ self ]. - self packageListPresenter - items: newItems; - selectIndex: 1 -] - -{ #category : #'as yet unclassified' } -PyramidPackageClassMethodPresenter >> selectFromExternalRessource: anExternalRessource [ - - | method | - self packageListPresenter selectItem: anExternalRessource target package. - self classListPresenter selectItem: anExternalRessource target. - method := (self methodListPresenter items select: [ :each | - each selector = anExternalRessource selector ]) first. - self methodListPresenter selectItem: method -] - -{ #category : #accessing } -PyramidPackageClassMethodPresenter >> whenSelectionChangedDo [ - - whenSelectionChangedDo ifNil: [ whenSelectionChangedDo := [ :m | ] ]. - ^ whenSelectionChangedDo -] - -{ #category : #accessing } -PyramidPackageClassMethodPresenter >> whenSelectionChangedDo: anObject [ - - whenSelectionChangedDo := anObject -] From 0adbccda54b0990a040282b82843efd961b432e0 Mon Sep 17 00:00:00 2001 From: YannLEGOFF Date: Thu, 29 Jun 2023 10:11:10 +0200 Subject: [PATCH 03/14] [Clean] - remove the central toolbar --- .../PyramidFakeBackgroundMixedValues.class.st | 4 ++++ src/Pyramid-Bloc/PyramidPluginLibrary.class.st | 9 --------- src/Pyramid/PyramidDynamicLayoutStrategy.class.st | 8 -------- src/Pyramid/PyramidWindow.class.st | 3 --- 4 files changed, 4 insertions(+), 20 deletions(-) diff --git a/src/Pyramid-Bloc/PyramidFakeBackgroundMixedValues.class.st b/src/Pyramid-Bloc/PyramidFakeBackgroundMixedValues.class.st index 5386538a..8f89f6c2 100644 --- a/src/Pyramid-Bloc/PyramidFakeBackgroundMixedValues.class.st +++ b/src/Pyramid-Bloc/PyramidFakeBackgroundMixedValues.class.st @@ -22,6 +22,10 @@ PyramidFakeBackgroundMixedValues >> pyramidBackgroundStrategy [ ^ PyramidBackgroundPropertyInputMixedValuesModel new ] +{ #category : #'as yet unclassified' } +PyramidFakeBackgroundMixedValues >> pyramidModalDefaultPaint: aPyramidPaintInputPresenter [ +] + { #category : #'as yet unclassified' } PyramidFakeBackgroundMixedValues >> pyramidSelectMenuOnModal: aModal [ ] diff --git a/src/Pyramid-Bloc/PyramidPluginLibrary.class.st b/src/Pyramid-Bloc/PyramidPluginLibrary.class.st index 6e120df7..3f3177dd 100644 --- a/src/Pyramid-Bloc/PyramidPluginLibrary.class.st +++ b/src/Pyramid-Bloc/PyramidPluginLibrary.class.st @@ -21,15 +21,6 @@ PyramidPluginLibrary >> addButton [ ^ addButton ] -{ #category : #adding } -PyramidPluginLibrary >> addPanelsOn: aPyramidSimpleWindow [ - - aPyramidSimpleWindow - at: #spaceToolbarTop - addItem: [ :builder | - builder makeButtonWithIcon: self addButton order: 10 ] -] - { #category : #'as yet unclassified' } PyramidPluginLibrary >> connectOn: aPyramidEditor [ diff --git a/src/Pyramid/PyramidDynamicLayoutStrategy.class.st b/src/Pyramid/PyramidDynamicLayoutStrategy.class.st index d51069c4..d7a6989a 100644 --- a/src/Pyramid/PyramidDynamicLayoutStrategy.class.st +++ b/src/Pyramid/PyramidDynamicLayoutStrategy.class.st @@ -46,14 +46,6 @@ PyramidDynamicLayoutStrategy >> spaceAndToolBarFor: aWindow [ ^ SpBoxLayout newHorizontal spacing: 4; - add: (SpBoxLayout newVertical - add: (aWindow services at: #spaceToolbarTop) presenter - expand: false; - add: SpNullPresenter new expand: true; - add: (aWindow services at: #spaceToolbarBottom) presenter - expand: false; - yourself) - expand: false; add: (aWindow services at: #space) presenter expand: true; yourself ] diff --git a/src/Pyramid/PyramidWindow.class.st b/src/Pyramid/PyramidWindow.class.st index 1f9cb5da..c55e5d0b 100644 --- a/src/Pyramid/PyramidWindow.class.st +++ b/src/Pyramid/PyramidWindow.class.st @@ -29,9 +29,6 @@ PyramidWindow >> initialize [ PyramidPanelModel toolbarHorizontal installOn: self at: #topRight. PyramidPanelModel presenter installOn: self at: #space. - - PyramidPanelModel toolbarVertical installOn: self at: #spaceToolbarTop. - PyramidPanelModel toolbarVertical installOn: self at: #spaceToolbarBottom. PyramidPanelModel tab installOn: self at: #tabLeft. PyramidPanelModel tab installOn: self at: #tabRight From e36dcb86883f953b915c3a71e6e330f7f503104b Mon Sep 17 00:00:00 2001 From: YannLEGOFF Date: Thu, 29 Jun 2023 11:51:12 +0200 Subject: [PATCH 04/14] [FT] - refresh space wih a button --- ...ramidBlocWindowForLayoutPresenter.class.st | 93 ------------------- src/Pyramid-Bloc/PyramidSpacePlugin.class.st | 83 +++++------------ .../PyramidSpacePresenter.class.st | 75 +++++++++++++-- .../PyramidSpaceSwitchPresenter.class.st | 56 +++++++++++ 4 files changed, 149 insertions(+), 158 deletions(-) delete mode 100644 src/Pyramid-Bloc/PyramidBlocWindowForLayoutPresenter.class.st create mode 100644 src/Pyramid-Bloc/PyramidSpaceSwitchPresenter.class.st diff --git a/src/Pyramid-Bloc/PyramidBlocWindowForLayoutPresenter.class.st b/src/Pyramid-Bloc/PyramidBlocWindowForLayoutPresenter.class.st deleted file mode 100644 index ebb4198c..00000000 --- a/src/Pyramid-Bloc/PyramidBlocWindowForLayoutPresenter.class.st +++ /dev/null @@ -1,93 +0,0 @@ -Class { - #name : #PyramidBlocWindowForLayoutPresenter, - #superclass : #SpPresenter, - #instVars : [ - 'isFullScreenCheckbox', - 'extentInput', - 'layer', - 'whenFullScreenChangedDo', - 'whenExtentChangedDo' - ], - #category : #'Pyramid-Bloc-plugin-space' -} - -{ #category : #layout } -PyramidBlocWindowForLayoutPresenter >> defaultLayout [ - - ^ SpBoxLayout newVertical - spacing: 4; - add: (SpLabelPresenter new label: 'Window parameters'; displayBold: [ :a | true]; yourself); - add: self isFullScreenCheckbox; - add: self extentInput; - yourself -] - -{ #category : #layout } -PyramidBlocWindowForLayoutPresenter >> extentInput [ - - ^ extentInput -] - -{ #category : #'initialization - deprecated' } -PyramidBlocWindowForLayoutPresenter >> initializePresenters [ - - isFullScreenCheckbox := SpCheckBoxPresenter new - label: 'fullScreen'; - whenActivatedDo: [ - self whenFullScreenChangedDo value: true ]; - whenDeactivatedDo: [ - self whenFullScreenChangedDo value: false ]; - yourself. - - extentInput := PyramidPointPresenter new whenSubmitDo: [ :point | - self whenExtentChangedDo value: point ] -] - -{ #category : #testing } -PyramidBlocWindowForLayoutPresenter >> isFullScreen: aBoolean [ - - self isFullScreenCheckbox state: aBoolean -] - -{ #category : #layout } -PyramidBlocWindowForLayoutPresenter >> isFullScreenCheckbox [ -^ isFullScreenCheckbox -] - -{ #category : #'as yet unclassified' } -PyramidBlocWindowForLayoutPresenter >> requestedExtent [ - - ^ self extentInput point -] - -{ #category : #'as yet unclassified' } -PyramidBlocWindowForLayoutPresenter >> requestedExtent: aPoint [ - - self extentInput point: aPoint -] - -{ #category : #accessing } -PyramidBlocWindowForLayoutPresenter >> whenExtentChangedDo [ -whenExtentChangedDo ifNil: [ - whenExtentChangedDo := [ :a | ] ]. - ^ whenExtentChangedDo -] - -{ #category : #accessing } -PyramidBlocWindowForLayoutPresenter >> whenExtentChangedDo: aBlock [ - - whenExtentChangedDo := aBlock -] - -{ #category : #accessing } -PyramidBlocWindowForLayoutPresenter >> whenFullScreenChangedDo [ - - whenFullScreenChangedDo ifNil: [whenFullScreenChangedDo := [ :a | ]]. - ^ whenFullScreenChangedDo -] - -{ #category : #accessing } -PyramidBlocWindowForLayoutPresenter >> whenFullScreenChangedDo: aBlock [ - - whenFullScreenChangedDo:= aBlock -] diff --git a/src/Pyramid-Bloc/PyramidSpacePlugin.class.st b/src/Pyramid-Bloc/PyramidSpacePlugin.class.st index b539de93..d29a6347 100644 --- a/src/Pyramid-Bloc/PyramidSpacePlugin.class.st +++ b/src/Pyramid-Bloc/PyramidSpacePlugin.class.st @@ -1,96 +1,63 @@ Class { #name : #PyramidSpacePlugin, #superclass : #Object, - #traits : 'TPyramidPlugin + TPyramidProjectModelObserver', - #classTraits : 'TPyramidPlugin classTrait + TPyramidProjectModelObserver classTrait', + #traits : 'TPyramidPlugin', + #classTraits : 'TPyramidPlugin classTrait', #instVars : [ - 'spacePresenter', - 'activeProject' + 'resetSpaceButton', + 'spaceSwitch' ], #category : #'Pyramid-Bloc-plugin-space' } -{ #category : #examples } -PyramidSpacePlugin class >> example [ - - | plugin | - - plugin := PyramidSpacePlugin new. -plugin configureBuilder: nil. -plugin overlaysManager rootElement addChild: (BlElement new background: Color red; yourself); yourself. -plugin overlaysManager space show. -] - -{ #category : #accessing } -PyramidSpacePlugin class >> extensions [ - - ^ { - PyramidSPEMousePosition new. - PyramidSPEWindow new. - PyramidSPEMovement new. - PyramidSPEMakeSelection new. - PyramidSPEShowSelection new } -] - { #category : #'class initialization' } PyramidSpacePlugin class >> initialize [ PyramidPluginManager uniqueInstance addPlugin: self ] -{ #category : #accessing } -PyramidSpacePlugin >> activeProject [ - - ^ activeProject -] - -{ #category : #accessing } -PyramidSpacePlugin >> activeProject: anObject [ - - activeProject := anObject -] - { #category : #adding } PyramidSpacePlugin >> addPanelsOn: aPyramidSimpleWindow [ aPyramidSimpleWindow at: #space - addItem: [ :builder | - builder makePresenter: self spacePresenter ] + addItem: [ :builder | builder makePresenter: self spaceSwitch ]. + aPyramidSimpleWindow at: #topLeft addItem: [ :builder | + builder makeButtonWithIcon: self resetSpaceButton order: 5 ] ] { #category : #'as yet unclassified' } PyramidSpacePlugin >> connectOn: aPyramidEditor [ - (self spacePresenter overlaysManager model at: #editor) object: - aPyramidEditor. - self activeProject: aPyramidEditor activeProject. - self activeProject addObserver: self + | spacePresenter | + spacePresenter := PyramidSpacePresenter new. + self spaceSwitch editor: aPyramidEditor. + self spaceSwitch spacePresenter: spacePresenter ] { #category : #initialization } PyramidSpacePlugin >> initialize [ - spacePresenter := PyramidSpacePresenter new. + spaceSwitch := PyramidSpaceSwitchPresenter new. + resetSpaceButton := SpButtonPresenter new + icon: (self iconNamed: #smallUpdate); + action: [ self resetSpacePresenter ]; + yourself ] -{ #category : #'as yet unclassified' } -PyramidSpacePlugin >> pyramidRootsChanged [ - - self updateRoots +{ #category : #initialization } +PyramidSpacePlugin >> resetSpaceButton [ + ^ resetSpaceButton ] -{ #category : #accessing } -PyramidSpacePlugin >> spacePresenter [ +{ #category : #initialization } +PyramidSpacePlugin >> resetSpacePresenter [ - ^ spacePresenter + self spaceSwitch spacePresenter: PyramidSpacePresenter new ] -{ #category : #accessing } -PyramidSpacePlugin >> updateRoots [ +{ #category : #'as yet unclassified' } +PyramidSpacePlugin >> spaceSwitch [ - | canvas | - canvas := self spacePresenter overlaysManager frontLayer overlayElement. - canvas removeChildren. - canvas addChildren: self activeProject roots + ^ spaceSwitch ] diff --git a/src/Pyramid-Bloc/PyramidSpacePresenter.class.st b/src/Pyramid-Bloc/PyramidSpacePresenter.class.st index 62b683d8..67c78ad8 100644 --- a/src/Pyramid-Bloc/PyramidSpacePresenter.class.st +++ b/src/Pyramid-Bloc/PyramidSpacePresenter.class.st @@ -1,19 +1,51 @@ Class { #name : #PyramidSpacePresenter, #superclass : #SpPresenter, + #traits : 'TPyramidProjectModelObserver', + #classTraits : 'TPyramidProjectModelObserver classTrait', #instVars : [ + 'activeProject', 'presenter', 'overlaysManager' ], #category : #'Pyramid-Bloc-plugin-space' } +{ #category : #accessing } +PyramidSpacePresenter >> activeProject [ + + ^ activeProject +] + +{ #category : #accessing } +PyramidSpacePresenter >> activeProject: anObject [ + + activeProject := anObject +] + +{ #category : #accessing } +PyramidSpacePresenter >> connectOn: aPyramidEditor [ + + +(self overlaysManager model at: #editor) object: + aPyramidEditor. + self activeProject: aPyramidEditor activeProject. + self activeProject addObserver: self +] + { #category : #layout } PyramidSpacePresenter >> defaultLayout [ ^ SpBoxLayout newVertical add: self presenter; yourself ] +{ #category : #'as yet unclassified' } +PyramidSpacePresenter >> disconnectEditor [ + + self activeProject removeObserver: self. + self overlaysManager frontLayer overlayElement removeChildren. +] + { #category : #initialization } PyramidSpacePresenter >> initializePresenters [ @@ -27,13 +59,20 @@ PyramidSpacePresenter >> makeSpacePresenter [ | container morph host | container := SpMorphPresenter new. - morph := Morph new. + morph := Morph new + color: Color blue muchLighter; + yourself. + morph layoutPolicy: TableLayout new. host := BlMorphicHost new. host containerMorph: morph. self overlaysManager space host: host. + self overlaysManager space when: BlSpaceDestroyedEvent do: [ :evt | + morph addMorph: + ('Something went wrong, please refresh the space using the refresh button ↑' + asMorph fontName: TextStyle defaultFont familyName size: 40) ]. container morph: morph. container whenDisplayDo: [ self overlaysManager space show ]. @@ -63,12 +102,34 @@ PyramidSpacePresenter >> presenter: anObject [ presenter := anObject ] +{ #category : #'as yet unclassified' } +PyramidSpacePresenter >> pyramidRootsChanged [ + + self updateRoots +] + { #category : #initialization } -PyramidSpacePresenter >> resetSpacePresenter [ +PyramidSpacePresenter >> resetFromPreviousPresenter: aSpacePresenter [ + + | editor | + editor :=( aSpacePresenter overlaysManager model at: #editor) object. + (self overlaysManager model at: #editor) object: editor. + + self activeProject: aSpacePresenter activeProject. + self activeProject removeObserver: aSpacePresenter. + + aSpacePresenter overlaysManager frontLayer overlayElement + removeChildren. + + self updateRoots +] + +{ #category : #accessing } +PyramidSpacePresenter >> updateRoots [ - | previousPresenter | - self overlaysManager resetSpace. - previousPresenter := self presenter. - self presenter: self makeSpacePresenter. - self layout replace: previousPresenter with: self presenter. + | canvas | + canvas := self overlaysManager frontLayer + overlayElement. + canvas removeChildren. + canvas addChildren: self activeProject roots ] diff --git a/src/Pyramid-Bloc/PyramidSpaceSwitchPresenter.class.st b/src/Pyramid-Bloc/PyramidSpaceSwitchPresenter.class.st new file mode 100644 index 00000000..3d5da442 --- /dev/null +++ b/src/Pyramid-Bloc/PyramidSpaceSwitchPresenter.class.st @@ -0,0 +1,56 @@ +Class { + #name : #PyramidSpaceSwitchPresenter, + #superclass : #SpPresenter, + #instVars : [ + 'spacePresenter', + 'editor' + ], + #category : #'Pyramid-Bloc-plugin-space' +} + +{ #category : #initialization } +PyramidSpaceSwitchPresenter >> defaultLayout [ + + self spacePresenter ifNil: [ ^ SpBoxLayout newVertical ]. + ^ SpBoxLayout newVertical + add: self spacePresenter; + yourself +] + +{ #category : #accessing } +PyramidSpaceSwitchPresenter >> editor [ + + ^ editor +] + +{ #category : #accessing } +PyramidSpaceSwitchPresenter >> editor: anObject [ + + editor := anObject +] + +{ #category : #initialization } +PyramidSpaceSwitchPresenter >> initializePresenters [ + + spacePresenter := nil +] + +{ #category : #initialization } +PyramidSpaceSwitchPresenter >> spacePresenter [ +^spacePresenter +] + +{ #category : #initialization } +PyramidSpaceSwitchPresenter >> spacePresenter: aSpacePresenter [ + + | oldPresenter | + oldPresenter := spacePresenter. + spacePresenter := aSpacePresenter. + + oldPresenter ifNotNil: [ oldPresenter disconnectEditor ]. + spacePresenter connectOn: self editor. + + self layout: self defaultLayout. + spacePresenter overlaysManager space show. + spacePresenter updateRoots +] From e84e3a36037bd128e4a03d9bf09fe58b89b657a8 Mon Sep 17 00:00:00 2001 From: YannLEGOFF Date: Thu, 29 Jun 2023 17:41:24 +0200 Subject: [PATCH 05/14] [Fix] - some spec didnt display correctly --- src/Pyramid-Bloc/PyramidOverlayBuilder.class.st | 4 +++- src/Pyramid-Bloc/PyramidSpacePresenter.class.st | 5 +++-- src/Pyramid/PyramidDynamicLayoutStrategy.class.st | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Pyramid-Bloc/PyramidOverlayBuilder.class.st b/src/Pyramid-Bloc/PyramidOverlayBuilder.class.st index 023e8112..e68178b6 100644 --- a/src/Pyramid-Bloc/PyramidOverlayBuilder.class.st +++ b/src/Pyramid-Bloc/PyramidOverlayBuilder.class.st @@ -39,7 +39,9 @@ PyramidOverlayBuilder class >> mousePositionBlock [ ^ [ :builder | | textDisplay rope | textDisplay := (builder at: #origin) asRopedText asElement. - textDisplay background: Color white. + textDisplay + background: Color white; + padding: (BlInsets top: 3). builder name: #mousePosition; constraintsMatchParent; diff --git a/src/Pyramid-Bloc/PyramidSpacePresenter.class.st b/src/Pyramid-Bloc/PyramidSpacePresenter.class.st index 67c78ad8..de33afb9 100644 --- a/src/Pyramid-Bloc/PyramidSpacePresenter.class.st +++ b/src/Pyramid-Bloc/PyramidSpacePresenter.class.st @@ -86,9 +86,10 @@ PyramidSpacePresenter >> overlaysManager [ ] { #category : #accessing } -PyramidSpacePresenter >> overlaysManager: anObject [ +PyramidSpacePresenter >> overlaysManager: newManager [ - overlaysManager := anObject + self flag: #TODO. "overlaysManager space host = self makeSpacePresenter host " + overlaysManager := newManager ] { #category : #accessing } diff --git a/src/Pyramid/PyramidDynamicLayoutStrategy.class.st b/src/Pyramid/PyramidDynamicLayoutStrategy.class.st index d7a6989a..ec302dac 100644 --- a/src/Pyramid/PyramidDynamicLayoutStrategy.class.st +++ b/src/Pyramid/PyramidDynamicLayoutStrategy.class.st @@ -55,9 +55,9 @@ PyramidDynamicLayoutStrategy >> topLayoutFor: aWindow [ | layout | layout := SpBoxLayout newHorizontal. - layout add: (aWindow services at: #topLeft) presenter expand: false. + layout add: (aWindow services at: #topLeft) presenter expand: true. layout add: SpNullPresenter new expand: true. - layout add: (aWindow services at: #topCenter) presenter expand: false. + layout add: (aWindow services at: #topCenter) presenter expand: true. layout add: SpNullPresenter new expand: true. layout add: (aWindow services at: #topRight) presenter expand: false. ^ layout From 44e78a0ee8132cbcc6be3e54bf8043bb17ffe293 Mon Sep 17 00:00:00 2001 From: YannLEGOFF Date: Thu, 29 Jun 2023 18:07:06 +0200 Subject: [PATCH 06/14] [FT] - Add context menu to the hierarchy menu --- .../PyramidTreeMenuGroup.class.st | 22 +++++++++++++++++++ .../PyramidTreePresenter.class.st | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/Pyramid-Bloc/PyramidTreeMenuGroup.class.st b/src/Pyramid-Bloc/PyramidTreeMenuGroup.class.st index 176620c9..49bfb00b 100644 --- a/src/Pyramid-Bloc/PyramidTreeMenuGroup.class.st +++ b/src/Pyramid-Bloc/PyramidTreeMenuGroup.class.st @@ -57,6 +57,28 @@ PyramidTreeMenuGroup class >> browseAndInspect: aPyramidTreePresenter [ addMenuItem: menuInspect ] ] +{ #category : #'as yet unclassified' } +PyramidTreeMenuGroup class >> contextNotWorkingButton: aPyramidTreePresenter [ + + | context selection | + selection := aPyramidTreePresenter editor activeProject selection. + context := SpMenuItemPresenter new + enabled: false; + yourself. + selection ifEmpty: [ context name: 'No element in selection' ]. + + selection size = 1 ifTrue: [ + context icon: (self iconNamed: selection systemIconName). + context name: + selection first id asSymbol , ' ' + , selection first hash printString ]. + selection size > 1 ifTrue: [ + context icon: (self iconNamed: #collection). + context name: selection size printString , ' elements' ]. + + ^ [ :aGroup | aGroup addMenuItem: context ] +] + { #category : #'as yet unclassified' } PyramidTreeMenuGroup class >> removeElement: aPyramidTreePresenter [ diff --git a/src/Pyramid-Bloc/PyramidTreePresenter.class.st b/src/Pyramid-Bloc/PyramidTreePresenter.class.st index 9d4dcca4..da339692 100644 --- a/src/Pyramid-Bloc/PyramidTreePresenter.class.st +++ b/src/Pyramid-Bloc/PyramidTreePresenter.class.st @@ -37,7 +37,7 @@ PyramidTreePresenter >> contextMenu [ { #category : #api } PyramidTreePresenter >> contextMenuGroups [ - ^ { + ^ { (PyramidTreeMenuGroup contextNotWorkingButton: self). (PyramidTreeMenuGroup browseAndInspect: self). (PyramidTreeMenuGroup addNewElement: self). (PyramidTreeMenuGroup removeElement: self) } From 62d830c0f85e1cb5106552584ea889d06fef6657 Mon Sep 17 00:00:00 2001 From: YannLEGOFF Date: Mon, 3 Jul 2023 15:57:10 +0200 Subject: [PATCH 07/14] [FT] - context menu builder on window services --- .../PyramidBorderBuilderPresenter.class.st | 185 ++++++++++++++++++ .../PyramidContextMenuPlugin.class.st | 103 ++++++++++ .../PyramidOverlayBuilder.class.st | 6 +- .../PyramidPluginHierarchy.class.st | 78 +++++++- .../PyramidSelectionMakerController.class.st | 57 ++++-- .../PyramidTreeMenuGroup.class.st | 95 --------- .../PyramidTreePresenter.class.st | 13 +- src/Pyramid/PyramidMenuPanelBuilder.class.st | 91 +++++++++ src/Pyramid/PyramidPanelModel.class.st | 8 + src/Pyramid/PyramidPluginSelection.class.st | 2 +- src/Pyramid/PyramidWindow.class.st | 7 +- 11 files changed, 511 insertions(+), 134 deletions(-) create mode 100644 src/Pyramid-Bloc/PyramidBorderBuilderPresenter.class.st create mode 100644 src/Pyramid-Bloc/PyramidContextMenuPlugin.class.st delete mode 100644 src/Pyramid-Bloc/PyramidTreeMenuGroup.class.st create mode 100644 src/Pyramid/PyramidMenuPanelBuilder.class.st diff --git a/src/Pyramid-Bloc/PyramidBorderBuilderPresenter.class.st b/src/Pyramid-Bloc/PyramidBorderBuilderPresenter.class.st new file mode 100644 index 00000000..2137d62a --- /dev/null +++ b/src/Pyramid-Bloc/PyramidBorderBuilderPresenter.class.st @@ -0,0 +1,185 @@ +Class { + #name : #PyramidBorderBuilderPresenter, + #superclass : #SpPresenter, + #instVars : [ + 'builder', + 'buttonCaps', + 'buttonJoins', + 'paintInput', + 'widthInput', + 'previewCap', + 'previewJoin' + ], + #category : #'Pyramid-Bloc-custom-specs-border' +} + +{ #category : #accessing } +PyramidBorderBuilderPresenter >> builder [ + + ^ builder +] + +{ #category : #accessing } +PyramidBorderBuilderPresenter >> buttonCaps [ + + ^ buttonCaps +] + +{ #category : #accessing } +PyramidBorderBuilderPresenter >> buttonJoins [ + + ^ buttonJoins +] + +{ #category : #layout } +PyramidBorderBuilderPresenter >> capsLayout [ + + | capsLayout | + capsLayout := SpBoxLayout newVertical + spacing: 4; + yourself. + self buttonCaps do: [ :each | capsLayout add: each expand: false ]. + ^ capsLayout +] + +{ #category : #layout } +PyramidBorderBuilderPresenter >> defaultLayout [ + + ^ SpBoxLayout newVertical + spacing: 4; + add: self previewPresenter expand: true; + add: self paintInput expand: false; + add: self widthInput expand: false; + add: (SpBoxLayout newHorizontal + spacing: 4; + add: self capsLayout; + add: self joinsLayout; + yourself); + yourself +] + +{ #category : #initialization } +PyramidBorderBuilderPresenter >> initializeButtonCaps [ + + | round square butt | + round := SpRadioButtonPresenter new + label: 'cap round'; + yourself. + square := SpRadioButtonPresenter new + label: 'cap square'; + yourself. + butt := SpRadioButtonPresenter new + label: 'cap butt'; + yourself. + + round associatedRadioButtons: { + square. + butt }. + round whenActivatedDo: [ self builder capRound. self updatePreview ]. + square whenActivatedDo: [ self builder capSquare. self updatePreview ]. + butt whenActivatedDo: [ self builder capButt. self updatePreview ]. + + buttonCaps := { + round. + square. + butt } +] + +{ #category : #initialization } +PyramidBorderBuilderPresenter >> initializeButtonJoins [ + + | bevel miter round | + bevel := SpRadioButtonPresenter new + label: 'join bevel'; + yourself. + miter := SpRadioButtonPresenter new + label: 'join miter'; + yourself. + round := SpRadioButtonPresenter new + label: 'join round'; + yourself. + + bevel associatedRadioButtons: { + miter. + round }. + bevel whenActivatedDo: [ self builder joinBevel. self updatePreview ]. + miter whenActivatedDo: [ self builder joinMiter. self updatePreview ]. + round whenActivatedDo: [ self builder joinRound. self updatePreview ]. + + buttonJoins := { + bevel. + miter. + round } +] + +{ #category : #initialization } +PyramidBorderBuilderPresenter >> initializePresenters [ + + builder := BlBorderBuilder new + paint: Color black; + width: 1; + yourself. + paintInput := PyramidColorInputPresenter new + whenSubmitDo: [ :color | + self builder paint: color. + self updatePreview ]; + yourself. + widthInput := PyramidNumberPresenter new + number: 1; + whenSubmitDo: [ :width | + self builder width: width. + self updatePreview ]; + yourself. + previewCap := SpImagePresenter new. + previewJoin := SpImagePresenter new. + self initializeButtonCaps. + self initializeButtonJoins. + self updatePreview +] + +{ #category : #layout } +PyramidBorderBuilderPresenter >> joinsLayout [ + + | joinsLayout | + joinsLayout := SpBoxLayout newVertical + spacing: 4; + yourself. + self buttonJoins do: [ :each | joinsLayout add: each expand: false ]. + ^ joinsLayout +] + +{ #category : #accessing } +PyramidBorderBuilderPresenter >> paintInput [ + + ^ paintInput +] + +{ #category : #accessing } +PyramidBorderBuilderPresenter >> previewPresenter [ + + ^ previewPresenter +] + +{ #category : #actions } +PyramidBorderBuilderPresenter >> updatePreview [ + + | element | + element := BlElement new + geometry: (BlPolylineGeometry vertices: { + (0 @ 0). + (100 @ 0). + (50 @ 25). + (50 @ 50). + (0 @ 50) }); + outskirts: BlOutskirts centered; + position: 10 @ 10; + border: self builder build; + yourself. + self previewPresenter image: element exportAsForm +] + +{ #category : #accessing } +PyramidBorderBuilderPresenter >> widthInput [ + + ^ widthInput +] diff --git a/src/Pyramid-Bloc/PyramidContextMenuPlugin.class.st b/src/Pyramid-Bloc/PyramidContextMenuPlugin.class.st new file mode 100644 index 00000000..f641a4fd --- /dev/null +++ b/src/Pyramid-Bloc/PyramidContextMenuPlugin.class.st @@ -0,0 +1,103 @@ +Class { + #name : #PyramidContextMenuPlugin, + #superclass : #Object, + #traits : 'TPyramidPlugin', + #classTraits : 'TPyramidPlugin classTrait', + #instVars : [ + 'editor' + ], + #category : #'Pyramid-Bloc-plugin-context-menu' +} + +{ #category : #'class initialization' } +PyramidContextMenuPlugin class >> initialize [ + + PyramidPluginManager uniqueInstance removePlugin: self. + PyramidPluginManager uniqueInstance addPlugin: self +] + +{ #category : #adding } +PyramidContextMenuPlugin >> addPanelsOn: aPyramidSimpleWindow [ + + aPyramidSimpleWindow at: #selectionMenu addItem: [ :builder | + self menuContextOn: builder. + self menuBrowseAndInspectOn: builder ] +] + +{ #category : #'as yet unclassified' } +PyramidContextMenuPlugin >> connectOn: aPyramidEditor [ + + self editor: aPyramidEditor. +] + +{ #category : #accessing } +PyramidContextMenuPlugin >> editor [ + + ^ editor +] + +{ #category : #accessing } +PyramidContextMenuPlugin >> editor: anObject [ + + editor := anObject +] + +{ #category : #'as yet unclassified' } +PyramidContextMenuPlugin >> menuBrowseAndInspectOn: aBuilder [ + + aBuilder addGroupSingleSelection: [ :group :single | + group + addItem: [ :item | + item + icon: (self iconNamed: #nautilus); + name: 'Browse selected item'; + action: [ single browse ]; + yourself ]; + addItem: [ :item | + item + icon: (self iconNamed: #smallInspectIt); + name: 'Inspect selected item'; + action: [ single inspect ]; + yourself ]; + yourself ] order: 1. + + aBuilder addGroupMultiSelection: [ :group :multi | + group + addItem: [ :item | + item + icon: (self iconNamed: #nautilus); + name: 'Browse first item'; + action: [ multi first browse ]; + yourself ]; + addItem: [ :item | + item + icon: (self iconNamed: #smallInspectIt); + name: 'Inspect all items'; + action: [ multi inspect ]; + yourself ]; + yourself ] order: 1 +] + +{ #category : #'as yet unclassified' } +PyramidContextMenuPlugin >> menuContextOn: aBuilder [ + + aBuilder addGroupSingleSelection: [ :group :single | + group + addItem: [ :item | + item + icon: (self iconNamed: single systemIconName); + name: single id asSymbol , ' ' , single hash printString; + enabled: false; + yourself ]; + yourself ] order: 0. + + aBuilder addGroupMultiSelection: [ :group :multi | + group + addItem: [ :item | + item + icon: (self iconNamed: #collection); + name: multi size printString , ' elements'; + enabled: false; + yourself ]; + yourself ] order: 0 +] diff --git a/src/Pyramid-Bloc/PyramidOverlayBuilder.class.st b/src/Pyramid-Bloc/PyramidOverlayBuilder.class.st index e68178b6..69a41bfb 100644 --- a/src/Pyramid-Bloc/PyramidOverlayBuilder.class.st +++ b/src/Pyramid-Bloc/PyramidOverlayBuilder.class.st @@ -161,12 +161,12 @@ PyramidOverlayBuilder class >> selectionMakerBlock [ clipChildren: false. controller := PyramidSelectionMakerController new overlay: builder overlay; - keyboardPressed: ( builder at: #keyboardPressed); + keyboardPressed: (builder at: #keyboardPressed); yourself. - builder + builder at: #editor subscribeWith: [ :editor | - controller activeProject: editor activeProject ] ] + controller updateEditor: editor ] ] ] { #category : #'api - resizer' } diff --git a/src/Pyramid-Bloc/PyramidPluginHierarchy.class.st b/src/Pyramid-Bloc/PyramidPluginHierarchy.class.st index dbd510d4..c606f912 100644 --- a/src/Pyramid-Bloc/PyramidPluginHierarchy.class.st +++ b/src/Pyramid-Bloc/PyramidPluginHierarchy.class.st @@ -4,8 +4,8 @@ Class { #traits : 'TPyramidPlugin', #classTraits : 'TPyramidPlugin classTrait', #instVars : [ - 'activeProject', - 'view' + 'view', + 'editor' ], #category : #'Pyramid-Bloc-plugin-hierarchy' } @@ -24,14 +24,29 @@ PyramidPluginHierarchy >> addPanelsOn: aPyramidSimpleWindow [ makeTab: self view label: 'Tree' icon: (self iconNamed: #catalog) - order: 1 ] + order: 1 ]. + aPyramidSimpleWindow + at: #selectionMenu + addItem: [ :builder | self menuAddAndDeleteOn: builder ] ] { #category : #'as yet unclassified' } PyramidPluginHierarchy >> connectOn: aPyramidEditor [ - self view connectOn: aPyramidEditor. - + self editor: aPyramidEditor. + self view connectOn: aPyramidEditor +] + +{ #category : #accessing } +PyramidPluginHierarchy >> editor [ + + ^ editor +] + +{ #category : #accessing } +PyramidPluginHierarchy >> editor: anObject [ + + editor := anObject ] { #category : #initialization } @@ -40,6 +55,59 @@ PyramidPluginHierarchy >> initialize [ view := PyramidHierarchyPresenter new ] +{ #category : #'as yet unclassified' } +PyramidPluginHierarchy >> menuAddAndDeleteOn: aBuilder [ + + aBuilder addGroupEmptySelection: [ :group :empty | + group addItem: [ :anItem | + anItem + name: 'Add new root'; + icon: (self iconNamed: #add); + action: [ + (PyramidPopoverFactory + makeWithPresenter: (PyramidLibraryViewForRoot new + editor: self editor; + yourself) + relativeTo: self view + position: SpPopoverPosition right) popup ] ] ] order: 10. + + aBuilder addGroupSingleSelection: [ :group :single | + group addItem: [ :anItem | + anItem + name: 'Add new element'; + icon: (self iconNamed: #add); + action: [ + (PyramidPopoverFactory + makeWithPresenter: (PyramidLibraryViewForElement new + editor: self editor; + yourself) + relativeTo: self view + position: SpPopoverPosition right) popup ] ]. + group addItem: [ :anItem | + anItem + name: 'Remove selection'; + icon: (self iconNamed: #delete); + action: [ self editor activeProject removeSelection ] ] ] order: 10. + + aBuilder addGroupMultiSelection: [ :group :multi | + group addItem: [ :anItem | + anItem + name: 'Add new element'; + icon: (self iconNamed: #add); + action: [ + (PyramidPopoverFactory + makeWithPresenter: (PyramidLibraryViewForElement new + editor: self editor; + yourself) + relativeTo: self view + position: SpPopoverPosition right) popup ] ]. + group addItem: [ :anItem | + anItem + name: 'Remove selection'; + icon: (self iconNamed: #delete); + action: [ self editor activeProject removeSelection ] ] ] order: 10 +] + { #category : #initialization } PyramidPluginHierarchy >> view [ diff --git a/src/Pyramid-Bloc/PyramidSelectionMakerController.class.st b/src/Pyramid-Bloc/PyramidSelectionMakerController.class.st index 6deb4ee9..fb19ace4 100644 --- a/src/Pyramid-Bloc/PyramidSelectionMakerController.class.st +++ b/src/Pyramid-Bloc/PyramidSelectionMakerController.class.st @@ -9,7 +9,8 @@ Class { 'isDragging', 'elementPreview', 'keyboardPressed', - 'selectionStrategy' + 'selectionStrategy', + 'subMenu' ], #category : #'Pyramid-Bloc-plugin-space' } @@ -29,10 +30,8 @@ PyramidSelectionMakerController >> activeProject: anObject [ { #category : #adding } PyramidSelectionMakerController >> addEventsTo: aBlElement [ - - aBlElement when: BlDoubleClickEvent do: [ :evt | self doubleClickEvent: evt ]. aBlElement when: BlMouseDownEvent do: [ :evt | - evt primaryButtonPressed ifTrue: [ + (evt primaryButtonPressed or: [ evt secondaryButtonPressed ]) ifTrue: [ self isDragging: true. self dragOrigin: evt position. self startDragEvent ] ]. @@ -41,9 +40,9 @@ PyramidSelectionMakerController >> addEventsTo: aBlElement [ do: [ :evt | self isDragging ifTrue: [ self dragEvent: evt position ] ]. aBlElement when: BlMouseUpEvent do: [ :evt | - evt primaryButtonPressed ifTrue: [ + (evt primaryButtonPressed or: [ evt secondaryButtonPressed ]) ifTrue: [ self isDragging: false. - self endDragEvent ] ] + self endDragEvent: evt ] ] ] { #category : #'as yet unclassified' } @@ -110,12 +109,6 @@ PyramidSelectionMakerController >> computeStrategy [ PyramidSelectionMakerDoNothingStrategy new ] -{ #category : #'as yet unclassified' } -PyramidSelectionMakerController >> doubleClickEvent: anEvent [ - - self computeNewSelectionForPosition: anEvent position. -] - { #category : #'as yet unclassified' } PyramidSelectionMakerController >> dragEvent: aPosition [ @@ -144,11 +137,17 @@ PyramidSelectionMakerController >> elementPreview [ ] { #category : #'as yet unclassified' } -PyramidSelectionMakerController >> endDragEvent [ +PyramidSelectionMakerController >> endDragEvent: evt [ - self elementPreview - visibility: BlVisibility gone. - self computeNewSelectionInBounds: self elementPreview boundsInSpace. + self elementPreview visibility: BlVisibility gone. + (evt position closeTo: self dragOrigin epsilon: 2) + ifTrue: [ self selectSingleElement: evt ] + ifFalse: [ + self computeNewSelectionInBounds: self elementPreview boundsInSpace ]. + + evt secondaryButtonPressed ifTrue: [ + (self subMenu builder + menuFor: self activeProject selection) openWithSpecAt: self currentHand position ] ] { #category : #initialization } @@ -162,6 +161,7 @@ PyramidSelectionMakerController >> initialize [ zIndex: 200; yourself. selectionStrategy := PyramidSelectionMakerNoKeyStrategy new. + subMenu := SpNullPresenter new ] { #category : #accessing } @@ -202,6 +202,12 @@ PyramidSelectionMakerController >> overlay: anObject [ self addEventsTo: anObject overlayElement. ] +{ #category : #'as yet unclassified' } +PyramidSelectionMakerController >> selectSingleElement: anEvent [ + + self computeNewSelectionForPosition: anEvent position +] + { #category : #accessing } PyramidSelectionMakerController >> selectionStrategy [ @@ -222,3 +228,22 @@ PyramidSelectionMakerController >> startDragEvent [ size: 0 @ 0; visibility: BlVisibility visible ] + +{ #category : #accessing } +PyramidSelectionMakerController >> subMenu [ + + ^ subMenu +] + +{ #category : #accessing } +PyramidSelectionMakerController >> subMenu: anObject [ + + subMenu := anObject +] + +{ #category : #'as yet unclassified' } +PyramidSelectionMakerController >> updateEditor: anEditor [ + + self activeProject: anEditor activeProject. + self subMenu: (anEditor window services at: #selectionMenu). +] diff --git a/src/Pyramid-Bloc/PyramidTreeMenuGroup.class.st b/src/Pyramid-Bloc/PyramidTreeMenuGroup.class.st deleted file mode 100644 index 49bfb00b..00000000 --- a/src/Pyramid-Bloc/PyramidTreeMenuGroup.class.st +++ /dev/null @@ -1,95 +0,0 @@ -Class { - #name : #PyramidTreeMenuGroup, - #superclass : #Object, - #category : #'Pyramid-Bloc-plugin-hierarchy' -} - -{ #category : #'as yet unclassified' } -PyramidTreeMenuGroup class >> addNewElement: aPyramidTreePresenter [ - - aPyramidTreePresenter editor activeProject selection ifEmpty: [ - ^ [ :g | ] ]. - - ^ [ :aGroup | - aGroup addItem: [ :anItem | - anItem - name: 'Add new element'; - icon: (self iconNamed: #add); - action: [ - (PyramidPopoverFactory - makeWithPresenter: (PyramidLibraryViewForElement new - editor: aPyramidTreePresenter editor; - yourself) - relativeTo: aPyramidTreePresenter - position: SpPopoverPosition right) popup ] ] ] -] - -{ #category : #'as yet unclassified' } -PyramidTreeMenuGroup class >> browseAndInspect: aPyramidTreePresenter [ - - | menuInspect menuBrowse | - aPyramidTreePresenter editor activeProject selection ifEmpty: [ - ^ [ :g | ] ]. - - menuInspect := SpMenuItemPresenter new icon: - (self iconNamed: #smallInspectIt). - menuBrowse := SpMenuItemPresenter new - name: 'Browse'; - icon: (self iconNamed: #nautilus); - action: [ - aPyramidTreePresenter editor activeProject selection - first browse ]; - yourself. - - aPyramidTreePresenter editor activeProject selection size = 1 - ifTrue: [ - menuInspect - name: 'Inspect selected item'; - action: [ aPyramidTreePresenter editor activeProject selection first inspect ] ] - ifFalse: [ - menuInspect - name: 'Inspect selected group'; - action: [ aPyramidTreePresenter editor activeProject selection asArray inspect ] ]. - - ^ [ :aGroup | - aGroup - addMenuItem: menuBrowse; - addMenuItem: menuInspect ] -] - -{ #category : #'as yet unclassified' } -PyramidTreeMenuGroup class >> contextNotWorkingButton: aPyramidTreePresenter [ - - | context selection | - selection := aPyramidTreePresenter editor activeProject selection. - context := SpMenuItemPresenter new - enabled: false; - yourself. - selection ifEmpty: [ context name: 'No element in selection' ]. - - selection size = 1 ifTrue: [ - context icon: (self iconNamed: selection systemIconName). - context name: - selection first id asSymbol , ' ' - , selection first hash printString ]. - selection size > 1 ifTrue: [ - context icon: (self iconNamed: #collection). - context name: selection size printString , ' elements' ]. - - ^ [ :aGroup | aGroup addMenuItem: context ] -] - -{ #category : #'as yet unclassified' } -PyramidTreeMenuGroup class >> removeElement: aPyramidTreePresenter [ - - aPyramidTreePresenter editor activeProject selection ifEmpty: [ - ^ [ :g | ] ]. - - ^ [ :aGroup | - aGroup addItem: [ :anItem | - anItem - name: 'Remove selection'; - icon: (self iconNamed: #delete); - action: [ - aPyramidTreePresenter editor activeProject removeSelection ] ] ] -] diff --git a/src/Pyramid-Bloc/PyramidTreePresenter.class.st b/src/Pyramid-Bloc/PyramidTreePresenter.class.st index da339692..40366109 100644 --- a/src/Pyramid-Bloc/PyramidTreePresenter.class.st +++ b/src/Pyramid-Bloc/PyramidTreePresenter.class.st @@ -29,20 +29,11 @@ PyramidTreePresenter >> connectOn: aPyramidEditor [ PyramidTreePresenter >> contextMenu [ | menu | - menu := SpMenuPresenter new. - self contextMenuGroups do: [ :each | menu addGroup: each ]. + menu := (self editor window services at: #selectionMenu) builder menuFor: self editor activeProject selection. + ^ menu ] -{ #category : #api } -PyramidTreePresenter >> contextMenuGroups [ - - ^ { (PyramidTreeMenuGroup contextNotWorkingButton: self). - (PyramidTreeMenuGroup browseAndInspect: self). - (PyramidTreeMenuGroup addNewElement: self). - (PyramidTreeMenuGroup removeElement: self) } -] - { #category : #layout } PyramidTreePresenter >> defaultLayout [ diff --git a/src/Pyramid/PyramidMenuPanelBuilder.class.st b/src/Pyramid/PyramidMenuPanelBuilder.class.st new file mode 100644 index 00000000..ac63c5f9 --- /dev/null +++ b/src/Pyramid/PyramidMenuPanelBuilder.class.st @@ -0,0 +1,91 @@ +Class { + #name : #PyramidMenuPanelBuilder, + #superclass : #PyramidPanelBuilder, + #instVars : [ + 'item', + 'emptyGroups', + 'multiGroups', + 'singleGroups' + ], + #category : #'Pyramid-views' +} + +{ #category : #adding } +PyramidMenuPanelBuilder >> addGroupEmptySelection: aGroupBlock order: aNumber [ + + self emptyGroups add: aNumber -> aGroupBlock +] + +{ #category : #adding } +PyramidMenuPanelBuilder >> addGroupMultiSelection: aGroupBlock order: aNumber [ + + self multiGroups add: aNumber -> aGroupBlock +] + +{ #category : #adding } +PyramidMenuPanelBuilder >> addGroupSingleSelection: aGroupBlock order: aNumber [ + + self singleGroups add: aNumber -> aGroupBlock +] + +{ #category : #'as yet unclassified' } +PyramidMenuPanelBuilder >> buildMenuFrom: aGroupOfBlocks with: aTarget [ + + | menu group | + menu := SpMenuPresenter new. + + (aGroupOfBlocks sorted: [ :a :b | a key <= b key ])do: [ :each | + group := SpMenuGroupPresenter new. + each value value: group value: aTarget. + menu addMenuGroup: group ]. + ^ menu +] + +{ #category : #accessing } +PyramidMenuPanelBuilder >> emptyGroups [ + + ^ emptyGroups +] + +{ #category : #initialization } +PyramidMenuPanelBuilder >> initialize [ + + emptyGroups := OrderedCollection new. + multiGroups := OrderedCollection new. + singleGroups := OrderedCollection new +] + +{ #category : #accessing } +PyramidMenuPanelBuilder >> item [ +] + +{ #category : #'as yet unclassified' } +PyramidMenuPanelBuilder >> menuFor: aCollection [ + + aCollection ifEmpty: [ ^ self buildMenuFrom: self emptyGroups with: nil ]. + aCollection size = 1 ifTrue: [ + ^ self buildMenuFrom: self singleGroups with: aCollection first ]. + ^ self buildMenuFrom: self multiGroups with: aCollection +] + +{ #category : #accessing } +PyramidMenuPanelBuilder >> multiGroups [ + + ^ multiGroups +] + +{ #category : #accessing } +PyramidMenuPanelBuilder >> presenterOf: aCollectionOfItems [ + + ^ SpNullPresenter new +] + +{ #category : #initialization } +PyramidMenuPanelBuilder >> reset [ +] + +{ #category : #accessing } +PyramidMenuPanelBuilder >> singleGroups [ + + ^ singleGroups +] diff --git a/src/Pyramid/PyramidPanelModel.class.st b/src/Pyramid/PyramidPanelModel.class.st index 5384c12d..b9485ade 100644 --- a/src/Pyramid/PyramidPanelModel.class.st +++ b/src/Pyramid/PyramidPanelModel.class.st @@ -10,6 +10,14 @@ Class { #category : #'Pyramid-views' } +{ #category : #accessing } +PyramidPanelModel class >> menu [ + + ^ self new + builder: PyramidMenuPanelBuilder new; + yourself +] + { #category : #accessing } PyramidPanelModel class >> presenter [ diff --git a/src/Pyramid/PyramidPluginSelection.class.st b/src/Pyramid/PyramidPluginSelection.class.st index 1bb72e03..45a624c0 100644 --- a/src/Pyramid/PyramidPluginSelection.class.st +++ b/src/Pyramid/PyramidPluginSelection.class.st @@ -24,7 +24,7 @@ PyramidPluginSelection >> addPanelsOn: aPyramidSimpleWindow [ makeTab: self view label: 'Playground' icon: (self iconNamed: #open) - order: 1 ] + order: 1 ]. ] { #category : #'as yet unclassified' } diff --git a/src/Pyramid/PyramidWindow.class.st b/src/Pyramid/PyramidWindow.class.st index c55e5d0b..ede45750 100644 --- a/src/Pyramid/PyramidWindow.class.st +++ b/src/Pyramid/PyramidWindow.class.st @@ -27,11 +27,12 @@ PyramidWindow >> initialize [ PyramidPanelModel toolbarHorizontal installOn: self at: #topLeft. PyramidPanelModel toolbarHorizontal installOn: self at: #topCenter. PyramidPanelModel toolbarHorizontal installOn: self at: #topRight. - PyramidPanelModel presenter installOn: self at: #space. - PyramidPanelModel tab installOn: self at: #tabLeft. - PyramidPanelModel tab installOn: self at: #tabRight + PyramidPanelModel tab installOn: self at: #tabRight. + PyramidPanelModel menu + installOn: self + at: #selectionMenu. ] { #category : #initialization } From ef448df1211c6f21fccb88f5c9206a25f205ae13 Mon Sep 17 00:00:00 2001 From: YannLEGOFF Date: Mon, 3 Jul 2023 16:53:56 +0200 Subject: [PATCH 08/14] [FT] - change space backgroud --- .../PyramidOverlayBuilder.class.st | 3 +- .../PyramidOverlaysManagerFactory.class.st | 6 +++ .../PyramidSelectionMakerController.class.st | 44 +++++++++++++++++-- .../PyramidTreePresenter.class.st | 4 +- 4 files changed, 51 insertions(+), 6 deletions(-) diff --git a/src/Pyramid-Bloc/PyramidOverlayBuilder.class.st b/src/Pyramid-Bloc/PyramidOverlayBuilder.class.st index 69a41bfb..5f4445a7 100644 --- a/src/Pyramid-Bloc/PyramidOverlayBuilder.class.st +++ b/src/Pyramid-Bloc/PyramidOverlayBuilder.class.st @@ -250,7 +250,8 @@ PyramidOverlayBuilder >> model [ { #category : #accessing } PyramidOverlayBuilder >> model: anObject [ - model := anObject + model := anObject. + self overlay model: anObject ] { #category : #accessing } diff --git a/src/Pyramid-Bloc/PyramidOverlaysManagerFactory.class.st b/src/Pyramid-Bloc/PyramidOverlaysManagerFactory.class.st index 2cf7a947..407f9552 100644 --- a/src/Pyramid-Bloc/PyramidOverlaysManagerFactory.class.st +++ b/src/Pyramid-Bloc/PyramidOverlaysManagerFactory.class.st @@ -18,6 +18,12 @@ PyramidOverlaysManagerFactory class >> editManager [ factory at: #size put: 600 @ 400. factory at: #origin put: 50 @ 50. factory at: #editor put: nil. + factory at: #spaceColor put: Color gray. + + (factory model at: #spaceColor) + subcribe: factory + with: [ :color | factory manager space root background: color ]. + (factory model at: #spaceColor)triggerCallbacks. factory manager space when: BlKeyDownEvent do: [ :evt | (factory model at: #keyboardPressed) object add: evt key. diff --git a/src/Pyramid-Bloc/PyramidSelectionMakerController.class.st b/src/Pyramid-Bloc/PyramidSelectionMakerController.class.st index fb19ace4..e7543ef9 100644 --- a/src/Pyramid-Bloc/PyramidSelectionMakerController.class.st +++ b/src/Pyramid-Bloc/PyramidSelectionMakerController.class.st @@ -145,9 +145,7 @@ PyramidSelectionMakerController >> endDragEvent: evt [ ifFalse: [ self computeNewSelectionInBounds: self elementPreview boundsInSpace ]. - evt secondaryButtonPressed ifTrue: [ - (self subMenu builder - menuFor: self activeProject selection) openWithSpecAt: self currentHand position ] + evt secondaryButtonPressed ifTrue: [ self showSubMenu ] ] { #category : #initialization } @@ -220,6 +218,46 @@ PyramidSelectionMakerController >> selectionStrategy: anObject [ selectionStrategy := anObject ] +{ #category : #'as yet unclassified' } +PyramidSelectionMakerController >> showSubMenu [ + + | menu | + menu := self subMenu builder menuFor: self activeProject selection. + menu addGroup: [ :group | + group addItem: [ :item | + item + name: 'Space backgorund color'; + subMenu: (SpMenuPresenter new + addItem: [ :subItem | + subItem + name: 'Color black'; + icon: [ + (self overlay model at: #spaceColor) object = Color black + ifTrue: [ self iconNamed: #testGreen ] + ifFalse: [ self iconNamed: #testNotRun ] ]; + action: [ + (self overlay model at: #spaceColor) object: Color black ] ]; + addItem: [ :subItem | + subItem + name: 'Color gray'; + icon: [ + (self overlay model at: #spaceColor) object = Color gray + ifTrue: [ self iconNamed: #testGreen ] + ifFalse: [ self iconNamed: #testNotRun ] ]; + action: [ + (self overlay model at: #spaceColor) object: Color gray ] ]; + addItem: [ :subItem | + subItem + name: 'Color white'; + icon: [ + (self overlay model at: #spaceColor) object = Color white + ifTrue: [ self iconNamed: #testGreen ] + ifFalse: [ self iconNamed: #testNotRun ] ]; + action: [ + (self overlay model at: #spaceColor) object: Color white ] ]) ] ]. + menu openWithSpecAt: self currentHand position +] + { #category : #'as yet unclassified' } PyramidSelectionMakerController >> startDragEvent [ diff --git a/src/Pyramid-Bloc/PyramidTreePresenter.class.st b/src/Pyramid-Bloc/PyramidTreePresenter.class.st index 40366109..c28086f1 100644 --- a/src/Pyramid-Bloc/PyramidTreePresenter.class.st +++ b/src/Pyramid-Bloc/PyramidTreePresenter.class.st @@ -29,8 +29,8 @@ PyramidTreePresenter >> connectOn: aPyramidEditor [ PyramidTreePresenter >> contextMenu [ | menu | - menu := (self editor window services at: #selectionMenu) builder menuFor: self editor activeProject selection. - + menu := (self editor window services at: #selectionMenu) builder + menuFor: self editor activeProject selection. ^ menu ] From b1d4e2c4a044dabf39e17470df05df1e1535c942 Mon Sep 17 00:00:00 2001 From: YannLEGOFF Date: Tue, 4 Jul 2023 08:41:54 +0200 Subject: [PATCH 09/14] [Clean] - better submenus for space selector --- .../PyramidSelectionMakerController.class.st | 46 +++++++------------ 1 file changed, 17 insertions(+), 29 deletions(-) diff --git a/src/Pyramid-Bloc/PyramidSelectionMakerController.class.st b/src/Pyramid-Bloc/PyramidSelectionMakerController.class.st index e7543ef9..0246c598 100644 --- a/src/Pyramid-Bloc/PyramidSelectionMakerController.class.st +++ b/src/Pyramid-Bloc/PyramidSelectionMakerController.class.st @@ -221,40 +221,28 @@ PyramidSelectionMakerController >> selectionStrategy: anObject [ { #category : #'as yet unclassified' } PyramidSelectionMakerController >> showSubMenu [ - | menu | + | menu colors chooseColorSubMenu | menu := self subMenu builder menuFor: self activeProject selection. + colors := { + Color white. + Color gray. + Color black }. + chooseColorSubMenu := SpMenuPresenter new. + colors do: [ :color | + chooseColorSubMenu addItem: [ :item | + item + name: color printString; + action: [ (self overlay model at: #spaceColor) object: color ]; + icon: [ + (self overlay model at: #spaceColor) object = color + ifTrue: [ self iconNamed: #testGreen ] + ifFalse: [ self iconNamed: #testNotRun ] ] ] ]. + menu addGroup: [ :group | group addItem: [ :item | item name: 'Space backgorund color'; - subMenu: (SpMenuPresenter new - addItem: [ :subItem | - subItem - name: 'Color black'; - icon: [ - (self overlay model at: #spaceColor) object = Color black - ifTrue: [ self iconNamed: #testGreen ] - ifFalse: [ self iconNamed: #testNotRun ] ]; - action: [ - (self overlay model at: #spaceColor) object: Color black ] ]; - addItem: [ :subItem | - subItem - name: 'Color gray'; - icon: [ - (self overlay model at: #spaceColor) object = Color gray - ifTrue: [ self iconNamed: #testGreen ] - ifFalse: [ self iconNamed: #testNotRun ] ]; - action: [ - (self overlay model at: #spaceColor) object: Color gray ] ]; - addItem: [ :subItem | - subItem - name: 'Color white'; - icon: [ - (self overlay model at: #spaceColor) object = Color white - ifTrue: [ self iconNamed: #testGreen ] - ifFalse: [ self iconNamed: #testNotRun ] ]; - action: [ - (self overlay model at: #spaceColor) object: Color white ] ]) ] ]. + subMenu: chooseColorSubMenu ] ]. menu openWithSpecAt: self currentHand position ] From 8f34ef6400017d6610489c496a1962969f508dc1 Mon Sep 17 00:00:00 2001 From: YannLEGOFF Date: Tue, 4 Jul 2023 09:51:49 +0200 Subject: [PATCH 10/14] [Fix] - better test to check if the window can open or not --- src/Pyramid-Tests/PyramidEditorTest.class.st | 12 ++++++++---- .../PyramidSavingServiceTest.class.st | 16 ++++++++++------ src/Pyramid/PyramidWindow.class.st | 3 ++- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/Pyramid-Tests/PyramidEditorTest.class.st b/src/Pyramid-Tests/PyramidEditorTest.class.st index 18ebd288..2655741b 100644 --- a/src/Pyramid-Tests/PyramidEditorTest.class.st +++ b/src/Pyramid-Tests/PyramidEditorTest.class.st @@ -5,13 +5,17 @@ Class { } { #category : #tests } -PyramidEditorTest >> testOpenNewEditor [ +PyramidEditorTest >> testOpenNewEditor [ - | editor | + | editor spec | editor := PyramidPluginManager uniqueInstance makeEditor. - editor window open. + spec := editor window open. + (Duration milliSeconds: 10) wait. self assert: editor window isOpen. - + self assert: spec window isInWorld. + editor window close. + (Duration milliSeconds: 10) wait. self assert: editor window isClosed. + self deny: spec window isInWorld ] diff --git a/src/Pyramid-Tests/PyramidSavingServiceTest.class.st b/src/Pyramid-Tests/PyramidSavingServiceTest.class.st index 2ad49542..9589563e 100644 --- a/src/Pyramid-Tests/PyramidSavingServiceTest.class.st +++ b/src/Pyramid-Tests/PyramidSavingServiceTest.class.st @@ -89,12 +89,12 @@ PyramidSavingServiceTest >> testCanSave [ model savingMethodName: 'aPyramidSavingMethod'. model savingPackageName: 'PyramidSavingPackage'. self assert: self savingService canSave. - + model savingClassName: 'PyramidSavingClass'. model savingMethodName: 'aPyramidSavingMethod'. model savingPackageName: 'PyramidSavingPackage-abc'. self deny: self savingService canSave. - + model savingClassName: 'PyramidSavingClass'. model savingMethodName: 'aPyramidSavingMethod'. model savingPackageName: 'PyramidSavingPackage-Abc-Def'. @@ -139,8 +139,10 @@ PyramidSavingServiceTest >> testSave [ self savingService savingModel: model. self deny: (self savingClass classSide canUnderstand: #classMethod). - self deny: (self savingClass instanceSide canUnderstand: #classMethod). - self deny: (self savingClass classSide canUnderstand: #instanceMethod). + self deny: + (self savingClass instanceSide canUnderstand: #classMethod). + self deny: + (self savingClass classSide canUnderstand: #instanceMethod). self deny: (self savingClass instanceSide canUnderstand: #instanceMethod). @@ -148,12 +150,14 @@ PyramidSavingServiceTest >> testSave [ model savingMethodName: 'classMethod'. self savingService save. self assert: (self savingClass classSide canUnderstand: #classMethod). - self deny: (self savingClass instanceSide canUnderstand: #classMethod). + self deny: + (self savingClass instanceSide canUnderstand: #classMethod). model onInstance. model savingMethodName: 'instanceMethod'. self savingService save. - self deny: (self savingClass classSide canUnderstand: #instanceMethod). + self deny: + (self savingClass classSide canUnderstand: #instanceMethod). self assert: (self savingClass instanceSide canUnderstand: #instanceMethod) ] diff --git a/src/Pyramid/PyramidWindow.class.st b/src/Pyramid/PyramidWindow.class.st index ede45750..49d1d685 100644 --- a/src/Pyramid/PyramidWindow.class.st +++ b/src/Pyramid/PyramidWindow.class.st @@ -66,7 +66,8 @@ PyramidWindow >> open [ | spec | spec := self presenter asWindow open. - spec maximize + spec maximize. + ^ spec ] { #category : #private } From a873fd927f259fbab4f59618d2a9751e17ac7c81 Mon Sep 17 00:00:00 2001 From: YannLEGOFF Date: Tue, 4 Jul 2023 10:39:47 +0200 Subject: [PATCH 11/14] [FT] - add test to for space maker --- src/Pyramid-Tests/PyramidEditorTest.class.st | 6 ++-- .../PyramidSpacePresenterTest.class.st | 31 +++++++++++++++++++ 2 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 src/Pyramid-Tests/PyramidSpacePresenterTest.class.st diff --git a/src/Pyramid-Tests/PyramidEditorTest.class.st b/src/Pyramid-Tests/PyramidEditorTest.class.st index 2655741b..55f3c122 100644 --- a/src/Pyramid-Tests/PyramidEditorTest.class.st +++ b/src/Pyramid-Tests/PyramidEditorTest.class.st @@ -10,12 +10,14 @@ PyramidEditorTest >> testOpenNewEditor [ | editor spec | editor := PyramidPluginManager uniqueInstance makeEditor. spec := editor window open. - (Duration milliSeconds: 10) wait. + (Duration milliSeconds: 10) wait. + self currentWorld doOneCycle. self assert: editor window isOpen. self assert: spec window isInWorld. editor window close. - (Duration milliSeconds: 10) wait. + (Duration milliSeconds: 10) wait. + self currentWorld doOneCycle. self assert: editor window isClosed. self deny: spec window isInWorld ] diff --git a/src/Pyramid-Tests/PyramidSpacePresenterTest.class.st b/src/Pyramid-Tests/PyramidSpacePresenterTest.class.st new file mode 100644 index 00000000..7624dd51 --- /dev/null +++ b/src/Pyramid-Tests/PyramidSpacePresenterTest.class.st @@ -0,0 +1,31 @@ +Class { + #name : #PyramidSpacePresenterTest, + #superclass : #TestCase, + #category : #'Pyramid-Tests-Cases' +} + +{ #category : #tests } +PyramidSpacePresenterTest >> testMakeSpacePresenter [ + + | morphPresenter overlaysManager spec | + overlaysManager := PyramidOverlaysManager new. + morphPresenter := PyramidSpacePresenter new + overlaysManager: overlaysManager; + makeSpacePresenter. + self + assert: overlaysManager space host containerMorph + equals: morphPresenter morph. + self deny: overlaysManager space isOpened. + + spec := morphPresenter open. + (Duration milliSeconds: 10) wait. + self currentWorld doOneCycle. + self assert: spec window isInWorld. + self assert: overlaysManager space isOpened. + + spec close. + (Duration milliSeconds: 10) wait. + self currentWorld doOneCycle. + self deny: spec window isInWorld. + self deny: overlaysManager space isOpened. +] From 6dc60995a3993705600d398f4a1cf5c7e1a93989 Mon Sep 17 00:00:00 2001 From: YannLEGOFF Date: Tue, 4 Jul 2023 12:51:42 +0200 Subject: [PATCH 12/14] [Trying] - Check correct world renderer --- .../PyramidSpacePresenterTest.class.st | 7 ++++--- src/Pyramid-Tests/PyramidWindowTest.class.st | 16 ++++++++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/Pyramid-Tests/PyramidSpacePresenterTest.class.st b/src/Pyramid-Tests/PyramidSpacePresenterTest.class.st index 7624dd51..3071c943 100644 --- a/src/Pyramid-Tests/PyramidSpacePresenterTest.class.st +++ b/src/Pyramid-Tests/PyramidSpacePresenterTest.class.st @@ -8,6 +8,7 @@ Class { PyramidSpacePresenterTest >> testMakeSpacePresenter [ | morphPresenter overlaysManager spec | + self currentWorld displayWorld. overlaysManager := PyramidOverlaysManager new. morphPresenter := PyramidSpacePresenter new overlaysManager: overlaysManager; @@ -16,16 +17,16 @@ PyramidSpacePresenterTest >> testMakeSpacePresenter [ assert: overlaysManager space host containerMorph equals: morphPresenter morph. self deny: overlaysManager space isOpened. - + spec := morphPresenter open. (Duration milliSeconds: 10) wait. self currentWorld doOneCycle. self assert: spec window isInWorld. self assert: overlaysManager space isOpened. - + spec close. (Duration milliSeconds: 10) wait. self currentWorld doOneCycle. self deny: spec window isInWorld. - self deny: overlaysManager space isOpened. + self deny: overlaysManager space isOpened ] diff --git a/src/Pyramid-Tests/PyramidWindowTest.class.st b/src/Pyramid-Tests/PyramidWindowTest.class.st index 3d5db0f4..d0e3e4c7 100644 --- a/src/Pyramid-Tests/PyramidWindowTest.class.st +++ b/src/Pyramid-Tests/PyramidWindowTest.class.st @@ -53,6 +53,22 @@ PyramidWindowTest >> testServices [ self assert:( buttons at: 4) equals: t4. ] +{ #category : #tests } +PyramidWindowTest >> testWorldRenderer [ + + | worldRenderer | + worldRenderer := self currentWorld worldState worldRenderer. + self + deny: [ worldRenderer class = BlMorphicWorldRenderer ] + description: 'BlMorphicWorldRenderer'. + self + deny: [ worldRenderer class = NullWorldRenderer ] + description: 'NullWorldRenderer'. + self + assert: [ worldRenderer class = OSWorldRenderer ] + description: 'OSWorldRenderer' +] + { #category : #accessing } PyramidWindowTest >> window [ ^ window From b7e272e02f83e172633ba80a985239a0ac54e8c6 Mon Sep 17 00:00:00 2001 From: YannLEGOFF Date: Tue, 4 Jul 2023 15:27:31 +0200 Subject: [PATCH 13/14] [In progress] - Check for CI --- .../PyramidSpacePresenterTest.class.st | 36 +++++++++++++++++++ src/Pyramid-Tests/PyramidWindowTest.class.st | 16 --------- 2 files changed, 36 insertions(+), 16 deletions(-) diff --git a/src/Pyramid-Tests/PyramidSpacePresenterTest.class.st b/src/Pyramid-Tests/PyramidSpacePresenterTest.class.st index 3071c943..f0048d0a 100644 --- a/src/Pyramid-Tests/PyramidSpacePresenterTest.class.st +++ b/src/Pyramid-Tests/PyramidSpacePresenterTest.class.st @@ -4,6 +4,12 @@ Class { #category : #'Pyramid-Tests-Cases' } +{ #category : #tests } +PyramidSpacePresenterTest >> testIsInteractive [ + + self assert: Smalltalk isInteractiveGraphic +] + { #category : #tests } PyramidSpacePresenterTest >> testMakeSpacePresenter [ @@ -30,3 +36,33 @@ PyramidSpacePresenterTest >> testMakeSpacePresenter [ self deny: spec window isInWorld. self deny: overlaysManager space isOpened ] + +{ #category : #tests } +PyramidSpacePresenterTest >> testSpace [ + + | space | + space := BlSpace new. + self deny: space isOpened. + space show. + (Duration milliSeconds: 100) wait. + self assert: space isOpened. + space close. + (Duration milliSeconds: 100) wait. + self deny: space isOpened +] + +{ #category : #tests } +PyramidSpacePresenterTest >> testWorldRenderer [ + + | worldRenderer | + worldRenderer := self currentWorld worldState worldRenderer. + self + deny: [ worldRenderer class = BlMorphicWorldRenderer ] + description: 'BlMorphicWorldRenderer'. + self + deny: [ worldRenderer class = NullWorldRenderer ] + description: 'NullWorldRenderer'. + self + assert: [ worldRenderer class = OSWorldRenderer ] + description: 'OSWorldRenderer' +] diff --git a/src/Pyramid-Tests/PyramidWindowTest.class.st b/src/Pyramid-Tests/PyramidWindowTest.class.st index d0e3e4c7..3d5db0f4 100644 --- a/src/Pyramid-Tests/PyramidWindowTest.class.st +++ b/src/Pyramid-Tests/PyramidWindowTest.class.st @@ -53,22 +53,6 @@ PyramidWindowTest >> testServices [ self assert:( buttons at: 4) equals: t4. ] -{ #category : #tests } -PyramidWindowTest >> testWorldRenderer [ - - | worldRenderer | - worldRenderer := self currentWorld worldState worldRenderer. - self - deny: [ worldRenderer class = BlMorphicWorldRenderer ] - description: 'BlMorphicWorldRenderer'. - self - deny: [ worldRenderer class = NullWorldRenderer ] - description: 'NullWorldRenderer'. - self - assert: [ worldRenderer class = OSWorldRenderer ] - description: 'OSWorldRenderer' -] - { #category : #accessing } PyramidWindowTest >> window [ ^ window From 0a8603506d7d799ccef9424a3f625c772767685e Mon Sep 17 00:00:00 2001 From: YannLEGOFF Date: Tue, 4 Jul 2023 15:46:01 +0200 Subject: [PATCH 14/14] [Fix] - CI should work, remove test not working with headless --- src/Pyramid-Tests/PyramidEditorTest.class.st | 28 +++++++++- .../PyramidSpacePresenterTest.class.st | 51 +------------------ 2 files changed, 29 insertions(+), 50 deletions(-) diff --git a/src/Pyramid-Tests/PyramidEditorTest.class.st b/src/Pyramid-Tests/PyramidEditorTest.class.st index 55f3c122..7af33d8e 100644 --- a/src/Pyramid-Tests/PyramidEditorTest.class.st +++ b/src/Pyramid-Tests/PyramidEditorTest.class.st @@ -5,9 +5,11 @@ Class { } { #category : #tests } -PyramidEditorTest >> testOpenNewEditor [ +PyramidEditorTest >> testOpenNewEditorWithSpacePluginInstalled [ + "This test does not work on a headless vm. The current CI use a headless vm." | editor spec | + Smalltalk isInteractiveGraphic ifFalse: [ ^ self skip ]. editor := PyramidPluginManager uniqueInstance makeEditor. spec := editor window open. (Duration milliSeconds: 10) wait. @@ -21,3 +23,27 @@ PyramidEditorTest >> testOpenNewEditor [ self assert: editor window isClosed. self deny: spec window isInWorld ] + +{ #category : #tests } +PyramidEditorTest >> testOpenNewEditorWithSpacePluginUninstalled [ + + | editor spec | + editor := PyramidEditorBuilder new + plugins: + (PyramidPluginManager uniqueInstance pluginClasses + reject: [ :class | class name = #PyramidSpacePlugin ] + thenCollect: [ :class | class new ]); + build. + + spec := editor window open. + (Duration milliSeconds: 10) wait. + self currentWorld doOneCycle. + self assert: editor window isOpen. + self assert: spec window isInWorld. + + editor window close. + (Duration milliSeconds: 10) wait. + self currentWorld doOneCycle. + self assert: editor window isClosed. + self deny: spec window isInWorld +] diff --git a/src/Pyramid-Tests/PyramidSpacePresenterTest.class.st b/src/Pyramid-Tests/PyramidSpacePresenterTest.class.st index f0048d0a..8f66e03e 100644 --- a/src/Pyramid-Tests/PyramidSpacePresenterTest.class.st +++ b/src/Pyramid-Tests/PyramidSpacePresenterTest.class.st @@ -4,16 +4,11 @@ Class { #category : #'Pyramid-Tests-Cases' } -{ #category : #tests } -PyramidSpacePresenterTest >> testIsInteractive [ - - self assert: Smalltalk isInteractiveGraphic -] - { #category : #tests } PyramidSpacePresenterTest >> testMakeSpacePresenter [ - | morphPresenter overlaysManager spec | + | morphPresenter overlaysManager | + self currentWorld displayWorld. overlaysManager := PyramidOverlaysManager new. morphPresenter := PyramidSpacePresenter new @@ -22,47 +17,5 @@ PyramidSpacePresenterTest >> testMakeSpacePresenter [ self assert: overlaysManager space host containerMorph equals: morphPresenter morph. - self deny: overlaysManager space isOpened. - - spec := morphPresenter open. - (Duration milliSeconds: 10) wait. - self currentWorld doOneCycle. - self assert: spec window isInWorld. - self assert: overlaysManager space isOpened. - - spec close. - (Duration milliSeconds: 10) wait. - self currentWorld doOneCycle. - self deny: spec window isInWorld. self deny: overlaysManager space isOpened ] - -{ #category : #tests } -PyramidSpacePresenterTest >> testSpace [ - - | space | - space := BlSpace new. - self deny: space isOpened. - space show. - (Duration milliSeconds: 100) wait. - self assert: space isOpened. - space close. - (Duration milliSeconds: 100) wait. - self deny: space isOpened -] - -{ #category : #tests } -PyramidSpacePresenterTest >> testWorldRenderer [ - - | worldRenderer | - worldRenderer := self currentWorld worldState worldRenderer. - self - deny: [ worldRenderer class = BlMorphicWorldRenderer ] - description: 'BlMorphicWorldRenderer'. - self - deny: [ worldRenderer class = NullWorldRenderer ] - description: 'NullWorldRenderer'. - self - assert: [ worldRenderer class = OSWorldRenderer ] - description: 'OSWorldRenderer' -]