Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -161,7 +161,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 @@ -244,10 +244,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
33 changes: 17 additions & 16 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 Expand Up @@ -178,8 +179,8 @@ PyramidTreePresenter >> tree [
PyramidTreePresenter >> updateRoots [

self shouldUpdateSelection: false.
[
self tree roots: self projectModel roots asArray ] ensure: [ self shouldUpdateSelection: true ]
[ self tree roots: self projectModel firstLevelElements asArray ] ensure: [
self shouldUpdateSelection: true ]
]

{ #category : #'as yet unclassified' }
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
]
27 changes: 17 additions & 10 deletions src/Pyramid/PyramidProjectModel.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Class {
#traits : 'TPyramidProjectModel',
#classTraits : 'TPyramidProjectModel classTrait',
#instVars : [
'roots',
'firstLevelElements',
'selection'
],
#category : #'Pyramid-models'
Expand All @@ -14,22 +14,29 @@ Class {
PyramidProjectModel >> allElements [

^ PyramidElementsManipulationHelper flattenChildrenOfCollection:
self roots.
self firstLevelElements
]

{ #category : #accessing }
PyramidProjectModel >> initialize [

selection := PyramidCollectionWithCallbacks new.
roots := PyramidSortedCollectionWithCallbacks new sortFunction: PyramidElevationSortFunction new; yourself.
PyramidProjectModel >> firstLevelElements [

selection subscribe: self withCallback: [ self informSelectionChanged ].
roots subscribe: self withCallback: [ self informRootsChanged ]
^ firstLevelElements
]

{ #category : #accessing }
PyramidProjectModel >> roots [
^ roots
PyramidProjectModel >> initialize [

selection := PyramidCollectionWithCallbacks new.
firstLevelElements := PyramidSortedCollectionWithCallbacks new
sortFunction: PyramidElevationSortFunction new;
yourself.

selection
subscribe: self
withCallback: [ self informSelectionChanged ].
firstLevelElements
subscribe: self
withCallback: [ self informFirstLevelElementsChanged ]
]

{ #category : #selection }
Expand Down
Loading