Skip to content

Commit

Permalink
Merge branch 'main' into Issue_0110
Browse files Browse the repository at this point in the history
  • Loading branch information
Nyan11 authored Dec 17, 2023
2 parents 62a083d + 7385939 commit 1b0d0e1
Show file tree
Hide file tree
Showing 23 changed files with 249 additions and 100 deletions.
6 changes: 4 additions & 2 deletions src/BaselineOfPyramid/BaselineOfPyramid.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ BaselineOfPyramid >> baseline: spec [
self dependencies: spec.
spec
package: #Pyramid;
package: #'Pyramid-IDE' with: [ spec requires: #( #Pyramid ) ];
package: #'Pyramid-Bloc'
with: [ spec requires: #( #Pyramid #Bloc #BlocSerialization) ];
package: #'Pyramid-Tests' with: [ spec requires: #( #Pyramid #'Pyramid-Bloc' ) ];
with: [ spec requires: #( #Pyramid #Bloc #BlocSerialization ) ];
package: #'Pyramid-Tests'
with: [ spec requires: #( #Pyramid #'Pyramid-Bloc' ) ];
package: #'Pyramid-Examples'
with: [ spec requires: #( #Pyramid ) ];
package: #'Pyramid-IDE' with: [ spec requires: #( #Pyramid ) ] ]
Expand Down
6 changes: 3 additions & 3 deletions src/Pyramid-Bloc/BlRadialGradientPaint.extension.st
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ Extension { #name : #BlRadialGradientPaint }
BlRadialGradientPaint >> = aBlPaint [

super = aBlPaint ifFalse: [ ^ false ].
^ self center = aBlPaint center and: [ self radius = aBlPaint radius ]
^ self innerCenter = aBlPaint innerCenter and: [ self innerRadius = aBlPaint innerRadius and: [ self outerCenter = aBlPaint outerCenter and: [ self outerRadius = aBlPaint outerRadius ] ] ]
]

{ #category : #'*Pyramid-Bloc' }
BlRadialGradientPaint >> selectOnGradientPaintInput: aPyramidGradientPaintInputPresenter [

super selectOnGradientPaintInput: aPyramidGradientPaintInputPresenter.
aPyramidGradientPaintInputPresenter radialButton click.
aPyramidGradientPaintInputPresenter centerInput value: self center.
aPyramidGradientPaintInputPresenter radiusInput value: self radius
aPyramidGradientPaintInputPresenter centerInput value: self outerCenter.
aPyramidGradientPaintInputPresenter radiusInput value: self outerRadius
]
2 changes: 1 addition & 1 deletion src/Pyramid-Bloc/PyramidBlocPlugin.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ PyramidBlocPlugin >> groupCollection: aCollection [
self editor propertiesManager commandExecutor
use: self groupCommand
on: { aCollection }
with: self editor projectModel roots
with: self editor projectModel firstLevelElements
]

{ #category : #accessing }
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Class {
#name : #PyramidLibraryPresenterForFirstLevelElement,
#superclass : #PyramidLibraryPresenter,
#category : #'Pyramid-Bloc-plugin-tree-library'
}

{ #category : #'as yet unclassified' }
PyramidLibraryPresenterForFirstLevelElement >> buttonAction [

self editor propertiesManager commandExecutor
use: PyramidAddToCollectionCommand new
on: { self editor projectModel firstLevelElements }
with: self list selectedItem blockMaker value
]

{ #category : #private }
PyramidLibraryPresenterForFirstLevelElement >> buttonLabel [

^ 'Add new on first level'
]
17 changes: 0 additions & 17 deletions src/Pyramid-Bloc/PyramidLibraryPresenterForRoot.class.st

This file was deleted.

5 changes: 3 additions & 2 deletions src/Pyramid-Bloc/PyramidMainExtension.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,11 @@ PyramidMainExtension >> projectModel: aProjectModel [
]

{ #category : #'as yet unclassified' }
PyramidMainExtension >> pyramidRootsChanged [
PyramidMainExtension >> pyramidFirstLevelElementsChanged [

self containerElement removeChildren.
(self projectModel roots asArray sorted: PyramidElevationSortFunction new) do: [ :each |
(self projectModel firstLevelElements asArray sorted:
PyramidElevationSortFunction new) do: [ :each |
each parent ifNotNil: [ :p | p removeChild: each ].
self containerElement addChild: each ]
]
Expand Down
2 changes: 1 addition & 1 deletion src/Pyramid-Bloc/PyramidSavePlugin.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ PyramidSavePlugin class >> openOn: aCollectionOfBlElement saveModel: aSaveModel
Error signal:
'Wrong installation of SavePlugin. Should only be one instance.' ].
savePlugin := savePlugin asArray first.
editor projectModel roots addAll: aCollectionOfBlElement.
editor projectModel firstLevelElements addAll: aCollectionOfBlElement.
savePlugin openOn: aSaveModel.
editor open
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ PyramidSaveProjectConfigurationController >> pyramidElementsChanged [
]

{ #category : #'as yet unclassified' }
PyramidSaveProjectConfigurationController >> pyramidRootsChanged [
PyramidSaveProjectConfigurationController >> pyramidFirstLevelElementsChanged [

self saveModel isSaved: false.
self updateWindowTitle
Expand Down
2 changes: 1 addition & 1 deletion src/Pyramid-Bloc/PyramidSavingMethodBuilder.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ PyramidSavingMethodBuilder >> serializeBlock: anObject [
PyramidSavingMethodBuilder >> serializedString: aSaveModel [

| roots |
roots := aSaveModel projectModel roots asArray sorted:
roots := aSaveModel projectModel firstLevelElements asArray sorted:
PyramidElevationSortFunction new.
self flag: #FIX. "The roots must be sorted before saving or else the order on the roots will not be kept"
^ self serializeBlock value: roots
Expand Down
8 changes: 4 additions & 4 deletions src/Pyramid-Bloc/PyramidTreePlugin.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ PyramidTreePlugin >> initializeLibraryPresenters [
editor: self editor;
idGenerator: idGenerator;
yourself.
libraryPresenterForRoot := PyramidLibraryPresenterForRoot new
libraryPresenterForRoot := PyramidLibraryPresenterForFirstLevelElement new
editor: self editor;
idGenerator: idGenerator;
yourself
Expand Down Expand Up @@ -236,10 +236,10 @@ PyramidTreePlugin >> removeSelectedElements [
self editor propertiesManager commandExecutor
use: PyramidRemoveSelectedElementsCommand new
on: self editor projectModel selection
with: self editor projectModel roots.
with: self editor projectModel firstLevelElements.

"Update the selection after remove"
self editor projectModel updateSelection.
self editor projectModel updateSelection
]

{ #category : #accessing }
Expand Down
29 changes: 15 additions & 14 deletions src/Pyramid-Bloc/PyramidTreePresenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,24 @@ Class {
#traits : 'TPyramidProjectModelObserver',
#classTraits : 'TPyramidProjectModelObserver classTrait',
#instVars : [
'buttonAddToRoots',
'tree',
'columns',
'libraryPresenterForRoot',
'projectModel',
'editorMenuBuilder',
'shouldUpdateSelection'
'shouldUpdateSelection',
'buttonAddToFirstLevel'
],
#category : #'Pyramid-Bloc-plugin-tree-library'
}

{ #category : #'as yet unclassified' }
PyramidTreePresenter >> actionAddNewElement [
(PyramidPopoverFactory
makeWithPresenter: self libraryPresenterForRoot
relativeTo: self buttonAddToRoots
position: SpPopoverPosition right) popup

(PyramidPopoverFactory
makeWithPresenter: self libraryPresenterForRoot
relativeTo: self buttonAddToFirstLevel
position: SpPopoverPosition right) popup
]

{ #category : #'as yet unclassified' }
Expand All @@ -39,9 +40,9 @@ PyramidTreePresenter >> actionSelectionChanged: aCollection [
]

{ #category : #accessing }
PyramidTreePresenter >> buttonAddToRoots [
PyramidTreePresenter >> buttonAddToFirstLevel [

^ buttonAddToRoots
^ buttonAddToFirstLevel
]

{ #category : #accessing }
Expand All @@ -55,7 +56,7 @@ PyramidTreePresenter >> defaultLayout [

^ SpBoxLayout newVertical
spacing: 4;
add: self buttonAddToRoots expand: false;
add: self buttonAddToFirstLevel expand: false;
add: self tree expand: true;
yourself
]
Expand Down Expand Up @@ -88,13 +89,13 @@ PyramidTreePresenter >> initializePresenters [

columns := OrderedCollection new.

buttonAddToRoots := SpButtonPresenter new
buttonAddToFirstLevel := SpButtonPresenter new
label: 'Add new element';
icon: (self iconNamed: #add);
action: [ self actionAddNewElement ];
help:
'Add a new element on the roots of the design.';
yourself
'Add a new element on the first level of the design.';
yourself
]

{ #category : #accessing }
Expand Down Expand Up @@ -132,9 +133,9 @@ PyramidTreePresenter >> pyramidElementsChanged [
]

{ #category : #'as yet unclassified' }
PyramidTreePresenter >> pyramidRootsChanged [
PyramidTreePresenter >> pyramidFirstLevelElementsChanged [

self updateRoots .
self updateRoots.
self updateSelection
]

Expand Down
39 changes: 39 additions & 0 deletions src/Pyramid-IDE/PyramidPluginSettingsAccess.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
Class {
#name : #PyramidPluginSettingsAccess,
#superclass : #Object,
#traits : 'TPyramidPlugin',
#classTraits : 'TPyramidPlugin classTrait',
#instVars : [
'settingsButton'
],
#category : #'Pyramid-IDE-plugin-settings'
}

{ #category : #adding }
PyramidPluginSettingsAccess >> addPanelsOn: aPyramidWindow [

aPyramidWindow at: #topLeft addItem: [ :builder |
builder makeButtonWithIcon: self settingsButton order: 3 ]
]

{ #category : #initialization }
PyramidPluginSettingsAccess >> initialize [

settingsButton := SpButtonPresenter new
icon: (self iconNamed: #smallConfiguration);
action: [ PyramidWorld openPyramidSettings ];
help: self settingsButtonHelp;
yourself
]

{ #category : #initialization }
PyramidPluginSettingsAccess >> settingsButton [

^ settingsButton
]

{ #category : #initialization }
PyramidPluginSettingsAccess >> settingsButtonHelp [

^ 'Open the settings menu for Pyramid.'
]
2 changes: 1 addition & 1 deletion src/Pyramid-IDE/PyramidSystemSettings.class.st
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Class {
#name : #PyramidSystemSettings,
#superclass : #Object,
#category : #'Pyramid-IDE'
#category : #'Pyramid-IDE-settings-menu'
}

{ #category : #settings }
Expand Down
2 changes: 1 addition & 1 deletion src/Pyramid-IDE/PyramidWorld.class.st
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Class {
#name : #PyramidWorld,
#superclass : #Object,
#category : #'Pyramid-IDE-Menus'
#category : #'Pyramid-IDE-menus'
}

{ #category : #actions }
Expand Down
4 changes: 2 additions & 2 deletions src/Pyramid-Tests/PyramidEditorTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ PyramidEditorTest >> openFromBlSpace [
(Duration milliSeconds: 10) wait.

self assert: editor window isOpen.
self assert: (editor projectModel roots includes: element).
self assert: (editor projectModel firstLevelElements includes: element).
self deny: (space root children includes: element).

editor close.
(Duration milliSeconds: 10) wait.

self assert: editor window isClosed.
self deny: (editor projectModel roots includes: element).
self deny: (editor projectModel firstLevelElements includes: element).
self assert: (space root children includes: element)
]

Expand Down
12 changes: 7 additions & 5 deletions src/Pyramid/BlElement.extension.st
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@ Extension { #name : #BlElement }
{ #category : #'*Pyramid' }
BlElement >> editWithPyramid [

| editor oldParent |
| editor oldParent |
editor := PyramidEditor buildEditor.

self flag:'labordep: the code below is too complicated, we need to have a more simple API to edit a BlElement, for example editElement:'.

self flag:
'labordep: the code below is too complicated, we need to have a more simple API to edit a BlElement, for example editElement:'.
oldParent := self parent.
self hasParent ifTrue: [ oldParent removeChild: self ].

editor projectModel roots add: self.
editor window whenClosedDo: [ oldParent ifNotNil: [ oldParent addChild: self ] ].
editor projectModel firstLevelElements add: self.
editor window whenClosedDo: [
oldParent ifNotNil: [ oldParent addChild: self ] ].

editor window open.
^ editor
Expand Down
18 changes: 10 additions & 8 deletions src/Pyramid/BlSpace.extension.st
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ BlSpace >> editWithPyramid [
| editor elements spacePlaceholder |
"Prepare image to replace the application view"
spacePlaceholder := (self root exportAsForm dimmed: 0.5) asElement.
spacePlaceholder addChildren: PyramidLogo logoOpenInPyramid materializeAsBlElement.

spacePlaceholder addChildren:
PyramidLogo logoOpenInPyramid materializeAsBlElement.

"Open editor"
editor := PyramidEditor buildEditor.
editor window open.

self flag:'labordep: the code below is too complicated, we need to have a more simple API to edit a BlSpace, for example editSpace:'.
self flag:
'labordep: the code below is too complicated, we need to have a more simple API to edit a BlSpace, for example editSpace:'.

self userData at: #pyramid_isOnEdition put: true.

Expand All @@ -22,16 +24,16 @@ BlSpace >> editWithPyramid [
self root addChild: spacePlaceholder.

"Add child into Pyramid to be edited"
editor projectModel roots addAll: elements.
editor projectModel firstLevelElements addAll: elements.
editor window whenClosedDo: [
| pyramidRoots |
pyramidRoots := editor projectModel roots asArray.
pyramidRoots := editor projectModel firstLevelElements asArray.
pyramidRoots do: [ :each |
each hasParent ifTrue: [ each parent removeChild: each ] ].
editor projectModel roots removeAll.
editor projectModel firstLevelElements removeAll.
self root removeChildren.
self root addChildren: pyramidRoots.
self userData removeKey: #pyramid_isOnEdition. ].
self userData removeKey: #pyramid_isOnEdition ].

^ editor
]
Loading

0 comments on commit 1b0d0e1

Please sign in to comment.