diff --git a/src/BaselineOfPyramid/BaselineOfPyramid.class.st b/src/BaselineOfPyramid/BaselineOfPyramid.class.st index 74879fc6..d091cb77 100644 --- a/src/BaselineOfPyramid/BaselineOfPyramid.class.st +++ b/src/BaselineOfPyramid/BaselineOfPyramid.class.st @@ -12,10 +12,12 @@ BaselineOfPyramid >> baseline: spec [ spec postLoadDoIt: #postload:package:. self dependencies: spec. spec - package: #Pyramid with: [ spec requires: #( #BlocSerialization ) ]; + package: #Pyramid; package: #'Pyramid-Bloc' - with: [ spec requires: #( #Pyramid #Bloc ) ]; - package: #'Pyramid-Tests' with: [ spec requires: #( #Pyramid ) ]; + 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 ) ] ] ] diff --git a/src/Pyramid-Bloc/BlBackground.extension.st b/src/Pyramid-Bloc/BlBackground.extension.st new file mode 100644 index 00000000..b114506e --- /dev/null +++ b/src/Pyramid-Bloc/BlBackground.extension.st @@ -0,0 +1,26 @@ +Extension { #name : #BlBackground } + +{ #category : #'*Pyramid-Bloc' } +BlBackground >> = aBlBackground [ + + aBlBackground == self ifTrue: [ ^ true ]. + ^ aBlBackground class = self class +] + +{ #category : #'*Pyramid-Bloc' } +BlBackground >> asForm [ + + ^ self shouldBeImplemented +] + +{ #category : #'*Pyramid-Bloc' } +BlBackground >> asString [ + + ^ self shouldBeImplemented +] + +{ #category : #'*Pyramid-Bloc' } +BlBackground >> selectOnBackgroundInput: aPyramidBackgroundInputPresenter [ + + self shouldBeImplemented +] diff --git a/src/Pyramid-Bloc/BlBasicLayout.extension.st b/src/Pyramid-Bloc/BlBasicLayout.extension.st new file mode 100644 index 00000000..04c7965c --- /dev/null +++ b/src/Pyramid-Bloc/BlBasicLayout.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #BlBasicLayout } + +{ #category : #'*Pyramid-Bloc' } +BlBasicLayout >> setLayoutOn: aPyramidLayoutInputPresenter [ + + aPyramidLayoutInputPresenter setBasic +] diff --git a/src/Pyramid-Bloc/BlColorPaint.extension.st b/src/Pyramid-Bloc/BlColorPaint.extension.st index 5f1b2397..c6c9650d 100644 --- a/src/Pyramid-Bloc/BlColorPaint.extension.st +++ b/src/Pyramid-Bloc/BlColorPaint.extension.st @@ -1,14 +1,16 @@ Extension { #name : #BlColorPaint } { #category : #'*Pyramid-Bloc' } -BlColorPaint >> pyramidBackgroundPreview [ +BlColorPaint >> asForm [ - ^ PyramidPaintPreviewSolidColor new color: self color + ^ (Morph new + extent: 16 @ 16; + color: self color; + yourself) asForm ] { #category : #'*Pyramid-Bloc' } -BlColorPaint >> pyramidModalDefaultPaint: aPyramidPaintInput [ +BlColorPaint >> selectOnBackgroundInput: aPyramidBackgroundInputPresenter [ - aPyramidPaintInput buttonColor click. - aPyramidPaintInput inputSolid defaultColor: self color + aPyramidBackgroundInputPresenter selectPaintSolidWith: self ] diff --git a/src/Pyramid-Bloc/BlCompositeBackground.extension.st b/src/Pyramid-Bloc/BlCompositeBackground.extension.st index 9221edc4..9b757df1 100644 --- a/src/Pyramid-Bloc/BlCompositeBackground.extension.st +++ b/src/Pyramid-Bloc/BlCompositeBackground.extension.st @@ -1,13 +1,13 @@ Extension { #name : #BlCompositeBackground } { #category : #'*Pyramid-Bloc' } -BlCompositeBackground >> pyramidBackgroundStrategy [ +BlCompositeBackground >> asForm [ - ^ PyramidBackgroundPropertyInputUnknownStrategy new + ^ self iconNamed: #jigsawIcon ] { #category : #'*Pyramid-Bloc' } -BlCompositeBackground >> pyramidSelectMenuOnModal: aModal [ +BlCompositeBackground >> asString [ - aModal buttonComposite click + ^ 'Composite' ] diff --git a/src/Pyramid-Bloc/BlCornerRadii.extension.st b/src/Pyramid-Bloc/BlCornerRadii.extension.st new file mode 100644 index 00000000..9bf47a27 --- /dev/null +++ b/src/Pyramid-Bloc/BlCornerRadii.extension.st @@ -0,0 +1,13 @@ +Extension { #name : #BlCornerRadii } + +{ #category : #'*Pyramid-Bloc' } +BlCornerRadii >> setCornerRadiiOn: aPyramidInsetsInputPresenter [ + + ((self topLeft closeTo: self bottomRight) and: [(self topRight closeTo: self bottomLeft)]) ifTrue: [ + (self topLeft closeTo: self topRight) ifTrue: [ aPyramidInsetsInputPresenter inputArray value: { self topLeft }. ] ifFalse: [ aPyramidInsetsInputPresenter inputArray value: { self topLeft . self topRight}. ]. + ^ self ]. + + aPyramidInsetsInputPresenter inputArray value: { + self topLeft . self topRight . self bottomRight . self bottomLeft }. + +] diff --git a/src/Pyramid-Bloc/BlElement.extension.st b/src/Pyramid-Bloc/BlElement.extension.st new file mode 100644 index 00000000..eed6d21b --- /dev/null +++ b/src/Pyramid-Bloc/BlElement.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #BlElement } + +{ #category : #'*Pyramid-Bloc' } +BlElement >> asIcon [ + + ^ self iconNamed: #class +] diff --git a/src/Pyramid-Bloc/BlElementGeometry.extension.st b/src/Pyramid-Bloc/BlElementGeometry.extension.st deleted file mode 100644 index a6e83135..00000000 --- a/src/Pyramid-Bloc/BlElementGeometry.extension.st +++ /dev/null @@ -1,11 +0,0 @@ -Extension { #name : #BlElementGeometry } - -{ #category : #'*Pyramid-Bloc' } -BlElementGeometry >> pyramidSelectOnPresenter: aPresenter [ - - | selection | - aPresenter model: PyramidGeometryModel default. - selection := aPresenter model select: [ :each | - each isSelectableWith: self ]. - selection ifNotEmpty: [ selection first selectModelWith: self ] -] diff --git a/src/Pyramid-Bloc/BlEllipseGeometry.extension.st b/src/Pyramid-Bloc/BlEllipseGeometry.extension.st new file mode 100644 index 00000000..c3401b9b --- /dev/null +++ b/src/Pyramid-Bloc/BlEllipseGeometry.extension.st @@ -0,0 +1,8 @@ +Extension { #name : #BlEllipseGeometry } + +{ #category : #'*Pyramid-Bloc' } +BlEllipseGeometry >> = anObject [ + + self == anObject ifTrue: [ ^ true ]. + ^ self class = anObject class +] diff --git a/src/Pyramid-Bloc/BlFlowLayout.extension.st b/src/Pyramid-Bloc/BlFlowLayout.extension.st new file mode 100644 index 00000000..5813f904 --- /dev/null +++ b/src/Pyramid-Bloc/BlFlowLayout.extension.st @@ -0,0 +1,18 @@ +Extension { #name : #BlFlowLayout } + +{ #category : #'*Pyramid-Bloc' } +BlFlowLayout >> = anObject [ + + self == anObject ifTrue: [ ^ true ]. + self class = anObject class ifFalse: [ ^ false ]. + self orientation = anObject orientation ifFalse: [ ^ false ]. + self horizontalAlignment = anObject horizontalAlignment ifFalse: [ ^ false ]. + self verticalAlignment = anObject verticalAlignment ifFalse: [ ^ false ]. + ^ true +] + +{ #category : #'*Pyramid-Bloc' } +BlFlowLayout >> setLayoutOn: aPyramidLayoutInputPresenter [ + + aPyramidLayoutInputPresenter setFlow +] diff --git a/src/Pyramid-Bloc/BlGradientPaint.extension.st b/src/Pyramid-Bloc/BlGradientPaint.extension.st index fef5522f..4ccffa85 100644 --- a/src/Pyramid-Bloc/BlGradientPaint.extension.st +++ b/src/Pyramid-Bloc/BlGradientPaint.extension.st @@ -1,8 +1,34 @@ Extension { #name : #BlGradientPaint } { #category : #'*Pyramid-Bloc' } -BlGradientPaint >> pyramidModalDefaultPaint: aPyramidPaintInput [ +BlGradientPaint >> = aBlPaint [ - aPyramidPaintInput buttonGradient click. - aPyramidPaintInput inputGradient stopsColor stopManager from: self stops. + self == aBlPaint ifTrue: [ ^ true ]. + self class == aBlPaint class ifFalse: [ ^ false ]. + ^ self stops = aBlPaint stops +] + +{ #category : #'*Pyramid-Bloc' } +BlGradientPaint >> asForm [ + + ^ (Morph new + extent: 16 @ 16; + color: self stops last value; + addMorph: (Morph new + extent: 8 @ 16; + color: self stops first value; + yourself); + yourself) asForm +] + +{ #category : #'*Pyramid-Bloc' } +BlGradientPaint >> selectOnBackgroundInput: aPyramidBackgroundInputPresenter [ + + aPyramidBackgroundInputPresenter selectPaintGradientWith: self +] + +{ #category : #'*Pyramid-Bloc' } +BlGradientPaint >> selectOnGradientPaintInput: aPyramidGradientPaintInputPresenter [ + + aPyramidGradientPaintInputPresenter stopsInput value:self stops. ] diff --git a/src/Pyramid-Bloc/BlImageBackground.extension.st b/src/Pyramid-Bloc/BlImageBackground.extension.st index 1b034f87..39db9c67 100644 --- a/src/Pyramid-Bloc/BlImageBackground.extension.st +++ b/src/Pyramid-Bloc/BlImageBackground.extension.st @@ -1,20 +1,26 @@ Extension { #name : #BlImageBackground } { #category : #'*Pyramid-Bloc' } -BlImageBackground >> pyramidBackgroundStrategy [ - - (self image respondsTo: #pyramidExternalRessourceSource) ifTrue: [ - ^ PyramidBackgroundPropertyInputImage new - ressource: self image pyramidExternalRessourceSource; - yourself ]. - ^ PyramidBackgroundPropertyInputImage new - ressource: nil; - yourself +BlImageBackground >> = aBlBackground [ + + super = aBlBackground ifFalse: [ ^ false ]. + ^ self image = aBlBackground image +] + +{ #category : #'*Pyramid-Bloc' } +BlImageBackground >> asForm [ + + ^ self image +] + +{ #category : #'*Pyramid-Bloc' } +BlImageBackground >> asString [ + + ^ 'Image - ', self image asString ] { #category : #'*Pyramid-Bloc' } -BlImageBackground >> pyramidSelectMenuOnModal: aModal [ +BlImageBackground >> selectOnBackgroundInput: aPyramidBackgroundInputPresenter [ - aModal buttonImage click. - aModal currentPresenter setImage: self image + aPyramidBackgroundInputPresenter selectImage ] diff --git a/src/Pyramid-Bloc/BlInsets.extension.st b/src/Pyramid-Bloc/BlInsets.extension.st new file mode 100644 index 00000000..a47a58cc --- /dev/null +++ b/src/Pyramid-Bloc/BlInsets.extension.st @@ -0,0 +1,20 @@ +Extension { #name : #BlInsets } + +{ #category : #'*Pyramid-Bloc' } +BlInsets >> setInsetsOn: aPyramidInsetsInputPresenter [ + + self isUniform ifTrue: [ + aPyramidInsetsInputPresenter inputArray value: { self top }. + ^ self ]. + ((self top closeTo: self bottom) and: [ + self left closeTo: self right ]) ifTrue: [ + aPyramidInsetsInputPresenter inputArray value: { + self top. + self right }. + ^ self ]. + aPyramidInsetsInputPresenter inputArray value: { + self top. + self right. + self bottom. + self left } +] diff --git a/src/Pyramid-Bloc/BlLayout.extension.st b/src/Pyramid-Bloc/BlLayout.extension.st new file mode 100644 index 00000000..8a9cdf18 --- /dev/null +++ b/src/Pyramid-Bloc/BlLayout.extension.st @@ -0,0 +1,14 @@ +Extension { #name : #BlLayout } + +{ #category : #'*Pyramid-Bloc' } +BlLayout >> = anObject [ + + self == anObject ifTrue: [ ^ true ]. + ^ self class = anObject class +] + +{ #category : #'*Pyramid-Bloc' } +BlLayout >> setLayoutOn: aPyramidLayoutInputPresenter [ + + aPyramidLayoutInputPresenter setUnknowValue +] diff --git a/src/Pyramid-Bloc/BlLayoutCommonConstraintsAxis.extension.st b/src/Pyramid-Bloc/BlLayoutCommonConstraintsAxis.extension.st index 0faf2a37..bfe5dbfa 100644 --- a/src/Pyramid-Bloc/BlLayoutCommonConstraintsAxis.extension.st +++ b/src/Pyramid-Bloc/BlLayoutCommonConstraintsAxis.extension.st @@ -1,7 +1,13 @@ Extension { #name : #BlLayoutCommonConstraintsAxis } { #category : #'*Pyramid-Bloc' } -BlLayoutCommonConstraintsAxis >> pyramidSelectConstraintsOn: aPyramidConstraintsPresenter [ +BlLayoutCommonConstraintsAxis >> asPyramidConstraintsArgument [ - self resizer pyramidSelectConstraintsResizerOn: aPyramidConstraintsPresenter + ^ self resizer asPyramidConstraintsArgument +] + +{ #category : #'*Pyramid-Bloc' } +BlLayoutCommonConstraintsAxis >> setConstraintsOn: aPyramidBasicConstraintsInputPresenter [ + + self resizer setResizerConstraintsOn: aPyramidBasicConstraintsInputPresenter ] diff --git a/src/Pyramid-Bloc/BlLayoutExactResizer.extension.st b/src/Pyramid-Bloc/BlLayoutExactResizer.extension.st index a1ca4b9e..151bff37 100644 --- a/src/Pyramid-Bloc/BlLayoutExactResizer.extension.st +++ b/src/Pyramid-Bloc/BlLayoutExactResizer.extension.st @@ -1,12 +1,15 @@ Extension { #name : #BlLayoutExactResizer } { #category : #'*Pyramid-Bloc' } -BlLayoutExactResizer >> pyramidSelectConstraintsResizerOn: aPyramidConstraintsPresenter [ - - | item | - item := (aPyramidConstraintsPresenter selectorInputs select: [ :each | - each value targetClass = self class ]) first. - item key click. - aPyramidConstraintsPresenter submit: item value. - item value associatedPresenter number: self size. +BlLayoutExactResizer >> asPyramidConstraintsArgument [ + + ^ { + #exact:. + self size } +] + +{ #category : #'*Pyramid-Bloc' } +BlLayoutExactResizer >> setResizerConstraintsOn: aPyramidBasicConstraintsInputPresenter [ + + aPyramidBasicConstraintsInputPresenter setExact ] diff --git a/src/Pyramid-Bloc/BlLayoutFitContentResizer.extension.st b/src/Pyramid-Bloc/BlLayoutFitContentResizer.extension.st new file mode 100644 index 00000000..4e906210 --- /dev/null +++ b/src/Pyramid-Bloc/BlLayoutFitContentResizer.extension.st @@ -0,0 +1,13 @@ +Extension { #name : #BlLayoutFitContentResizer } + +{ #category : #'*Pyramid-Bloc' } +BlLayoutFitContentResizer >> asPyramidConstraintsArgument [ + + ^ #fitContent +] + +{ #category : #'*Pyramid-Bloc' } +BlLayoutFitContentResizer >> setResizerConstraintsOn: aPyramidBasicConstraintsInputPresenter [ + + aPyramidBasicConstraintsInputPresenter setFitContent +] diff --git a/src/Pyramid-Bloc/BlLayoutHorizontal.extension.st b/src/Pyramid-Bloc/BlLayoutHorizontal.extension.st new file mode 100644 index 00000000..5d8b5d0f --- /dev/null +++ b/src/Pyramid-Bloc/BlLayoutHorizontal.extension.st @@ -0,0 +1,13 @@ +Extension { #name : #BlLayoutHorizontal } + +{ #category : #'*Pyramid-Bloc' } +BlLayoutHorizontal >> asBooleanForPyramid [ + + ^ false +] + +{ #category : #'*Pyramid-Bloc' } +BlLayoutHorizontal >> switchOrientation [ + + ^ BlLayoutOrientation vertical +] diff --git a/src/Pyramid-Bloc/BlLayoutMatchParentResizer.extension.st b/src/Pyramid-Bloc/BlLayoutMatchParentResizer.extension.st new file mode 100644 index 00000000..383d676e --- /dev/null +++ b/src/Pyramid-Bloc/BlLayoutMatchParentResizer.extension.st @@ -0,0 +1,13 @@ +Extension { #name : #BlLayoutMatchParentResizer } + +{ #category : #'*Pyramid-Bloc' } +BlLayoutMatchParentResizer >> asPyramidConstraintsArgument [ + + ^ #matchParent +] + +{ #category : #'*Pyramid-Bloc' } +BlLayoutMatchParentResizer >> setResizerConstraintsOn: aPyramidBasicConstraintsInputPresenter [ + + aPyramidBasicConstraintsInputPresenter setMatchParent +] diff --git a/src/Pyramid-Bloc/BlLayoutResizer.extension.st b/src/Pyramid-Bloc/BlLayoutResizer.extension.st deleted file mode 100644 index bfc0e47e..00000000 --- a/src/Pyramid-Bloc/BlLayoutResizer.extension.st +++ /dev/null @@ -1,11 +0,0 @@ -Extension { #name : #BlLayoutResizer } - -{ #category : #'*Pyramid-Bloc' } -BlLayoutResizer >> pyramidSelectConstraintsResizerOn: aPyramidConstraintsPresenter [ - - | item | - item := (aPyramidConstraintsPresenter selectorInputs select: [ :each | - each value targetClass = self class ]) first. - item key click. - aPyramidConstraintsPresenter submit: item value -] diff --git a/src/Pyramid-Bloc/BlLayoutVertical.extension.st b/src/Pyramid-Bloc/BlLayoutVertical.extension.st new file mode 100644 index 00000000..ff049ba9 --- /dev/null +++ b/src/Pyramid-Bloc/BlLayoutVertical.extension.st @@ -0,0 +1,13 @@ +Extension { #name : #BlLayoutVertical } + +{ #category : #'*Pyramid-Bloc' } +BlLayoutVertical >> asBooleanForPyramid [ + + ^ true +] + +{ #category : #'*Pyramid-Bloc' } +BlLayoutVertical >> switchOrientation [ + + ^ BlLayoutOrientation horizontal +] diff --git a/src/Pyramid-Bloc/BlLinearGradientPaint.extension.st b/src/Pyramid-Bloc/BlLinearGradientPaint.extension.st index e80c0fa1..80fcf976 100644 --- a/src/Pyramid-Bloc/BlLinearGradientPaint.extension.st +++ b/src/Pyramid-Bloc/BlLinearGradientPaint.extension.st @@ -1,17 +1,18 @@ Extension { #name : #BlLinearGradientPaint } { #category : #'*Pyramid-Bloc' } -BlLinearGradientPaint >> pyramidBackgroundPreview [ +BlLinearGradientPaint >> = aBlPaint [ - ^ PyramidPaintPreviewGradientColor new - stops: self stops; - yourself + super = aBlPaint ifFalse: [ ^ false ]. + ^ self end = aBlPaint end and: [ self start = aBlPaint start ] ] { #category : #'*Pyramid-Bloc' } -BlLinearGradientPaint >> pyramidModalDefaultPaint: aPyramidPaintInput [ +BlLinearGradientPaint >> selectOnGradientPaintInput: aPyramidGradientPaintInputPresenter [ - super pyramidModalDefaultPaint: aPyramidPaintInput. - aPyramidPaintInput inputGradient modeSelector buttonLinear click. - aPyramidPaintInput inputGradient modeSelector linearDirection point: self end - self start + super selectOnGradientPaintInput: aPyramidGradientPaintInputPresenter. + aPyramidGradientPaintInputPresenter linearButton click. + aPyramidGradientPaintInputPresenter startInput value: self start. + aPyramidGradientPaintInputPresenter endInput value: self end. + ] diff --git a/src/Pyramid-Bloc/BlPaint.extension.st b/src/Pyramid-Bloc/BlPaint.extension.st new file mode 100644 index 00000000..3d18a983 --- /dev/null +++ b/src/Pyramid-Bloc/BlPaint.extension.st @@ -0,0 +1,13 @@ +Extension { #name : #BlPaint } + +{ #category : #'*Pyramid-Bloc' } +BlPaint >> asForm [ + + ^ self shouldBeImplemented +] + +{ #category : #'*Pyramid-Bloc' } +BlPaint >> selectOnBackgroundInput: aPyramidBackgroundInputPresenter [ + + self shouldBeImplemented +] diff --git a/src/Pyramid-Bloc/BlPaintBackground.extension.st b/src/Pyramid-Bloc/BlPaintBackground.extension.st index 4bfb39d3..7132fca7 100644 --- a/src/Pyramid-Bloc/BlPaintBackground.extension.st +++ b/src/Pyramid-Bloc/BlPaintBackground.extension.st @@ -1,14 +1,19 @@ Extension { #name : #BlPaintBackground } { #category : #'*Pyramid-Bloc' } -BlPaintBackground >> pyramidBackgroundStrategy [ +BlPaintBackground >> asForm [ - ^ PyramidBackgroundPropertyInputPaint new paint: self paint; yourself + ^ self paint asForm ] { #category : #'*Pyramid-Bloc' } -BlPaintBackground >> pyramidSelectMenuOnModal: aModal [ +BlPaintBackground >> asString [ - aModal buttonPaint click. - aModal currentPresenter setDefaultPaint: self paint + ^ self paint asString +] + +{ #category : #'*Pyramid-Bloc' } +BlPaintBackground >> selectOnBackgroundInput: aPyramidBackgroundInputPresenter [ + + self paint selectOnBackgroundInput: aPyramidBackgroundInputPresenter ] diff --git a/src/Pyramid-Bloc/BlProportionalLayout.extension.st b/src/Pyramid-Bloc/BlProportionalLayout.extension.st new file mode 100644 index 00000000..10f1204c --- /dev/null +++ b/src/Pyramid-Bloc/BlProportionalLayout.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #BlProportionalLayout } + +{ #category : #'*Pyramid-Bloc' } +BlProportionalLayout >> setLayoutOn: aPyramidLayoutInputPresenter [ + + aPyramidLayoutInputPresenter setProportionnal +] diff --git a/src/Pyramid-Bloc/BlRadialGradientPaint.extension.st b/src/Pyramid-Bloc/BlRadialGradientPaint.extension.st index d2256225..9e0d2fcf 100644 --- a/src/Pyramid-Bloc/BlRadialGradientPaint.extension.st +++ b/src/Pyramid-Bloc/BlRadialGradientPaint.extension.st @@ -1,22 +1,17 @@ Extension { #name : #BlRadialGradientPaint } { #category : #'*Pyramid-Bloc' } -BlRadialGradientPaint >> pyramidBackgroundPreview [ +BlRadialGradientPaint >> = aBlPaint [ - ^ PyramidPaintPreviewGradientColor new - stops: self stops; - yourself + super = aBlPaint ifFalse: [ ^ false ]. + ^ self center = aBlPaint center and: [ self radius = aBlPaint radius ] ] { #category : #'*Pyramid-Bloc' } -BlRadialGradientPaint >> pyramidModalDefaultPaint: aPyramidPaintInput [ +BlRadialGradientPaint >> selectOnGradientPaintInput: aPyramidGradientPaintInputPresenter [ - super pyramidModalDefaultPaint: aPyramidPaintInput. - aPyramidPaintInput inputGradient modeSelector buttonRadial click. - aPyramidPaintInput inputGradient modeSelector linearDirection point: - self center. - aPyramidPaintInput inputGradient modeSelector radialPosition point: - self center. - aPyramidPaintInput inputGradient modeSelector radialRadius number: - self radius + super selectOnGradientPaintInput: aPyramidGradientPaintInputPresenter. + aPyramidGradientPaintInputPresenter radialButton click. + aPyramidGradientPaintInputPresenter centerInput value: self center. + aPyramidGradientPaintInputPresenter radiusInput value: self radius ] diff --git a/src/Pyramid-Bloc/BlRectangleGeometry.extension.st b/src/Pyramid-Bloc/BlRectangleGeometry.extension.st new file mode 100644 index 00000000..c78cf282 --- /dev/null +++ b/src/Pyramid-Bloc/BlRectangleGeometry.extension.st @@ -0,0 +1,8 @@ +Extension { #name : #BlRectangleGeometry } + +{ #category : #'*Pyramid-Bloc' } +BlRectangleGeometry >> = anObject [ + + self == anObject ifTrue: [ ^ true ]. + ^ self class = anObject class +] diff --git a/src/Pyramid-Bloc/BlRoundedRectangleGeometry.extension.st b/src/Pyramid-Bloc/BlRoundedRectangleGeometry.extension.st new file mode 100644 index 00000000..e762b5ec --- /dev/null +++ b/src/Pyramid-Bloc/BlRoundedRectangleGeometry.extension.st @@ -0,0 +1,8 @@ +Extension { #name : #BlRoundedRectangleGeometry } + +{ #category : #'*Pyramid-Bloc' } +BlRoundedRectangleGeometry >> = anObject [ + + self == anObject ifTrue: [ ^ true ]. + ^ self class = anObject class and: [ self cornerRadii = anObject cornerRadii ] +] diff --git a/src/Pyramid-Bloc/BlTextElement.extension.st b/src/Pyramid-Bloc/BlTextElement.extension.st new file mode 100644 index 00000000..131c8409 --- /dev/null +++ b/src/Pyramid-Bloc/BlTextElement.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #BlTextElement } + +{ #category : #'*Pyramid-Bloc' } +BlTextElement >> asIcon [ + + ^ self iconNamed: #haloFontStyle +] diff --git a/src/Pyramid-Bloc/BlTransparentBackground.extension.st b/src/Pyramid-Bloc/BlTransparentBackground.extension.st index 476942f3..c6771059 100644 --- a/src/Pyramid-Bloc/BlTransparentBackground.extension.st +++ b/src/Pyramid-Bloc/BlTransparentBackground.extension.st @@ -1,13 +1,19 @@ Extension { #name : #BlTransparentBackground } { #category : #'*Pyramid-Bloc' } -BlTransparentBackground >> pyramidBackgroundStrategy [ +BlTransparentBackground >> asForm [ - ^ PyramidBackgroundPropertyInputTransparent new + ^ self iconNamed: #smallSelect ] { #category : #'*Pyramid-Bloc' } -BlTransparentBackground >> pyramidSelectMenuOnModal: aModal [ +BlTransparentBackground >> asString [ - aModal buttonTransparent click. + ^ 'Transparent' +] + +{ #category : #'*Pyramid-Bloc' } +BlTransparentBackground >> selectOnBackgroundInput: aPyramidBackgroundInputPresenter [ + + aPyramidBackgroundInputPresenter selectTransparent. ] diff --git a/src/Pyramid-Bloc/BlVisibility.extension.st b/src/Pyramid-Bloc/BlVisibility.extension.st new file mode 100644 index 00000000..ef2b9650 --- /dev/null +++ b/src/Pyramid-Bloc/BlVisibility.extension.st @@ -0,0 +1,27 @@ +Extension { #name : #BlVisibility } + +{ #category : #'*Pyramid-Bloc' } +BlVisibility >> asIcon [ +"return a 16 by 16 `Form`" + ^ self shouldBeImplemented +] + +{ #category : #'*Pyramid-Bloc' } +BlVisibility >> asString [ + "return a String" + + ^ self shouldBeImplemented +] + +{ #category : #'*Pyramid-Bloc' } +BlVisibility >> nextVisibilityForTree [ +"return the next visibility. +Visible -> Hidden -> Gone -> Visible" + ^ self shouldBeImplemented +] + +{ #category : #'*Pyramid-Bloc' } +BlVisibility >> setVisibilityOn: aPyramidVisibilityInputPresenter [ + + self shouldBeImplemented +] diff --git a/src/Pyramid-Bloc/BlVisibilityGone.extension.st b/src/Pyramid-Bloc/BlVisibilityGone.extension.st new file mode 100644 index 00000000..11939ad9 --- /dev/null +++ b/src/Pyramid-Bloc/BlVisibilityGone.extension.st @@ -0,0 +1,37 @@ +Extension { #name : #BlVisibilityGone } + +{ #category : #'*Pyramid-Bloc' } +BlVisibilityGone >> asIcon [ + + ^ self iconNamed: #haloDismiss +] + +{ #category : #'*Pyramid-Bloc' } +BlVisibilityGone >> asString [ + + ^ 'gone' +] + +{ #category : #'*Pyramid-Bloc' } +BlVisibilityGone >> nextVisibilityForTree [ + + ^ BlVisibility visible +] + +{ #category : #'*Pyramid-Bloc' } +BlVisibilityGone >> setVisibilityOn: aPyramidVisibilityInputPresenter [ + + aPyramidVisibilityInputPresenter setVisibilityGone +] + +{ #category : #'*Pyramid-Bloc' } +BlVisibilityGone >> switchNotVisibleOn: aPyramidVisibilityInputPresenter [ + + aPyramidVisibilityInputPresenter value: BlVisibility hidden. +] + +{ #category : #'*Pyramid-Bloc' } +BlVisibilityGone >> switchVisibleOn: aPyramidVisibilityInputPresenter [ + + aPyramidVisibilityInputPresenter value: BlVisibility visible +] diff --git a/src/Pyramid-Bloc/BlVisibilityHidden.extension.st b/src/Pyramid-Bloc/BlVisibilityHidden.extension.st new file mode 100644 index 00000000..59dd82b2 --- /dev/null +++ b/src/Pyramid-Bloc/BlVisibilityHidden.extension.st @@ -0,0 +1,37 @@ +Extension { #name : #BlVisibilityHidden } + +{ #category : #'*Pyramid-Bloc' } +BlVisibilityHidden >> asIcon [ + + ^ self iconNamed: #haloDrag +] + +{ #category : #'*Pyramid-Bloc' } +BlVisibilityHidden >> asString [ + + ^ 'hidden' +] + +{ #category : #'*Pyramid-Bloc' } +BlVisibilityHidden >> nextVisibilityForTree [ + + ^ BlVisibility gone +] + +{ #category : #'*Pyramid-Bloc' } +BlVisibilityHidden >> setVisibilityOn: aPyramidVisibilityInputPresenter [ + + aPyramidVisibilityInputPresenter setVisibilityHidden +] + +{ #category : #'*Pyramid-Bloc' } +BlVisibilityHidden >> switchNotVisibleOn: aPyramidVisibilityInputPresenter [ + + aPyramidVisibilityInputPresenter value: BlVisibility gone +] + +{ #category : #'*Pyramid-Bloc' } +BlVisibilityHidden >> switchVisibleOn: aPyramidVisibilityInputPresenter [ + + aPyramidVisibilityInputPresenter value: BlVisibility visible +] diff --git a/src/Pyramid-Bloc/BlVisibilityVisible.extension.st b/src/Pyramid-Bloc/BlVisibilityVisible.extension.st new file mode 100644 index 00000000..65edf433 --- /dev/null +++ b/src/Pyramid-Bloc/BlVisibilityVisible.extension.st @@ -0,0 +1,35 @@ +Extension { #name : #BlVisibilityVisible } + +{ #category : #'*Pyramid-Bloc' } +BlVisibilityVisible >> asIcon [ + + ^ self iconNamed: #haloView +] + +{ #category : #'*Pyramid-Bloc' } +BlVisibilityVisible >> asString [ + + ^ 'visible' +] + +{ #category : #'*Pyramid-Bloc' } +BlVisibilityVisible >> nextVisibilityForTree [ + + ^ BlVisibility hidden +] + +{ #category : #'*Pyramid-Bloc' } +BlVisibilityVisible >> setVisibilityOn: aPyramidVisibilityInputPresenter [ + + aPyramidVisibilityInputPresenter setVisibilityVisible +] + +{ #category : #'*Pyramid-Bloc' } +BlVisibilityVisible >> switchNotVisibleOn: aPyramidVisibilityInputPresenter [ +] + +{ #category : #'*Pyramid-Bloc' } +BlVisibilityVisible >> switchVisibleOn: aPyramidVisibilityInputPresenter [ + + aPyramidVisibilityInputPresenter value: BlVisibility hidden +] diff --git a/src/Pyramid-Bloc/False.extension.st b/src/Pyramid-Bloc/False.extension.st new file mode 100644 index 00000000..5cf991d7 --- /dev/null +++ b/src/Pyramid-Bloc/False.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #False } + +{ #category : #'*Pyramid-Bloc' } +False >> asOrientationForPyramid [ + + ^ BlLayoutOrientation horizontal +] diff --git a/src/Pyramid-Bloc/PyramidAbstractBlocCommand.class.st b/src/Pyramid-Bloc/PyramidAbstractBlocCommand.class.st new file mode 100644 index 00000000..51b17228 --- /dev/null +++ b/src/Pyramid-Bloc/PyramidAbstractBlocCommand.class.st @@ -0,0 +1,17 @@ +Class { + #name : #PyramidAbstractBlocCommand, + #superclass : #PyramidCommand, + #category : #'Pyramid-Bloc-plugin-bloc' +} + +{ #category : #testing } +PyramidAbstractBlocCommand class >> isAbstract [ + + ^ self == PyramidAbstractBlocCommand +] + +{ #category : #testing } +PyramidAbstractBlocCommand >> canBeUsedFor: anObject [ + + ^ anObject class = BlElement or: [anObject class inheritsFrom: BlElement] +] diff --git a/src/Pyramid-Bloc/PyramidAbstractChangePositionWithSiblingsCommand.class.st b/src/Pyramid-Bloc/PyramidAbstractChangePositionWithSiblingsCommand.class.st new file mode 100644 index 00000000..87a70a0a --- /dev/null +++ b/src/Pyramid-Bloc/PyramidAbstractChangePositionWithSiblingsCommand.class.st @@ -0,0 +1,41 @@ +Class { + #name : #PyramidAbstractChangePositionWithSiblingsCommand, + #superclass : #PyramidAbstractBlocCommand, + #category : #'Pyramid-Bloc-plugin-bloc-siblings' +} + +{ #category : #testing } +PyramidAbstractChangePositionWithSiblingsCommand class >> isAbstract [ + + ^ self == PyramidAbstractChangePositionWithSiblingsCommand +] + +{ #category : #testing } +PyramidAbstractChangePositionWithSiblingsCommand >> canBeUsedFor: anObject [ + + ^ (super canBeUsedFor: anObject) and: [ anObject hasParent ] +] + +{ #category : #'as yet unclassified' } +PyramidAbstractChangePositionWithSiblingsCommand >> commandInverse [ + + ^ PyramidSendAtIndexCommand new +] + +{ #category : #'as yet unclassified' } +PyramidAbstractChangePositionWithSiblingsCommand >> getValueFor: aBlElement [ + + ^ PyramidChangePositionWithSiblingsModel new + zIndex: aBlElement elevation elevation; + childIndex: (aBlElement parent childIndexOf: aBlElement); + yourself +] + +{ #category : #'as yet unclassified' } +PyramidAbstractChangePositionWithSiblingsCommand >> saveStatesOf: aCollection with: arguments [ + + ^ self + saveStatesOf: aCollection + withCommand: self commandInverse + withArguments: arguments +] diff --git a/src/Pyramid-Bloc/PyramidAbstractGroupCommand.class.st b/src/Pyramid-Bloc/PyramidAbstractGroupCommand.class.st new file mode 100644 index 00000000..c5d44f13 --- /dev/null +++ b/src/Pyramid-Bloc/PyramidAbstractGroupCommand.class.st @@ -0,0 +1,33 @@ +Class { + #name : #PyramidAbstractGroupCommand, + #superclass : #PyramidCommand, + #category : #'Pyramid-Bloc-plugin-bloc' +} + +{ #category : #testing } +PyramidAbstractGroupCommand class >> isAbstract [ + + ^ self == PyramidAbstractGroupCommand +] + +{ #category : #'as yet unclassified' } +PyramidAbstractGroupCommand >> getValueFor: aBlElement [ + + ^ nil +] + +{ #category : #'as yet unclassified' } +PyramidAbstractGroupCommand >> saveStatesOf: aCollection withCommand: aCommand withArguments: anArguments [ + + | mementos | + mementos := aCollection asArray collect: [ :each | + PyramidCommandMemento new + command: aCommand; + target: each; + arguments: anArguments; + yourself ]. + mementos size = 1 ifTrue: [ ^ mementos first ]. + ^ PyramidCompositeMemento new + mementos: mementos; + yourself +] diff --git a/src/Pyramid-Bloc/PyramidAddChildCommand.class.st b/src/Pyramid-Bloc/PyramidAddChildCommand.class.st new file mode 100644 index 00000000..5b13af98 --- /dev/null +++ b/src/Pyramid-Bloc/PyramidAddChildCommand.class.st @@ -0,0 +1,17 @@ +Class { + #name : #PyramidAddChildCommand, + #superclass : #PyramidChildrenCommand, + #category : #'Pyramid-Bloc-plugin-bloc' +} + +{ #category : #'as yet unclassified' } +PyramidAddChildCommand >> commandInverse [ + + ^ PyramidRemoveChildCommand new +] + +{ #category : #'as yet unclassified' } +PyramidAddChildCommand >> setValueFor: aBlElement with: aChildToAdd [ + + aBlElement addChild: aChildToAdd +] diff --git a/src/Pyramid-Bloc/PyramidBackgroundAbstractBackgroundInput.class.st b/src/Pyramid-Bloc/PyramidBackgroundAbstractBackgroundInput.class.st deleted file mode 100644 index adbbb8f3..00000000 --- a/src/Pyramid-Bloc/PyramidBackgroundAbstractBackgroundInput.class.st +++ /dev/null @@ -1,11 +0,0 @@ -Class { - #name : #PyramidBackgroundAbstractBackgroundInput, - #superclass : #SpPresenter, - #category : #'Pyramid-Bloc-custom-specs-background' -} - -{ #category : #accessing } -PyramidBackgroundAbstractBackgroundInput >> background [ - - ^ self shouldBeImplemented -] diff --git a/src/Pyramid-Bloc/PyramidBackgroundCommand.class.st b/src/Pyramid-Bloc/PyramidBackgroundCommand.class.st new file mode 100644 index 00000000..e4155773 --- /dev/null +++ b/src/Pyramid-Bloc/PyramidBackgroundCommand.class.st @@ -0,0 +1,18 @@ +Class { + #name : #PyramidBackgroundCommand, + #superclass : #PyramidAbstractBlocCommand, + #category : #'Pyramid-Bloc-plugin-bloc' +} + +{ #category : #'as yet unclassified' } +PyramidBackgroundCommand >> getValueFor: aBlElement [ + + ^ aBlElement background +] + +{ #category : #'as yet unclassified' } +PyramidBackgroundCommand >> setValueFor: aBlElement with: anArgument [ + + (anArgument class inheritsFrom: BlBackground) ifFalse: [^ self]. + aBlElement background: anArgument +] diff --git a/src/Pyramid-Bloc/PyramidBackgroundInputImage.class.st b/src/Pyramid-Bloc/PyramidBackgroundInputImage.class.st deleted file mode 100644 index b78925a5..00000000 --- a/src/Pyramid-Bloc/PyramidBackgroundInputImage.class.st +++ /dev/null @@ -1,127 +0,0 @@ -Class { - #name : #PyramidBackgroundInputImage, - #superclass : #PyramidBackgroundAbstractBackgroundInput, - #instVars : [ - 'form', - 'classMethodPresenter', - 'pathInput', - 'exploreButton' - ], - #category : #'Pyramid-Bloc-custom-specs-background' -} - -{ #category : #'as yet unclassified' } -PyramidBackgroundInputImage >> actionOpenFileExplorer [ - - | dialog result | - dialog := FileDialogWindow onFileSystem: FileSystem disk. - result := dialog openModal answer. - result - ifNil: [ self pathInput text: '' ] - ifNotNil: [ self pathInput text: result ]. -] - -{ #category : #accessing } -PyramidBackgroundInputImage >> background [ - - self submitFormFromText: self pathInput text. - self form ifNil: [ ^ BlBackground transparent ]. - ^ BlBackground image: self form -] - -{ #category : #layout } -PyramidBackgroundInputImage >> defaultLayout [ - - ^ SpBoxLayout newHorizontal - add: self pathInput expand: true; - add: self exploreButton expand: false; - yourself -] - -{ #category : #accessing } -PyramidBackgroundInputImage >> exploreButton [ -^ exploreButton -] - -{ #category : #accessing } -PyramidBackgroundInputImage >> form [ - - ^ form -] - -{ #category : #accessing } -PyramidBackgroundInputImage >> form: anObject [ - - form := anObject -] - -{ #category : #'as yet unclassified' } -PyramidBackgroundInputImage >> formFromClass: class andSelector: selector [ - - self form: (PyramidExternalRessourceProxy fromSource: - (PyramidExternalRessourceSource target: class selector: selector)) -] - -{ #category : #initialization } -PyramidBackgroundInputImage >> initializePresenters [ - - pathInput := SpTextInputFieldPresenter new whenSubmitDo: [ :text | - self submitFormFromText: text ]. - exploreButton := SpButtonPresenter new - icon: (self iconNamed: #configNew); - action: [ self actionOpenFileExplorer ]; - yourself -] - -{ #category : #accessing } -PyramidBackgroundInputImage >> pathInput [ - - ^ pathInput -] - -{ #category : #initialization } -PyramidBackgroundInputImage >> previewPresenterFrom: model [ - - | object | - model targetClass ifNil: [ - ^ SpLabelPresenter new - label: 'No class selected.'; - yourself ]. - (model targetClass canUnderstand: model methodSelector) ifFalse: [ - ^ SpLabelPresenter new - label: 'Can not perform method.'; - yourself ]. - object := model targetClass perform: model methodSelector. - (object isKindOf: Form) ifFalse: [ ^ SpLabelPresenter new - label: 'Image is not a Form. Will be remplaced by a BlTransparentBackground.'; - yourself ]. - ^ SpImagePresenter new - image: object; - yourself -] - -{ #category : #initialization } -PyramidBackgroundInputImage >> setImage: anImage [ - - (anImage respondsTo: #pyramidExternalRessourceSource) ifTrue: [ - self pathInput text: anImage pyramidExternalRessourceSource arguments first fullName ] -] - -{ #category : #'as yet unclassified' } -PyramidBackgroundInputImage >> submitFormFromText: aString [ - - aString asFileReference exists ifFalse: [ self pathInput text: '' ]. - self form: (PyramidExternalRessourceProxy fromSource: - (PyramidExternalRessourceSource formFromFileNamed: - (aString))) -] - -{ #category : #'as yet unclassified' } -PyramidBackgroundInputImage >> validateSelection: model [ - - model targetClass ifNil: [ ^ false ]. - model methodSelector ifNil: [ ^ false ]. - (model targetClass class canUnderstand: model methodSelector) ifFalse: [ ^ false ]. - ^ (model targetClass perform: model methodSelector withArguments: model methodArguments) isKindOf: Form - -] diff --git a/src/Pyramid-Bloc/PyramidBackgroundInputPresenter.class.st b/src/Pyramid-Bloc/PyramidBackgroundInputPresenter.class.st new file mode 100644 index 00000000..d803e58c --- /dev/null +++ b/src/Pyramid-Bloc/PyramidBackgroundInputPresenter.class.st @@ -0,0 +1,273 @@ +Class { + #name : #PyramidBackgroundInputPresenter, + #superclass : #PyramidInputPresenter, + #instVars : [ + 'notebook', + 'whenValueChangedDo', + 'modelPaintSolid', + 'modelPaintGradient', + 'modelImage', + 'modelTransparent', + 'modelMixedValues', + 'modelEmptyValue' + ], + #category : #'Pyramid-Bloc-plugin-bloc' +} + +{ #category : #'as yet unclassified' } +PyramidBackgroundInputPresenter >> bypassTrigger [ + + self flag: #TO_REMOVE. "I added it to make the test pass but it should be removed." + self whenValueChangedDo value: self value. +] + +{ #category : #layout } +PyramidBackgroundInputPresenter >> defaultLayout [ + + ^ SpBoxLayout newVertical + spacing: 4; + add: self notebook; + yourself +] + +{ #category : #initialization } +PyramidBackgroundInputPresenter >> initializeModelEmptyValue [ + + modelEmptyValue := PyramidBackgroundInputModel new + presenter: + (PyramidMonoValueInputPresenter new + value: PyramidEmptyValue new; + yourself); + page: (SpNotebookPage + title: '@ Empty' + icon: (self iconNamed: #smallDebug) + provider: [ self modelEmptyValue presenter ]); + yourself +] + +{ #category : #initialization } +PyramidBackgroundInputPresenter >> initializeModelImage [ + + modelImage := PyramidBackgroundInputModel new + presenter: + (PyramidColorInputSingleLinePresenter new + whenValueChangedDo: [ :x | + self whenValueChangedDo value: x asBlBackground ]; + yourself); + page: (SpNotebookPage + title: 'Image' + icon: (self iconNamed: #open) + provider: [ self modelImage presenter ]); + yourself. + + notebook addPage: modelImage page +] + +{ #category : #initialization } +PyramidBackgroundInputPresenter >> initializeModelMixedValues [ + + modelMixedValues := PyramidBackgroundInputModel new + presenter: + (PyramidMonoValueInputPresenter new + value: PyramidMixedValues new; + yourself); + page: (SpNotebookPage + title: '@ Mixed' + icon: (self iconNamed: #smallDebug) + provider: [ self modelMixedValues presenter ]); + yourself +] + +{ #category : #initialization } +PyramidBackgroundInputPresenter >> initializeModelPaintGradient [ + + modelPaintGradient := PyramidBackgroundInputModel new + presenter: + (PyramidGradientPaintInputPresenter new + whenValueChangedDo: [ :x | + self whenValueChangedDo value: + x asBlBackground ]; + yourself); + page: (SpNotebookPage + title: 'Gradient' + icon: (self iconNamed: #image) + provider: [ + self modelPaintGradient presenter ]); + yourself. + + notebook addPage: modelPaintGradient page +] + +{ #category : #initialization } +PyramidBackgroundInputPresenter >> initializeModelPaintSolid [ + + modelPaintSolid := PyramidBackgroundInputModel new + presenter: + (PyramidColorInputMultiLinesPresenter new + whenValueChangedDo: [ :x | + self whenValueChangedDo value: + x asBlBackground ]; + yourself); + page: (SpNotebookPage + title: 'Paint' + icon: (self iconNamed: #smallSelect) + provider: [ self modelPaintSolid presenter ]); + yourself. + + notebook addPage: modelPaintSolid page +] + +{ #category : #initialization } +PyramidBackgroundInputPresenter >> initializeModelTransparent [ + + modelTransparent := PyramidBackgroundInputModel new + presenter: + (PyramidMonoValueInputPresenter new + value: BlBackground transparent; + whenValueChangedDo: [ :x | + self whenValueChangedDo value: + x asBlBackground ]; + yourself); + page: (SpNotebookPage + title: 'Transparent' + icon: (self iconNamed: #changeRemove) + provider: [ self modelTransparent presenter ]); + yourself. + + notebook addPage: modelTransparent page +] + +{ #category : #initialization } +PyramidBackgroundInputPresenter >> initializePresenters [ + + whenValueChangedDo := [ :back | ]. + notebook := SpNotebookPresenter new. + self initializeModelPaintSolid. + self initializeModelPaintGradient. + self initializeModelTransparent. + self initializeModelImage. + self initializeModelMixedValues. + self initializeModelEmptyValue. + + notebook whenSelectedPageChangedDo: [ :page | + self whenValueChangedDo value: self value ] +] + +{ #category : #accessing } +PyramidBackgroundInputPresenter >> modelEmptyValue [ + + ^ modelEmptyValue +] + +{ #category : #accessing } +PyramidBackgroundInputPresenter >> modelImage [ + + ^ modelImage +] + +{ #category : #accessing } +PyramidBackgroundInputPresenter >> modelMixedValues [ +^ modelMixedValues +] + +{ #category : #accessing } +PyramidBackgroundInputPresenter >> modelPaintGradient [ + + ^ modelPaintGradient +] + +{ #category : #accessing } +PyramidBackgroundInputPresenter >> modelPaintSolid [ + + ^ modelPaintSolid +] + +{ #category : #accessing } +PyramidBackgroundInputPresenter >> modelTransparent [ + + ^ modelTransparent +] + +{ #category : #layout } +PyramidBackgroundInputPresenter >> notebook [ + + ^ notebook +] + +{ #category : #accessing } +PyramidBackgroundInputPresenter >> selectEmptyValue [ + + self notebook addPage: self modelEmptyValue page. + self notebook selectPage: self modelEmptyValue page +] + +{ #category : #'as yet unclassified' } +PyramidBackgroundInputPresenter >> selectImage [ + + self notebook selectPage: self modelImage page. + [ self notebook removePage: self modelMixedValues page ] + on: NotFound + do: [ "nothing" ] +] + +{ #category : #accessing } +PyramidBackgroundInputPresenter >> selectMixedValues [ + + self notebook addPage: self modelMixedValues page. + self notebook selectPage: self modelMixedValues page +] + +{ #category : #'as yet unclassified' } +PyramidBackgroundInputPresenter >> selectPaintGradientWith: aBlColorPaint [ + + self notebook selectPage: self modelPaintGradient page. + self modelPaintGradient presenter value: aBlColorPaint. + [ self notebook removePage: self modelMixedValues page ] + on: NotFound + do: [ "nothing" ] +] + +{ #category : #'as yet unclassified' } +PyramidBackgroundInputPresenter >> selectPaintSolidWith: aBlColorPaint [ + + self notebook selectPage: self modelPaintSolid page. + self modelPaintSolid presenter value: aBlColorPaint color. + + [self notebook removePage: self modelMixedValues page] on: NotFound do: [ "nothing" ] +] + +{ #category : #'as yet unclassified' } +PyramidBackgroundInputPresenter >> selectTransparent [ + + self notebook selectPage: self modelTransparent page. + [ self notebook removePage: self modelMixedValues page ] + on: NotFound + do: [ "nothing" ] +] + +{ #category : #'as yet unclassified' } +PyramidBackgroundInputPresenter >> value [ + + ^ self notebook selectedPage presenterProvider value value asBlBackground +] + +{ #category : #'as yet unclassified' } +PyramidBackgroundInputPresenter >> value: aBackground [ + | temp | + temp := self whenValueChangedDo. + self whenValueChangedDo: [ :something | ]. + aBackground selectOnBackgroundInput: self. + self whenValueChangedDo: temp. +] + +{ #category : #accessing } +PyramidBackgroundInputPresenter >> whenValueChangedDo [ + + ^ whenValueChangedDo +] + +{ #category : #accessing } +PyramidBackgroundInputPresenter >> whenValueChangedDo: anObject [ + + whenValueChangedDo := anObject +] diff --git a/src/Pyramid-Bloc/PyramidBackgroundInputTransparent.class.st b/src/Pyramid-Bloc/PyramidBackgroundInputTransparent.class.st deleted file mode 100644 index 3ff24638..00000000 --- a/src/Pyramid-Bloc/PyramidBackgroundInputTransparent.class.st +++ /dev/null @@ -1,17 +0,0 @@ -Class { - #name : #PyramidBackgroundInputTransparent, - #superclass : #PyramidBackgroundAbstractBackgroundInput, - #category : #'Pyramid-Bloc-custom-specs-background' -} - -{ #category : #accessing } -PyramidBackgroundInputTransparent >> background [ - - ^ BlBackground transparent -] - -{ #category : #layout } -PyramidBackgroundInputTransparent >> defaultLayout [ - - ^ SpBoxLayout newHorizontal add: 'Transparent. Nothing to see here.'; yourself -] diff --git a/src/Pyramid-Bloc/PyramidBackgroundInputWithModalPresenter.class.st b/src/Pyramid-Bloc/PyramidBackgroundInputWithModalPresenter.class.st new file mode 100644 index 00000000..7d5175ea --- /dev/null +++ b/src/Pyramid-Bloc/PyramidBackgroundInputWithModalPresenter.class.st @@ -0,0 +1,13 @@ +Class { + #name : #PyramidBackgroundInputWithModalPresenter, + #superclass : #PyramidInputWithModalPresenter, + #category : #'Pyramid-Bloc-plugin-bloc' +} + +{ #category : #initialization } +PyramidBackgroundInputWithModalPresenter >> initializePresenters [ + + super initializePresenters. + self presenter: PyramidBackgroundPreviewPresenter new. + self presenterModal: PyramidBackgroundInputPresenter new +] diff --git a/src/Pyramid-Bloc/PyramidBackgroundModalPresenter.class.st b/src/Pyramid-Bloc/PyramidBackgroundModalPresenter.class.st deleted file mode 100644 index aab2974b..00000000 --- a/src/Pyramid-Bloc/PyramidBackgroundModalPresenter.class.st +++ /dev/null @@ -1,169 +0,0 @@ -Class { - #name : #PyramidBackgroundModalPresenter, - #superclass : #SpPresenter, - #classTraits : 'TPyramidProjectModelObserver classTrait', - #instVars : [ - 'buttonTransparent', - 'buttonImage', - 'buttonComposite', - 'buttonPaint', - 'currentPresenter', - 'paintPresenter', - 'submitBlock' - ], - #category : #'Pyramid-Bloc-custom-specs-background' -} - -{ #category : #visiting } -PyramidBackgroundModalPresenter >> acceptLabel [ - - ^ 'Change Background' -] - -{ #category : #accessing } -PyramidBackgroundModalPresenter >> buttonComposite [ - - ^ buttonComposite -] - -{ #category : #accessing } -PyramidBackgroundModalPresenter >> buttonImage [ - - ^ buttonImage -] - -{ #category : #accessing } -PyramidBackgroundModalPresenter >> buttonPaint [ - - ^ buttonPaint -] - -{ #category : #accessing } -PyramidBackgroundModalPresenter >> buttonTransparent [ - - ^ buttonTransparent -] - -{ #category : #'as yet unclassified' } -PyramidBackgroundModalPresenter >> changeBackground [ - - self submitBlock value: self currentPresenter background -] - -{ #category : #'initialization - deprecated' } -PyramidBackgroundModalPresenter >> changeToComposite [ - - self updateLayoutWith: PyramidBackgroundInputTransparent new -] - -{ #category : #'initialization - deprecated' } -PyramidBackgroundModalPresenter >> changeToImage [ - - self updateLayoutWith: PyramidBackgroundInputImage new -] - -{ #category : #'initialization - deprecated' } -PyramidBackgroundModalPresenter >> changeToPaint [ - - self updateLayoutWith: self paintPresenter -] - -{ #category : #'initialization - deprecated' } -PyramidBackgroundModalPresenter >> changeToTransparent [ - - self updateLayoutWith: PyramidBackgroundInputTransparent new -] - -{ #category : #'initialization - deprecated' } -PyramidBackgroundModalPresenter >> currentPresenter [ -^ currentPresenter -] - -{ #category : #'initialization - deprecated' } -PyramidBackgroundModalPresenter >> currentPresenter: anObject [ - - currentPresenter := anObject -] - -{ #category : #layout } -PyramidBackgroundModalPresenter >> defaultLayout [ - - ^ SpBoxLayout newVertical spacing: 4; add: (SpBoxLayout newHorizontal - spacing: 4; - add: self buttonTransparent; - add: self buttonImage; - add: self buttonComposite; - add: self buttonPaint; - yourself) expand: false; - add: self currentPresenter ; yourself -] - -{ #category : #initialization } -PyramidBackgroundModalPresenter >> initializeDialogWindow: aDialogWindowPresenter [ - - super initializeDialogWindow: aDialogWindowPresenter. - aDialogWindowPresenter - title: 'Changes Background'; - initialExtent: 600 @ 500; - okAction: [ self changeBackground ] -] - -{ #category : #'initialization - deprecated' } -PyramidBackgroundModalPresenter >> initializePresenters [ - - currentPresenter := PyramidBackgroundInputTransparent new. - buttonTransparent := SpRadioButtonPresenter new - label: 'Transparent'; - yourself. - buttonImage := SpRadioButtonPresenter new - label: 'Image'; - yourself. - buttonComposite := SpRadioButtonPresenter new - label: 'Composite'; - yourself. - buttonPaint := SpRadioButtonPresenter new - label: 'Paint'; - yourself. - buttonTransparent associatedRadioButtons: { - buttonImage. - buttonComposite. - buttonPaint }. - buttonTransparent whenActivatedDo: [ self changeToTransparent ]. - buttonImage whenActivatedDo: [ self changeToImage ]. - buttonComposite whenActivatedDo: [ self changeToComposite ]. - buttonPaint whenActivatedDo: [ self changeToPaint ] -] - -{ #category : #'initialization - deprecated' } -PyramidBackgroundModalPresenter >> paintPresenter [ -paintPresenter ifNil: [ paintPresenter := PyramidPaintInputPresenter new]. -^ paintPresenter -] - -{ #category : #'as yet unclassified' } -PyramidBackgroundModalPresenter >> selectBackground: aBackground [ - - aBackground pyramidSelectMenuOnModal: self - - -] - -{ #category : #'as yet unclassified' } -PyramidBackgroundModalPresenter >> submitBlock [ - - submitBlock ifNil: [ submitBlock := [ :b | ] ]. - ^ submitBlock -] - -{ #category : #'initialization - deprecated' } -PyramidBackgroundModalPresenter >> updateLayoutWith: aSpPresenter [ - - self layout replace: self currentPresenter with: aSpPresenter. - self currentPresenter: aSpPresenter -] - -{ #category : #'as yet unclassified' } -PyramidBackgroundModalPresenter >> whenSubmitDo: aBlock [ - - submitBlock := aBlock -] diff --git a/src/Pyramid-Bloc/PyramidBackgroundPreviewPresenter.class.st b/src/Pyramid-Bloc/PyramidBackgroundPreviewPresenter.class.st new file mode 100644 index 00000000..ef7786cd --- /dev/null +++ b/src/Pyramid-Bloc/PyramidBackgroundPreviewPresenter.class.st @@ -0,0 +1,40 @@ +Class { + #name : #PyramidBackgroundPreviewPresenter, + #superclass : #PyramidInputPreviewPresenter, + #category : #'Pyramid-Bloc-plugin-bloc' +} + +{ #category : #initialization } +PyramidBackgroundPreviewPresenter >> image: aForm label: aString [ + + self image image: aForm. + self label label: aString +] + +{ #category : #initialization } +PyramidBackgroundPreviewPresenter >> setBackgroundValue: anObject [ + + + self image: anObject asForm label: anObject asString +] + +{ #category : #initialization } +PyramidBackgroundPreviewPresenter >> setUnknowValue [ + + self image: (self iconNamed: #help) label: PyramidUnknowState new asString +] + +{ #category : #initialization } +PyramidBackgroundPreviewPresenter >> setUnknowValue: anObject [ + + self image: (self iconNamed: #help) label: anObject asString +] + +{ #category : #'as yet unclassified' } +PyramidBackgroundPreviewPresenter >> value: anObject [ + "Class test is not a good patern, maybe it should be directly on the object ?" + + (anObject class inheritsFrom: BlBackground )ifTrue: [ ^ self setBackgroundValue: anObject ]. + (anObject class inheritsFrom: PyramidUnknowState )ifTrue: [ ^ self setUnknowValue: anObject ]. + self setUnknowValue +] diff --git a/src/Pyramid-Bloc/PyramidBackgroundPropertyInput.class.st b/src/Pyramid-Bloc/PyramidBackgroundPropertyInput.class.st deleted file mode 100644 index d82b4277..00000000 --- a/src/Pyramid-Bloc/PyramidBackgroundPropertyInput.class.st +++ /dev/null @@ -1,126 +0,0 @@ -Class { - #name : #PyramidBackgroundPropertyInput, - #superclass : #SpPresenter, - #instVars : [ - 'submitBlock', - 'preview', - 'strategy', - 'modalButton', - 'modal', - 'background', - 'modalWindow' - ], - #category : #'Pyramid-Bloc-custom-specs-background' -} - -{ #category : #'api - text style' } -PyramidBackgroundPropertyInput >> background [ - - ^ background -] - -{ #category : #'api - text style' } -PyramidBackgroundPropertyInput >> background: aBlBackground [ - - background := aBlBackground. - self strategy: - aBlBackground pyramidBackgroundStrategy. - self submitBlock value -] - -{ #category : #'as yet unclassified' } -PyramidBackgroundPropertyInput >> closeModalWindow [ - - self modalWindow ifNotNil: [ self modalWindow close ]. -] - -{ #category : #layout } -PyramidBackgroundPropertyInput >> defaultLayout [ - - ^ SpBoxLayout newHorizontal - spacing: 4; - add: self preview expand: true; - add: self modalButton withConstraints: [ :c | - c width: 24. - c height: 24 ]; - yourself -] - -{ #category : #initialization } -PyramidBackgroundPropertyInput >> initializePresenters [ - - modal := PyramidBackgroundModalPresenter new whenSubmitDo: [ :back | - self background: back ]. - modalButton := SpButtonPresenter new - icon: (self iconNamed: #smallCogInitialState); - action: [ - self modalWindow:( self modal - selectBackground: self background; - openDialog) ]; - yourself -] - -{ #category : #accessing } -PyramidBackgroundPropertyInput >> modal [ - - ^ modal -] - -{ #category : #accessing } -PyramidBackgroundPropertyInput >> modalButton [ - - ^ modalButton -] - -{ #category : #'as yet unclassified' } -PyramidBackgroundPropertyInput >> modalWindow [ - - ^ modalWindow -] - -{ #category : #'as yet unclassified' } -PyramidBackgroundPropertyInput >> modalWindow: anObject [ - - modalWindow := anObject -] - -{ #category : #accessing } -PyramidBackgroundPropertyInput >> preview [ - - ^ preview -] - -{ #category : #accessing } -PyramidBackgroundPropertyInput >> preview: anObject [ - - self layout replace: preview with: anObject. - preview := anObject. - -] - -{ #category : #accessing } -PyramidBackgroundPropertyInput >> strategy [ - - strategy ifNil: [ - strategy := PyramidBackgroundPropertyInputUnknownStrategy new ]. - ^ strategy -] - -{ #category : #'api - text style' } -PyramidBackgroundPropertyInput >> strategy: aStrategy [ - - strategy := aStrategy. - self preview: aStrategy preview -] - -{ #category : #accessing } -PyramidBackgroundPropertyInput >> submitBlock [ - - ^ submitBlock -] - -{ #category : #enumerating } -PyramidBackgroundPropertyInput >> whenSubmitDo: aBlock [ - - submitBlock := aBlock -] diff --git a/src/Pyramid-Bloc/PyramidBackgroundPropertyInputImage.class.st b/src/Pyramid-Bloc/PyramidBackgroundPropertyInputImage.class.st deleted file mode 100644 index 45137bfa..00000000 --- a/src/Pyramid-Bloc/PyramidBackgroundPropertyInputImage.class.st +++ /dev/null @@ -1,36 +0,0 @@ -Class { - #name : #PyramidBackgroundPropertyInputImage, - #superclass : #PyramidBackgroundPropertyInputStrategy, - #instVars : [ - 'preview' - ], - #category : #'Pyramid-Bloc-custom-specs-background' -} - -{ #category : #accessing } -PyramidBackgroundPropertyInputImage >> preview [ - - ^ preview -] - -{ #category : #accessing } -PyramidBackgroundPropertyInputImage >> preview: anObject [ - - preview := anObject -] - -{ #category : #accessing } -PyramidBackgroundPropertyInputImage >> ressource: anExternalRessource [ - - anExternalRessource ifNil: [ - self preview: (SpLabelPresenter new - label: 'No an external ressources'; - yourself). - ^ self ]. - - self preview: (SpLabelPresenter new - label: - anExternalRessource target name , ' - ' - , anExternalRessource arguments first printString; - yourself) -] diff --git a/src/Pyramid-Bloc/PyramidBackgroundPropertyInputMixedValuesModel.class.st b/src/Pyramid-Bloc/PyramidBackgroundPropertyInputMixedValuesModel.class.st deleted file mode 100644 index 50e61e91..00000000 --- a/src/Pyramid-Bloc/PyramidBackgroundPropertyInputMixedValuesModel.class.st +++ /dev/null @@ -1,13 +0,0 @@ -Class { - #name : #PyramidBackgroundPropertyInputMixedValuesModel, - #superclass : #PyramidBackgroundPropertyInputStrategy, - #category : #'Pyramid-Bloc-custom-specs-background' -} - -{ #category : #accessing } -PyramidBackgroundPropertyInputMixedValuesModel >> preview [ - - ^ SpLabelPresenter new - label: 'Mixed values'; - yourself -] diff --git a/src/Pyramid-Bloc/PyramidBackgroundPropertyInputNoValueModel.class.st b/src/Pyramid-Bloc/PyramidBackgroundPropertyInputNoValueModel.class.st deleted file mode 100644 index 78561ad3..00000000 --- a/src/Pyramid-Bloc/PyramidBackgroundPropertyInputNoValueModel.class.st +++ /dev/null @@ -1,19 +0,0 @@ -Class { - #name : #PyramidBackgroundPropertyInputNoValueModel, - #superclass : #PyramidBackgroundPropertyInputStrategy, - #category : #'Pyramid-Bloc-custom-specs-background' -} - -{ #category : #testing } -PyramidBackgroundPropertyInputNoValueModel >> hasModal [ - - ^ false -] - -{ #category : #accessing } -PyramidBackgroundPropertyInputNoValueModel >> preview [ - - ^ SpLabelPresenter new - label: 'No values'; - yourself -] diff --git a/src/Pyramid-Bloc/PyramidBackgroundPropertyInputPaint.class.st b/src/Pyramid-Bloc/PyramidBackgroundPropertyInputPaint.class.st deleted file mode 100644 index 9b1164d0..00000000 --- a/src/Pyramid-Bloc/PyramidBackgroundPropertyInputPaint.class.st +++ /dev/null @@ -1,26 +0,0 @@ -Class { - #name : #PyramidBackgroundPropertyInputPaint, - #superclass : #PyramidBackgroundPropertyInputStrategy, - #instVars : [ - 'preview' - ], - #category : #'Pyramid-Bloc-custom-specs-background' -} - -{ #category : #accessing } -PyramidBackgroundPropertyInputPaint >> paint: aBlPaint [ - - self preview: aBlPaint pyramidBackgroundPreview -] - -{ #category : #accessing } -PyramidBackgroundPropertyInputPaint >> preview [ - - ^ preview -] - -{ #category : #accessing } -PyramidBackgroundPropertyInputPaint >> preview: anObject [ - - preview := anObject -] diff --git a/src/Pyramid-Bloc/PyramidBackgroundPropertyInputStrategy.class.st b/src/Pyramid-Bloc/PyramidBackgroundPropertyInputStrategy.class.st deleted file mode 100644 index df38adb4..00000000 --- a/src/Pyramid-Bloc/PyramidBackgroundPropertyInputStrategy.class.st +++ /dev/null @@ -1,17 +0,0 @@ -Class { - #name : #PyramidBackgroundPropertyInputStrategy, - #superclass : #Object, - #category : #'Pyramid-Bloc-custom-specs-background' -} - -{ #category : #testing } -PyramidBackgroundPropertyInputStrategy >> hasModal [ - - ^ true -] - -{ #category : #accessing } -PyramidBackgroundPropertyInputStrategy >> preview [ - - ^ SpNullPresenter new -] diff --git a/src/Pyramid-Bloc/PyramidBackgroundPropertyInputTransparent.class.st b/src/Pyramid-Bloc/PyramidBackgroundPropertyInputTransparent.class.st deleted file mode 100644 index e5768687..00000000 --- a/src/Pyramid-Bloc/PyramidBackgroundPropertyInputTransparent.class.st +++ /dev/null @@ -1,17 +0,0 @@ -Class { - #name : #PyramidBackgroundPropertyInputTransparent, - #superclass : #PyramidBackgroundPropertyInputStrategy, - #instVars : [ - 'preview' - ], - #category : #'Pyramid-Bloc-custom-specs-background' -} - -{ #category : #accessing } -PyramidBackgroundPropertyInputTransparent >> preview [ - - preview ifNil: [ preview := SpLabelPresenter new - label: 'Transparent'; - yourself ]. - ^ preview -] diff --git a/src/Pyramid-Bloc/PyramidBackgroundPropertyInputUnknownStrategy.class.st b/src/Pyramid-Bloc/PyramidBackgroundPropertyInputUnknownStrategy.class.st deleted file mode 100644 index ab734e03..00000000 --- a/src/Pyramid-Bloc/PyramidBackgroundPropertyInputUnknownStrategy.class.st +++ /dev/null @@ -1,27 +0,0 @@ -Class { - #name : #PyramidBackgroundPropertyInputUnknownStrategy, - #superclass : #PyramidBackgroundPropertyInputStrategy, - #category : #'Pyramid-Bloc-custom-specs-background' -} - -{ #category : #accessing } -PyramidBackgroundPropertyInputUnknownStrategy >> button [ - - ^ super button - enabled: false; - yourself -] - -{ #category : #accessing } -PyramidBackgroundPropertyInputUnknownStrategy >> hasModal [ - - ^ false -] - -{ #category : #accessing } -PyramidBackgroundPropertyInputUnknownStrategy >> preview [ - - ^ SpLabelPresenter new - label: 'Unknown strategy'; - yourself -] diff --git a/src/Pyramid-Bloc/PyramidBasicConstraintsCommand.class.st b/src/Pyramid-Bloc/PyramidBasicConstraintsCommand.class.st new file mode 100644 index 00000000..47df5075 --- /dev/null +++ b/src/Pyramid-Bloc/PyramidBasicConstraintsCommand.class.st @@ -0,0 +1,21 @@ +Class { + #name : #PyramidBasicConstraintsCommand, + #superclass : #PyramidAbstractBlocCommand, + #category : #'Pyramid-Bloc-plugin-bloc-layout' +} + +{ #category : #testing } +PyramidBasicConstraintsCommand >> canBeUsedFor: anObject [ + + ^ (super canBeUsedFor: anObject) and: [ + anObject hasParent and: [ + self targetsLayoutClass includes: anObject parent layout class ] ] +] + +{ #category : #'as yet unclassified' } +PyramidBasicConstraintsCommand >> targetsLayoutClass [ + + ^ { + BlBasicLayout. + BlFlowLayout } +] diff --git a/src/Pyramid-Bloc/PyramidBasicConstraintsInputPresenter.class.st b/src/Pyramid-Bloc/PyramidBasicConstraintsInputPresenter.class.st new file mode 100644 index 00000000..60058190 --- /dev/null +++ b/src/Pyramid-Bloc/PyramidBasicConstraintsInputPresenter.class.st @@ -0,0 +1,144 @@ +Class { + #name : #PyramidBasicConstraintsInputPresenter, + #superclass : #PyramidInputPresenter, + #instVars : [ + 'buttonExact', + 'buttonMatchParent', + 'buttonFitContent', + 'whenValueChangedDo', + 'value' + ], + #category : #'Pyramid-Bloc-plugin-bloc-layout' +} + +{ #category : #accessing } +PyramidBasicConstraintsInputPresenter >> buttonExact [ + + ^ buttonExact +] + +{ #category : #accessing } +PyramidBasicConstraintsInputPresenter >> buttonFitContent [ + + ^ buttonFitContent +] + +{ #category : #accessing } +PyramidBasicConstraintsInputPresenter >> buttonMatchParent [ + + ^ buttonMatchParent +] + +{ #category : #layout } +PyramidBasicConstraintsInputPresenter >> defaultLayout [ + + ^ SpBoxLayout newHorizontal + spacing: 4; + add: self buttonExact; +add: self buttonMatchParent; +add: self buttonFitContent; + yourself +] + +{ #category : #initialization } +PyramidBasicConstraintsInputPresenter >> initializePresenters [ + + whenValueChangedDo := [ :visibility | ]. + buttonExact := SpButtonPresenter new + label: 'Exact'; + help: 'Set the constraints to an exact value in px.'; + action: [ + self value: + (BlLayoutCommonConstraintsAxis new exact: 50). + self whenValueChangedDo value: self value ]; + enabled: false; + yourself. + buttonMatchParent := SpButtonPresenter new + label: 'Match Parent'; + help: 'Set the constraints to match the parent size.'; + action: [ + self value: + BlLayoutCommonConstraintsAxis new + matchParent. + self whenValueChangedDo value: self value ]; + enabled: false; + yourself. + buttonFitContent := SpButtonPresenter new + label: 'Fit Content'; + help: 'Set the constraints to match the children size.'; + action: [ + self value: + BlLayoutCommonConstraintsAxis new fitContent. + self whenValueChangedDo value: self value ]; + enabled: false; + yourself +] + +{ #category : #initialization } +PyramidBasicConstraintsInputPresenter >> setExact [ + + self buttonExact + enabled: true; + icon: (self iconNamed: #checkboxSelected). + self buttonFitContent + enabled: true; + icon: (self iconNamed: #checkboxUnselected). + self buttonMatchParent + enabled: true; + icon: (self iconNamed: #checkboxUnselected) +] + +{ #category : #initialization } +PyramidBasicConstraintsInputPresenter >> setFitContent [ + + self buttonExact + enabled: true; + icon: (self iconNamed: #checkboxUnselected). + self buttonFitContent + enabled: true; + icon: (self iconNamed: #checkboxSelected). + self buttonMatchParent + enabled: true; + icon: (self iconNamed: #checkboxUnselected) +] + +{ #category : #initialization } +PyramidBasicConstraintsInputPresenter >> setMatchParent [ + + self buttonExact enabled: true; icon: (self iconNamed: #checkboxUnselected). + self buttonFitContent enabled: true; icon: (self iconNamed: #checkboxUnselected). + self buttonMatchParent enabled: true; icon: (self iconNamed: #checkboxSelected). +] + +{ #category : #initialization } +PyramidBasicConstraintsInputPresenter >> setUnknowValue [ + + self buttonExact enabled: false; icon: (self iconNamed: #checkboxUnselected). + self buttonFitContent enabled: false; icon: (self iconNamed: #checkboxUnselected). + self buttonMatchParent enabled: false; icon: (self iconNamed: #checkboxUnselected). +] + +{ #category : #'as yet unclassified' } +PyramidBasicConstraintsInputPresenter >> value [ + + ^ value asPyramidConstraintsArgument +] + +{ #category : #'as yet unclassified' } +PyramidBasicConstraintsInputPresenter >> value: aCommonConstraints [ + + value := aCommonConstraints. + aCommonConstraints setConstraintsOn: self +] + +{ #category : #accessing } +PyramidBasicConstraintsInputPresenter >> whenValueChangedDo [ + + ^ whenValueChangedDo +] + +{ #category : #accessing } +PyramidBasicConstraintsInputPresenter >> whenValueChangedDo: anObject [ + + whenValueChangedDo := anObject +] diff --git a/src/Pyramid-Bloc/PyramidBasicExactHorizontalConstraintsBlocCommand.class.st b/src/Pyramid-Bloc/PyramidBasicExactHorizontalConstraintsBlocCommand.class.st new file mode 100644 index 00000000..0988c930 --- /dev/null +++ b/src/Pyramid-Bloc/PyramidBasicExactHorizontalConstraintsBlocCommand.class.st @@ -0,0 +1,24 @@ +Class { + #name : #PyramidBasicExactHorizontalConstraintsBlocCommand, + #superclass : #PyramidBasicConstraintsCommand, + #category : #'Pyramid-Bloc-plugin-bloc-layout' +} + +{ #category : #'as yet unclassified' } +PyramidBasicExactHorizontalConstraintsBlocCommand >> canBeUsedFor: anObject [ + + ^ (super canBeUsedFor: anObject) and: [ + anObject constraints horizontal resizer isExact ] +] + +{ #category : #'as yet unclassified' } +PyramidBasicExactHorizontalConstraintsBlocCommand >> getValueFor: anObject [ + +^ anObject constraints horizontal resizer size +] + +{ #category : #'as yet unclassified' } +PyramidBasicExactHorizontalConstraintsBlocCommand >> setValueFor: anObject with: anArgument [ + + ^ anObject constraintsDo: [ :c | c horizontal exact: anArgument ] +] diff --git a/src/Pyramid-Bloc/PyramidBasicExactVerticalConstraintsBlocCommand.class.st b/src/Pyramid-Bloc/PyramidBasicExactVerticalConstraintsBlocCommand.class.st new file mode 100644 index 00000000..664cf61e --- /dev/null +++ b/src/Pyramid-Bloc/PyramidBasicExactVerticalConstraintsBlocCommand.class.st @@ -0,0 +1,24 @@ +Class { + #name : #PyramidBasicExactVerticalConstraintsBlocCommand, + #superclass : #PyramidBasicConstraintsCommand, + #category : #'Pyramid-Bloc-plugin-bloc-layout' +} + +{ #category : #'as yet unclassified' } +PyramidBasicExactVerticalConstraintsBlocCommand >> canBeUsedFor: anObject [ + + ^ (super canBeUsedFor: anObject) and: [ + anObject constraints vertical resizer isExact ] +] + +{ #category : #'as yet unclassified' } +PyramidBasicExactVerticalConstraintsBlocCommand >> getValueFor: anObject [ + + ^ anObject constraints vertical resizer size +] + +{ #category : #'as yet unclassified' } +PyramidBasicExactVerticalConstraintsBlocCommand >> setValueFor: anObject with: anArgument [ + + ^ anObject constraintsDo: [ :c | c vertical exact: anArgument ] +] diff --git a/src/Pyramid-Bloc/PyramidBasicHorizontalConstraintsBlocCommand.class.st b/src/Pyramid-Bloc/PyramidBasicHorizontalConstraintsBlocCommand.class.st new file mode 100644 index 00000000..1c1af430 --- /dev/null +++ b/src/Pyramid-Bloc/PyramidBasicHorizontalConstraintsBlocCommand.class.st @@ -0,0 +1,38 @@ +Class { + #name : #PyramidBasicHorizontalConstraintsBlocCommand, + #superclass : #PyramidBasicConstraintsCommand, + #category : #'Pyramid-Bloc-plugin-bloc-layout' +} + +{ #category : #'as yet unclassified' } +PyramidBasicHorizontalConstraintsBlocCommand >> getValueFor: anObject [ + + ^ anObject constraints horizontal +] + +{ #category : #'as yet unclassified' } +PyramidBasicHorizontalConstraintsBlocCommand >> saveStatesOf: aCollection withCommand: aCommand withArguments: anArguments [ + + | mementos | + mementos := aCollection collect: [ :each | + PyramidCommandMemento new + command: aCommand; + target: each; + arguments: (self getValueFor: each) asPyramidConstraintsArgument; + yourself ]. + mementos size = 1 ifTrue: [ ^ mementos first ]. + ^ PyramidCompositeMemento new + mementos: mementos; + yourself +] + +{ #category : #'as yet unclassified' } +PyramidBasicHorizontalConstraintsBlocCommand >> setValueFor: anObject with: anArgument [ + + anArgument isSymbol + ifFalse: [ + anObject constraintsDo: [ :c | + c horizontal perform: anArgument first with: anArgument last ] ] + ifTrue: [ + anObject constraintsDo: [ :c | c horizontal perform: anArgument ] ] +] diff --git a/src/Pyramid-Bloc/PyramidBasicVerticalConstraintsBlocCommand.class.st b/src/Pyramid-Bloc/PyramidBasicVerticalConstraintsBlocCommand.class.st new file mode 100644 index 00000000..b68c7202 --- /dev/null +++ b/src/Pyramid-Bloc/PyramidBasicVerticalConstraintsBlocCommand.class.st @@ -0,0 +1,39 @@ +Class { + #name : #PyramidBasicVerticalConstraintsBlocCommand, + #superclass : #PyramidBasicConstraintsCommand, + #category : #'Pyramid-Bloc-plugin-bloc-layout' +} + +{ #category : #'as yet unclassified' } +PyramidBasicVerticalConstraintsBlocCommand >> getValueFor: anObject [ + + ^ anObject constraints vertical +] + +{ #category : #'as yet unclassified' } +PyramidBasicVerticalConstraintsBlocCommand >> saveStatesOf: aCollection withCommand: aCommand withArguments: anArguments [ + + | mementos | + mementos := aCollection collect: [ :each | + PyramidCommandMemento new + command: aCommand; + target: each; + arguments: + (self getValueFor: each) asPyramidConstraintsArgument; + yourself ]. + mementos size = 1 ifTrue: [ ^ mementos first ]. + ^ PyramidCompositeMemento new + mementos: mementos; + yourself +] + +{ #category : #'as yet unclassified' } +PyramidBasicVerticalConstraintsBlocCommand >> setValueFor: anObject with: anArgument [ + + anArgument isSymbol + ifFalse: [ + anObject constraintsDo: [ :c | + c vertical perform: anArgument first with: anArgument last ] ] + ifTrue: [ + anObject constraintsDo: [ :c | c vertical perform: anArgument ] ] +] diff --git a/src/Pyramid-Bloc/PyramidBlocCommand.class.st b/src/Pyramid-Bloc/PyramidBlocCommand.class.st deleted file mode 100644 index 2ac06b1e..00000000 --- a/src/Pyramid-Bloc/PyramidBlocCommand.class.st +++ /dev/null @@ -1,205 +0,0 @@ -Class { - #name : #PyramidBlocCommand, - #superclass : #Object, - #category : #'Pyramid-Bloc-plugin-bloc-properties' -} - -{ #category : #adding } -PyramidBlocCommand class >> addChildren [ - - ^ PyramidCommand - name: #addChildren - set: [ :state :target | target addChildren: state arguments ] - get: [ :state :source | - state source: source. - state arguments: source children asArray ] - isExecutableBlock: [ :obj :state | obj isKindOf: BlElement ] -] - -{ #category : #adding } -PyramidBlocCommand class >> addElementOnCollection [ - - ^ PyramidCommand - name: #addElementOnCollection - set: [ :state :target | target addAll: state arguments ] - get: [ :state :source | - state source: source. - state arguments: source collection asArray ] - isExecutableBlock: [ :obj :state| obj isCollection ] -] - -{ #category : #adding } -PyramidBlocCommand class >> background [ - - ^ PyramidCommand - name: #background - set: [ :state :target | target background: state arguments ] - get: [ :state :source | - state source: source. - state arguments: source background ] - isExecutableBlock: [ :obj :state | (obj isKindOf: BlElement) ] -] - -{ #category : #adding } -PyramidBlocCommand class >> border [ - - ^ PyramidCommand - name: #border - set: [ :state :target | target border: state arguments ] - get: [ :state :source | - state source: source. - state arguments: source border ] - isExecutableBlock: [ :obj :state | obj isKindOf: BlElement ] -] - -{ #category : #adding } -PyramidBlocCommand class >> borderPaint [ - - ^ PyramidCommand - name: #borderPaint - set: [ :state :target | - target border: - (BlBorder paint: state arguments width: target border width) ] - get: [ :state :source | - state source: source. - state arguments: source border paint ] - isExecutableBlock: [ :obj :state | obj isKindOf: BlElement ] -] - -{ #category : #adding } -PyramidBlocCommand class >> borderWidth [ - - ^ PyramidCommand - name: #borderWidth - set: [ :state :target | target border: (BlBorder paint: target border paint width: state arguments) ] - get: [ :state :source | - state source: source. - state arguments: source border width ] - isExecutableBlock: [ :obj :state | obj isKindOf: BlElement ] -] - -{ #category : #adding } -PyramidBlocCommand class >> constraints [ - - ^ PyramidCommand - name: #constraints - set: [ :state :target | - state arguments isBlock - ifTrue: [ target constraintsDo: state arguments ] - ifFalse: [ target constraints: state arguments ] ] - get: [ :state :source | - state source: source. - state arguments: source constraints ] - isExecutableBlock: [ :obj :state | obj isKindOf: BlElement ] -] - -{ #category : #adding } -PyramidBlocCommand class >> geometry [ - - ^ PyramidCommand - name: #geometry - set: [ :state :target | target geometry: state arguments ] - get: [ :state :source | - state source: source. - state arguments: source geometry ] - isExecutableBlock: [ :obj :state | obj isKindOf: BlElement ] -] - -{ #category : #adding } -PyramidBlocCommand class >> identifier [ - - ^ PyramidCommand - name: #identifier - set: [ :state :target | target id: state arguments ] - get: [ :state :source | - state source: source. - state arguments: source id asSymbol ] - isExecutableBlock: [ :obj :state | - (obj isKindOf: BlElement) and: [ - state arguments ifNil: [ true ] ifNotNil: [ state arguments ~= obj id asSymbol ] - ] ] -] - -{ #category : #adding } -PyramidBlocCommand class >> position [ - - ^ PyramidCommand - name: #position - set: [ :state :target | target position: state arguments ] - get: [ :state :source | - state source: source. - state arguments: source constraints position ] - isExecutableBlock: [ :obj :state | obj isKindOf: BlElement ] -] - -{ #category : #adding } -PyramidBlocCommand class >> removeChildren [ - - ^ PyramidCommand - name: #removeChildren - set: [ :state :target | target removeChildren: state arguments ] - get: [ :state :source | - state source: source. - state arguments: source children asArray ] - isExecutableBlock: [ :obj :state| obj isKindOf: BlElement ] -] - -{ #category : #adding } -PyramidBlocCommand class >> removeElementOnCollection [ - - ^ PyramidCommand - name: #removeElementOnCollection - set: [ :state :target | target removeAll: state arguments ] - get: [ :state :source | - state source: source. - state arguments: source collection asArray ] - isExecutableBlock: [ :obj :state| obj isCollection ] -] - -{ #category : #adding } -PyramidBlocCommand class >> text [ - - ^ PyramidCommand - name: #text - set: [ :state :target | - | rope attributes | - rope := target text rope. - attributes := (rope class canUnderstand: #attributes) ifTrue: [ rope attributes ] ifFalse: [ { } ]. - target text: (BlRopedText rope: (BlAttributeRope attributes: attributes rope: state arguments rope)) ] - get: [ :state :source | - state source: source. - state arguments: source text ] - isExecutableBlock: [ :obj :state | obj isKindOf: BlTextElement ] -] - -{ #category : #adding } -PyramidBlocCommand class >> textAttribute [ - - ^ PyramidCommand - name: #textAttribute - set: [ :state :target | - target text attribute: state arguments. - target textChanged ] - get: [ :state :source | - state source: source. - state arguments: - ((source text attributesFinder attributesAndIndicesSuchThat: [ - :each | true ]) collect: [ :each | each key ]) ] - isExecutableBlock: [ :obj :state | obj isKindOf: BlTextElement ] -] - -{ #category : #adding } -PyramidBlocCommand class >> visibility [ - - ^ PyramidCommand - name: #visibility - set: [ :state :target | target visibility: state arguments ] - get: [ :state :source | - state source: source. - state arguments: source visibility ] - isExecutableBlock: [ :obj :state | (obj isKindOf: BlElement) and: [ state arguments ~= obj visibility ] ] -] - -{ #category : #'see class side' } -PyramidBlocCommand >> seeClassSide [ -] diff --git a/src/Pyramid-Bloc/PyramidBlocPlugin.class.st b/src/Pyramid-Bloc/PyramidBlocPlugin.class.st new file mode 100644 index 00000000..9ae6842b --- /dev/null +++ b/src/Pyramid-Bloc/PyramidBlocPlugin.class.st @@ -0,0 +1,456 @@ +Class { + #name : #PyramidBlocPlugin, + #superclass : #Object, + #traits : 'TPyramidPlugin', + #classTraits : 'TPyramidPlugin classTrait', + #instVars : [ + 'editor', + 'groupCommand' + ], + #category : #'Pyramid-Bloc-plugin-bloc' +} + +{ #category : #accessing } +PyramidBlocPlugin class >> background [ + + | property | + property := PyramidProperty new + name: 'Background'; + command: PyramidBackgroundCommand new; + pyramidInputPresenterClass: + PyramidBackgroundInputWithModalPresenter; + yourself. + property pyramidInputPresenterStrings help: + 'Change the background of the element with a color, a gradient, an image.'. + property pyramidInputPresenterStrings windowTitle: 'Change background'. + ^ property +] + +{ #category : #accessing } +PyramidBlocPlugin class >> clipChildren [ + + | property | + property := PyramidProperty new + name: 'Clip Children'; + command: PyramidClipChildrenCommand new; + pyramidInputPresenterClass: PyramidSwitchInputPresenter; + yourself. + property pyramidInputPresenterStrings help: + 'If clipChildren is true, the children will not display outside the geometry of the parent element. If clipChildren is false, the children will display outside the geometry of the parent element.'. + property pyramidInputPresenterStrings onLabel: 'True'. + property pyramidInputPresenterStrings offLabel: 'False'. + property pyramidInputPresenterStrings uncertainLabel: 'Uncertain'. + ^ property +] + +{ #category : #accessing } +PyramidBlocPlugin class >> constraintsBasicH [ + + | property | + property := PyramidProperty new + name: 'Constraints - horizontal'; + command: + PyramidBasicHorizontalConstraintsBlocCommand new; + pyramidInputPresenterClass: + PyramidBasicConstraintsInputPresenter; + yourself. + ^ property +] + +{ #category : #accessing } +PyramidBlocPlugin class >> constraintsBasicHExact [ + + | property | + property := PyramidProperty new + name: 'Constraints - width'; + command: + PyramidBasicExactHorizontalConstraintsBlocCommand new; + pyramidInputPresenterClass: PyramidNumberInputPresenter; + yourself. + property pyramidInputPresenterStrings help: + 'Change the width of the object'. + ^ property +] + +{ #category : #accessing } +PyramidBlocPlugin class >> constraintsBasicV [ + + | property | + property := PyramidProperty new + name: 'Constraints - vertical'; + command: + PyramidBasicVerticalConstraintsBlocCommand new; + pyramidInputPresenterClass: + PyramidBasicConstraintsInputPresenter; + yourself. + ^ property +] + +{ #category : #accessing } +PyramidBlocPlugin class >> constraintsBasicVExact [ + + | property | + property := PyramidProperty new + name: 'Constraints - height'; + command: + PyramidBasicExactVerticalConstraintsBlocCommand new; + pyramidInputPresenterClass: PyramidNumberInputPresenter; + yourself. + property pyramidInputPresenterStrings help: + 'Change the height of the object'. + ^ property +] + +{ #category : #accessing } +PyramidBlocPlugin class >> constraintsPropH [ + + | property | + property := PyramidProperty new + name: 'Constraints - horizontal'; + command: + PyramidProportionnalHorizontalConstraintsCommand new; + pyramidInputPresenterClass: PyramidPointInputPresenter; + yourself. + property pyramidInputPresenterStrings + help: 'Define the proportion of the horizontal component.'; + labelX: 'Left'; + labelY: 'Right'. + ^ property +] + +{ #category : #accessing } +PyramidBlocPlugin class >> constraintsPropV [ + + | property | + property := PyramidProperty new + name: 'Constraints - vertical'; + command: + PyramidProportionnalVerticalConstraintsCommand new; + pyramidInputPresenterClass: PyramidPointInputPresenter; + yourself. + property pyramidInputPresenterStrings + help: 'Define the proportion of the vertical component.'; + labelX: 'Top'; + labelY: 'Bottom'. + ^ property +] + +{ #category : #accessing } +PyramidBlocPlugin class >> cornerRadii [ + + | property | + property := PyramidProperty new + name: 'Corner radius'; + command: PyramidRoundedRectangleCornerRadiiCommand new; + pyramidInputPresenterClass: + PyramidCornerRadiiInputPresenter; + yourself. + property pyramidInputPresenterStrings help: + 'Change the corner radius of the geometry. For example: + - "10" to set a radius of 10 px on each corner. + - "10 20" to set a radius of 10 px on the top-left and bottom-right corner and 20 px on the top-right and bottom-left corner. + - "10 20 30 40" to set a radius of 10 px on top-left, 20 px on top-right, 30 px on bottom-right and 40 px on bottom-left.'. + ^ property +] + +{ #category : #accessing } +PyramidBlocPlugin class >> elementId [ + + | property | + property := PyramidProperty new + name: 'Element ID'; + command: PyramidElementIdCommand new; + pyramidInputPresenterClass: PyramidTextInputPresenter; + yourself. + property pyramidInputPresenterStrings help: 'Change the id.'. + ^ property +] + +{ #category : #accessing } +PyramidBlocPlugin class >> flowLayoutOrientation [ + + | property | + property := PyramidProperty new + name: 'Orientation'; + command: PyramidFlowLayoutChangeOrientationCommand new; + pyramidInputPresenterClass: + PyramidFlowLayoutOrientationPresenter; + yourself. + property pyramidInputPresenterStrings help: + 'Change the orientation of the flow layout.'. + property pyramidInputPresenterStrings onLabel: 'Vertical'. + property pyramidInputPresenterStrings offLabel: 'Horizontal'. + property pyramidInputPresenterStrings uncertainLabel: 'Uncertain'. + ^ property +] + +{ #category : #accessing } +PyramidBlocPlugin class >> geometry [ + + | property | + property := PyramidProperty new + name: 'Geometry'; + command: PyramidGeometryCommand new; + pyramidInputPresenterClass: + PyramidGeometryInputPresenter; + yourself. + ^ property +] + +{ #category : #'class initialization' } +PyramidBlocPlugin class >> initialize [ + + PyramidPluginManager uniqueInstance addPlugin: self +] + +{ #category : #accessing } +PyramidBlocPlugin class >> layout [ + + | property | + property := PyramidProperty new + name: 'Layout'; + command: + PyramidLayoutBlocCommand new; + pyramidInputPresenterClass: + PyramidLayoutInputPresenter; + yourself. + ^ property +] + +{ #category : #accessing } +PyramidBlocPlugin class >> margin [ + + | property | + property := PyramidProperty new + name: 'Margin'; + command: PyramidMarginCommand new; + pyramidInputPresenterClass: PyramidInsetsInputPresenter; + yourself. + property pyramidInputPresenterStrings help: 'Change the margin. The margin will affect the space between the border and the elements outside. For example: + - "10" to set a margin of 10 px on each size. + - "10 20" to set a margin of 10 px on the top and bottom and 20 px on the right and left. + - "10 20 30 40" to set a margin of 10 px on top, 20 px on left, 30 px on bottom and 40 px on right.'.. + ^ property +] + +{ #category : #accessing } +PyramidBlocPlugin class >> padding [ + + | property | + property := PyramidProperty new + name: 'Padding'; + command: PyramidPaddingCommand new; + pyramidInputPresenterClass: PyramidInsetsInputPresenter; + yourself. + property pyramidInputPresenterStrings help: + 'Change the padding. The padding will affect the space between the border and the elements inside. For example: + - "10" to set a padding of 10 px on each size. + - "10 20" to set a padding of 10 px on the top and bottom and 20 px on the right and left. + - "10 20 30 40" to set a padding of 10 px on top, 20 px on left, 30 px on bottom and 40 px on right.'. + ^ property +] + +{ #category : #accessing } +PyramidBlocPlugin class >> position [ + + | property | + property := PyramidProperty new + name: 'Position'; + command: PyramidPositionCommand new; + pyramidInputPresenterClass: PyramidPointInputPresenter; + yourself. + property pyramidInputPresenterStrings help: + 'Set the position x and y of the element inside his parent.'. + ^ property +] + +{ #category : #accessing } +PyramidBlocPlugin class >> visibility [ + + | property | + property := PyramidProperty new + name: 'Visibility'; + command: PyramidVisibilityCommand new; + pyramidInputPresenterClass: PyramidVisibilityInputPresenter; + yourself. + ^ property +] + +{ #category : #accessing } +PyramidBlocPlugin class >> zIndex [ + + | property | + property := PyramidProperty new + name: 'Elevation'; + command: PyramidZIndexCommand new; + pyramidInputPresenterClass: PyramidNumberInputPresenter; + yourself. + property pyramidInputPresenterStrings help: + 'Change the elevation (#zIndex:). Bloc will used the elevation to determine wich of two sibling must be draw on top. The higher zIndex will be drawn on top of the lesser one.'. + ^ property +] + +{ #category : #adding } +PyramidBlocPlugin >> addPanelsOn: aPyramidSimpleWindow [ + + aPyramidSimpleWindow + at: #selectionMenu + addItem: [ :builder | self menuGroupOn: builder ]. + aPyramidSimpleWindow + at: #selectionMenu + addItem: [ :builder | self menuChangeOrderOn: builder ] +] + +{ #category : #'as yet unclassified' } +PyramidBlocPlugin >> connectOn: aPyramidEditor [ + + self editor: aPyramidEditor. + aPyramidEditor propertiesManager addProperty: self class elementId. + aPyramidEditor propertiesManager addProperty: self class visibility. + aPyramidEditor propertiesManager addProperty: self class zIndex. + aPyramidEditor propertiesManager addProperty: self class clipChildren. + aPyramidEditor propertiesManager addProperty: self class geometry. + aPyramidEditor propertiesManager addProperty: self class cornerRadii. + aPyramidEditor propertiesManager addProperty: self class position. + + aPyramidEditor propertiesManager addProperty: self class layout. + aPyramidEditor propertiesManager addProperty: self class flowLayoutOrientation. + + "Constraints - horizontal" + aPyramidEditor propertiesManager addProperty: + self class constraintsPropH. + aPyramidEditor propertiesManager addProperty: + self class constraintsBasicH. + aPyramidEditor propertiesManager addProperty: + self class constraintsBasicHExact. + + "Constraints - vertical" + aPyramidEditor propertiesManager addProperty: + self class constraintsPropV. + aPyramidEditor propertiesManager addProperty: + self class constraintsBasicV. + aPyramidEditor propertiesManager addProperty: + self class constraintsBasicVExact. + aPyramidEditor propertiesManager addProperty: self class background. + aPyramidEditor propertiesManager addProperty: self class padding. + aPyramidEditor propertiesManager addProperty: self class margin +] + +{ #category : #accessing } +PyramidBlocPlugin >> editor [ + + ^ editor +] + +{ #category : #accessing } +PyramidBlocPlugin >> editor: anObject [ + + editor := anObject +] + +{ #category : #'as yet unclassified' } +PyramidBlocPlugin >> groupCollection: aCollection [ + + self editor ifNil: [ ^ self ]. + self editor propertiesManager commandExecutor + use: self groupCommand + on: { aCollection } + with: self editor projectModel roots +] + +{ #category : #accessing } +PyramidBlocPlugin >> groupCommand [ + + ^ groupCommand +] + +{ #category : #'as yet unclassified' } +PyramidBlocPlugin >> groupMenuBlock: group for: aCollection [ + + group addItem: [ :item | + item + icon: (self iconNamed: #collection); + name: 'Group selection'; + enabled: true; + action: [ self groupCollection: aCollection ]; + yourself ] +] + +{ #category : #'as yet unclassified' } +PyramidBlocPlugin >> groupMenuBlockMulti [ + + ^ [ :group :multi | | copy | + copy := multi asArray. + (self groupCommand canBeUsedFor: copy) ifTrue: [ + self groupMenuBlock: group for: copy ] ] +] + +{ #category : #'as yet unclassified' } +PyramidBlocPlugin >> groupMenuBlockSingle [ + + ^ [ :group :single | | copy | + copy := { single }. + (self groupCommand canBeUsedFor: copy) ifTrue: [ + self groupMenuBlock: group for: copy ] ] +] + +{ #category : #initialization } +PyramidBlocPlugin >> initialize [ + + groupCommand := PyramidGroupCommand new +] + +{ #category : #'as yet unclassified' } +PyramidBlocPlugin >> menuChangeOrderOn: aBuilder [ + + aBuilder + addGroupSingleSelection: [ :group :single | + group + addItem: [ :item | + item + icon: (self iconNamed: #top); + name: 'Put in front'; + enabled: true; + action: [ self send: PyramidSendTopCommand new on: { single } ]; + yourself ]; + addItem: [ :item | + item + icon: (self iconNamed: #up); + name: 'Send up'; + enabled: true; + action: [ self send: PyramidSendUpCommand new on: { single } ]; + yourself ]; + addItem: [ :item | + item + icon: (self iconNamed: #down); + name: 'Send down'; + enabled: true; + action: [ self send: PyramidSendDownCommand new on: { single } ]; + yourself ]; + addItem: [ :item | + item + icon: (self iconNamed: #bottom); + name: 'Put in back'; + enabled: true; + action: [ + self send: PyramidSendBottomCommand new on: { single } ]; + yourself ] ] + order: 20 +] + +{ #category : #'as yet unclassified' } +PyramidBlocPlugin >> menuGroupOn: aBuilder [ + + aBuilder addGroupSingleSelection: self groupMenuBlockSingle order: 20. + aBuilder addGroupMultiSelection: self groupMenuBlockMulti order: 20 +] + +{ #category : #'as yet unclassified' } +PyramidBlocPlugin >> send: aCommand on: aCollection [ + + self editor ifNil: [ ^ self ]. + self editor propertiesManager commandExecutor + use: aCommand + on: aCollection + with: nil +] diff --git a/src/Pyramid-Bloc/PyramidBlocProperties.class.st b/src/Pyramid-Bloc/PyramidBlocProperties.class.st deleted file mode 100644 index 25f2768d..00000000 --- a/src/Pyramid-Bloc/PyramidBlocProperties.class.st +++ /dev/null @@ -1,180 +0,0 @@ -Class { - #name : #PyramidBlocProperties, - #superclass : #Object, - #traits : 'TPyramidPlugin', - #classTraits : 'TPyramidPlugin classTrait', - #category : #'Pyramid-Bloc-plugin-bloc-properties' -} - -{ #category : #accessing } -PyramidBlocProperties class >> background [ - - ^ PyramidProperty - fromCommand: PyramidBlocCommand background - inputBuilder: PyramidPropertyInputModelBuilderFactory backgroundInput - order: 21 -] - -{ #category : #accessing } -PyramidBlocProperties class >> borderPaint [ - - ^ PyramidProperty - fromCommand: PyramidBlocCommand borderPaint - inputBuilder: PyramidPropertyInputModelBuilderFactory borderPaint - order: 21 -] - -{ #category : #accessing } -PyramidBlocProperties class >> borderWidth [ - - ^ PyramidProperty - fromCommand: PyramidBlocCommand borderWidth - inputBuilder: PyramidPropertyInputModelBuilderFactory borderWidth - order: 21 -] - -{ #category : #accessing } -PyramidBlocProperties class >> contraintsHorizontal [ - - ^ PyramidProperty - fromCommand: PyramidBlocCommand constraints - inputBuilder: - PyramidPropertyInputModelBuilderFactory constraintsInputHorizontal - order: 61 -] - -{ #category : #accessing } -PyramidBlocProperties class >> contraintsVertical [ - - ^ PyramidProperty - fromCommand: PyramidBlocCommand constraints - inputBuilder: - PyramidPropertyInputModelBuilderFactory constraintsInputVertical - order: 62 -] - -{ #category : #accessing } -PyramidBlocProperties class >> fontName [ - - ^ PyramidProperty - fromCommand: PyramidBlocCommand textAttribute - inputBuilder: PyramidPropertyInputModelBuilderFactory fontName - order: 12 -] - -{ #category : #accessing } -PyramidBlocProperties class >> fontSize [ - - ^ PyramidProperty - fromCommand: PyramidBlocCommand textAttribute - inputBuilder: PyramidPropertyInputModelBuilderFactory fontSize - order: 11 -] - -{ #category : #accessing } -PyramidBlocProperties class >> fontWeight [ - - ^ PyramidProperty - fromCommand: PyramidBlocCommand textAttribute - inputBuilder: PyramidPropertyInputModelBuilderFactory fontWeight - order: 12 -] - -{ #category : #accessing } -PyramidBlocProperties class >> geometry [ - - ^ PyramidProperty - fromCommand: PyramidBlocCommand geometry - inputBuilder: - PyramidPropertyInputModelBuilderFactory geometryInput - order: 30 -] - -{ #category : #accessing } -PyramidBlocProperties class >> identifier [ - - ^ PyramidProperty - fromCommand: PyramidBlocCommand identifier - inputBuilder: - PyramidPropertyInputModelBuilderFactory identifierTextInput - order: 1 -] - -{ #category : #'class initialization' } -PyramidBlocProperties class >> initialize [ - - PyramidPluginManager uniqueInstance removePlugin: self. - PyramidPluginManager uniqueInstance addPlugin: self -] - -{ #category : #accessing } -PyramidBlocProperties class >> position [ - - ^ PyramidProperty - fromCommand: PyramidBlocCommand position - inputBuilder: - PyramidPropertyInputModelBuilderFactory positionInput - order: 60 -] - -{ #category : #accessing } -PyramidBlocProperties class >> text [ - - ^ PyramidProperty - fromCommand: PyramidBlocCommand text - inputBuilder: PyramidPropertyInputModelBuilderFactory textInput - order: 10 -] - -{ #category : #accessing } -PyramidBlocProperties class >> textForeground [ - - ^ PyramidProperty - fromCommand: PyramidBlocCommand textAttribute - inputBuilder: PyramidPropertyInputModelBuilderFactory textForeground - order: 12 -] - -{ #category : #accessing } -PyramidBlocProperties class >> textSpacing [ - - ^ PyramidProperty - fromCommand: PyramidBlocCommand textAttribute - inputBuilder: PyramidPropertyInputModelBuilderFactory textSpacing - order: 2 -] - -{ #category : #accessing } -PyramidBlocProperties class >> visibility [ - - ^ PyramidProperty - fromCommand: PyramidBlocCommand visibility - inputBuilder: - PyramidPropertyInputModelBuilderFactory visibilityDropList - order: 2 -] - -{ #category : #'as yet unclassified' } -PyramidBlocProperties >> connectOn: aPyramidEditor [ - - aPyramidEditor properties addProperty: self class identifier. - aPyramidEditor properties addProperty: self class visibility. - aPyramidEditor properties addProperty: self class background. - aPyramidEditor properties addProperty: self class borderWidth. - aPyramidEditor properties addProperty: self class borderPaint. - aPyramidEditor properties addProperty: self class geometry. - aPyramidEditor properties addProperty: self class position. - aPyramidEditor properties addProperty: self class contraintsVertical. - aPyramidEditor properties addProperty: - self class contraintsHorizontal. - aPyramidEditor properties addProperty: self class fontSize. - aPyramidEditor properties addProperty: self class fontWeight. - aPyramidEditor properties addProperty: self class fontName. - aPyramidEditor properties addProperty: self class text. - aPyramidEditor properties addProperty: self class textSpacing. - aPyramidEditor properties addProperty: self class textForeground -] - -{ #category : #'see class side' } -PyramidBlocProperties >> seeClassSide [ -] diff --git a/src/Pyramid-Bloc/PyramidBlocTextCommand.class.st b/src/Pyramid-Bloc/PyramidBlocTextCommand.class.st new file mode 100644 index 00000000..b0af6eb8 --- /dev/null +++ b/src/Pyramid-Bloc/PyramidBlocTextCommand.class.st @@ -0,0 +1,24 @@ +Class { + #name : #PyramidBlocTextCommand, + #superclass : #PyramidCommand, + #category : #'Pyramid-Bloc-plugin-bloc-text' +} + +{ #category : #testing } +PyramidBlocTextCommand class >> isAbstract [ + + ^ self == PyramidBlocTextCommand +] + +{ #category : #testing } +PyramidBlocTextCommand >> canBeUsedFor: anObject [ + + ^ anObject class = BlTextElement or: [ + anObject class inheritsFrom: BlTextElement ] +] + +{ #category : #'as yet unclassified' } +PyramidBlocTextCommand >> getAttributesOf: aBlText [ + + ^ (aBlText attributesFinder attributesAndIndicesSuchThat: [ :a | true ]) collect: [ :each | each key ]. +] diff --git a/src/Pyramid-Bloc/PyramidBlocTextPlugin.class.st b/src/Pyramid-Bloc/PyramidBlocTextPlugin.class.st new file mode 100644 index 00000000..41e2dab4 --- /dev/null +++ b/src/Pyramid-Bloc/PyramidBlocTextPlugin.class.st @@ -0,0 +1,77 @@ +Class { + #name : #PyramidBlocTextPlugin, + #superclass : #Object, + #traits : 'TPyramidPlugin', + #classTraits : 'TPyramidPlugin classTrait', + #category : #'Pyramid-Bloc-plugin-bloc-text' +} + +{ #category : #accessing } +PyramidBlocTextPlugin class >> changeText [ + + | property | + property := PyramidProperty new + name: 'Text'; + command: PyramidChangeTextCommand new; + pyramidInputPresenterClass: PyramidTextInputPresenter; + yourself. + property pyramidInputPresenterStrings help: + 'Change the value of the text'. + ^ property +] + +{ #category : #accessing } +PyramidBlocTextPlugin class >> fontSize [ + + | property | + property := PyramidProperty new + name: 'Font size'; + command: PyramidFontSizeCommand new; + pyramidInputPresenterClass: PyramidNumberInputPresenter; + yourself. + property pyramidInputPresenterStrings help: 'Change the font size.'. + ^ property +] + +{ #category : #accessing } +PyramidBlocTextPlugin class >> fontWeight [ + + | property | + property := PyramidProperty new + name: 'Font weight'; + command: PyramidFontWeightCommand new; + pyramidInputPresenterClass: PyramidNumberInputPresenter; + yourself. + property pyramidInputPresenterStrings help: 'Change the font weight.'. + ^ property +] + +{ #category : #'class initialization' } +PyramidBlocTextPlugin class >> initialize [ + + PyramidPluginManager uniqueInstance addPlugin: self +] + +{ #category : #accessing } +PyramidBlocTextPlugin class >> textForeground [ + + | property | + property := PyramidProperty new + name: 'Text foreground'; + command: PyramidTextForegroundCommand new; + pyramidInputPresenterClass: + PyramidColorInputSingleLineWithPickupButtonPresenter; + yourself. + property pyramidInputPresenterStrings help: + 'Change the color of the text'. + ^ property +] + +{ #category : #'as yet unclassified' } +PyramidBlocTextPlugin >> connectOn: aPyramidEditor [ + + aPyramidEditor propertiesManager addProperty: self class changeText. + aPyramidEditor propertiesManager addProperty: self class fontSize. + aPyramidEditor propertiesManager addProperty: self class fontWeight. + aPyramidEditor propertiesManager addProperty: self class textForeground +] diff --git a/src/Pyramid-Bloc/PyramidBorderBuilderPresenter.class.st b/src/Pyramid-Bloc/PyramidBorderBuilderPresenter.class.st deleted file mode 100644 index 2137d62a..00000000 --- a/src/Pyramid-Bloc/PyramidBorderBuilderPresenter.class.st +++ /dev/null @@ -1,185 +0,0 @@ -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/PyramidBorderPresenter.class.st b/src/Pyramid-Bloc/PyramidBorderPresenter.class.st deleted file mode 100644 index 0b65d252..00000000 --- a/src/Pyramid-Bloc/PyramidBorderPresenter.class.st +++ /dev/null @@ -1,62 +0,0 @@ -Class { - #name : #PyramidBorderPresenter, - #superclass : #SpPresenter, - #instVars : [ - 'dashList', - 'paintPreviewPresenter', - 'widthInput', - 'moreOptionButton' - ], - #category : #'Pyramid-Bloc-custom-specs-border' -} - -{ #category : #accessing } -PyramidBorderPresenter >> dashList [ - - ^ dashList -] - -{ #category : #layout } -PyramidBorderPresenter >> defaultLayout [ - - ^ SpBoxLayout newHorizontal - spacing: 4; - add: self dashList width: PyramidBorderPresenterModel defaultPresenterLenght; - add: self widthInput; - add: self paintPreviewPresenter; - add: self moreOptionButton withConstraints: [ :c | - c width: 24. - c height: 24 ]; - yourself -] - -{ #category : #initialization } -PyramidBorderPresenter >> initializePresenters [ - - dashList := SpDropListPresenter new - items: PyramidBorderPresenterModel allModel; - displayIcon: [ :m | m icon ]; - display: [ :m | '' ]; - yourself. - paintPreviewPresenter := PyramidPaintPreviewAbstract new. - widthInput := PyramidNumberPresenter new. - moreOptionButton := SpButtonPresenter new -] - -{ #category : #accessing } -PyramidBorderPresenter >> moreOptionButton [ - - ^ moreOptionButton -] - -{ #category : #accessing } -PyramidBorderPresenter >> paintPreviewPresenter [ - - ^ paintPreviewPresenter -] - -{ #category : #accessing } -PyramidBorderPresenter >> widthInput [ - - ^ widthInput -] diff --git a/src/Pyramid-Bloc/PyramidBorderPresenterModel.class.st b/src/Pyramid-Bloc/PyramidBorderPresenterModel.class.st deleted file mode 100644 index a692528e..00000000 --- a/src/Pyramid-Bloc/PyramidBorderPresenterModel.class.st +++ /dev/null @@ -1,116 +0,0 @@ -Class { - #name : #PyramidBorderPresenterModel, - #superclass : #Object, - #instVars : [ - 'icon', - 'border' - ], - #category : #'Pyramid-Bloc-custom-specs-border' -} - -{ #category : #'as yet unclassified' } -PyramidBorderPresenterModel class >> allModel [ - - ^ { self regularBorder . self shortDashBorder . self longDashBorder } -] - -{ #category : #initialization } -PyramidBorderPresenterModel class >> defaultBorderWidth [ - - ^ 1 -] - -{ #category : #initialization } -PyramidBorderPresenterModel class >> defaultIconLenght [ - - ^ 50 -] - -{ #category : #initialization } -PyramidBorderPresenterModel class >> defaultPresenterLenght [ - - ^ self defaultIconLenght + 15 -] - -{ #category : #'as yet unclassified' } -PyramidBorderPresenterModel class >> longDashBorder [ - - ^ self makeModelFrom: [ :b | - b - width: self defaultBorderWidth; - paint: Color black; - dashed ] -] - -{ #category : #'as yet unclassified' } -PyramidBorderPresenterModel class >> makeFormFrom: aBorder [ - - | container element | - element := BlElement new - background: Color black; - outskirts: BlOutskirts outside; - position: 0 @ 10; - geometry: (BlLineGeometry from: 0 @ 0 to: 200 @ 0); - border: aBorder; - yourself. - container := BlElement new - size: 50 @ 20; - background: Color cyan muchLighter; - yourself. - container addChild: element. - - ^ container exportAsForm -] - -{ #category : #'as yet unclassified' } -PyramidBorderPresenterModel class >> makeModelFrom: aBlock [ - - | builder border | - builder := BlBorderBuilder new. - aBlock value: builder. - border := builder build. - ^ self new border: border; icon: (self makeFormFrom: border); yourself -] - -{ #category : #'as yet unclassified' } -PyramidBorderPresenterModel class >> regularBorder [ - - ^ self makeModelFrom: [ :b | - b - width: self defaultBorderWidth; - paint: Color black ] -] - -{ #category : #'as yet unclassified' } -PyramidBorderPresenterModel class >> shortDashBorder [ - - ^ self makeModelFrom: [ :b | - b - width: self defaultBorderWidth; - paint: Color black; - dashedSmall ] -] - -{ #category : #accessing } -PyramidBorderPresenterModel >> border [ - - ^ border -] - -{ #category : #accessing } -PyramidBorderPresenterModel >> border: anObject [ - - border := anObject -] - -{ #category : #accessing } -PyramidBorderPresenterModel >> icon [ - - ^ icon -] - -{ #category : #accessing } -PyramidBorderPresenterModel >> icon: anObject [ - - icon := anObject -] diff --git a/src/Pyramid-Bloc/PyramidChangePositionWithSiblingsModel.class.st b/src/Pyramid-Bloc/PyramidChangePositionWithSiblingsModel.class.st new file mode 100644 index 00000000..5666d795 --- /dev/null +++ b/src/Pyramid-Bloc/PyramidChangePositionWithSiblingsModel.class.st @@ -0,0 +1,41 @@ +Class { + #name : #PyramidChangePositionWithSiblingsModel, + #superclass : #Object, + #instVars : [ + 'zIndex', + 'childIndex' + ], + #category : #'Pyramid-Bloc-plugin-bloc-siblings' +} + +{ #category : #comparing } +PyramidChangePositionWithSiblingsModel >> = anObject [ + + anObject == self ifTrue: [ ^true ]. + anObject class = self class ifTrue: [ ^ true ]. + ^ (self childIndex = anObject childIndex) and: [ self zIndex = anObject zIndex ] +] + +{ #category : #accessing } +PyramidChangePositionWithSiblingsModel >> childIndex [ + + ^ childIndex +] + +{ #category : #accessing } +PyramidChangePositionWithSiblingsModel >> childIndex: anObject [ + + childIndex := anObject +] + +{ #category : #accessing } +PyramidChangePositionWithSiblingsModel >> zIndex [ + + ^ zIndex +] + +{ #category : #accessing } +PyramidChangePositionWithSiblingsModel >> zIndex: anObject [ + + zIndex := anObject +] diff --git a/src/Pyramid-Bloc/PyramidChangeTextCommand.class.st b/src/Pyramid-Bloc/PyramidChangeTextCommand.class.st new file mode 100644 index 00000000..181b72af --- /dev/null +++ b/src/Pyramid-Bloc/PyramidChangeTextCommand.class.st @@ -0,0 +1,22 @@ +Class { + #name : #PyramidChangeTextCommand, + #superclass : #PyramidBlocTextCommand, + #category : #'Pyramid-Bloc-plugin-bloc-text' +} + +{ #category : #'as yet unclassified' } +PyramidChangeTextCommand >> getValueFor: aBlTextElement [ + + ^ aBlTextElement text asString +] + +{ #category : #'as yet unclassified' } +PyramidChangeTextCommand >> setValueFor: aBlTextElement with: aString [ + + | attributes rope | + attributes := self getAttributesOf: aBlTextElement text. + rope := aString asRopedText. + + attributes do: [ :a | rope attribute: a ]. + aBlTextElement text: rope +] diff --git a/src/Pyramid-Bloc/PyramidChildrenCommand.class.st b/src/Pyramid-Bloc/PyramidChildrenCommand.class.st new file mode 100644 index 00000000..0331d157 --- /dev/null +++ b/src/Pyramid-Bloc/PyramidChildrenCommand.class.st @@ -0,0 +1,33 @@ +Class { + #name : #PyramidChildrenCommand, + #superclass : #PyramidAbstractBlocCommand, + #category : #'Pyramid-Bloc-plugin-bloc' +} + +{ #category : #testing } +PyramidChildrenCommand class >> isAbstract [ + + ^ self == PyramidChildrenCommand +] + +{ #category : #'as yet unclassified' } +PyramidChildrenCommand >> getValueFor: aBlElement [ + + ^ nil +] + +{ #category : #'as yet unclassified' } +PyramidChildrenCommand >> saveStatesOf: aCollection withCommand: aCommand withArguments: anArguments [ + + | mementos | + mementos := aCollection asArray collect: [ :each | + PyramidCommandMemento new + command: aCommand; + target: each; + arguments: anArguments; + yourself ]. + mementos size = 1 ifTrue: [ ^ mementos first ]. + ^ PyramidCompositeMemento new + mementos: mementos; + yourself +] diff --git a/src/Pyramid-Bloc/PyramidClipChildrenCommand.class.st b/src/Pyramid-Bloc/PyramidClipChildrenCommand.class.st new file mode 100644 index 00000000..a4209f42 --- /dev/null +++ b/src/Pyramid-Bloc/PyramidClipChildrenCommand.class.st @@ -0,0 +1,17 @@ +Class { + #name : #PyramidClipChildrenCommand, + #superclass : #PyramidAbstractBlocCommand, + #category : #'Pyramid-Bloc-plugin-bloc' +} + +{ #category : #'as yet unclassified' } +PyramidClipChildrenCommand >> getValueFor: aBlElement [ + + ^ aBlElement clipChildren +] + +{ #category : #'as yet unclassified' } +PyramidClipChildrenCommand >> setValueFor: aBlElement with: anArgument [ + + aBlElement clipChildren: anArgument +] diff --git a/src/Pyramid-Bloc/PyramidColorInputPresenter.class.st b/src/Pyramid-Bloc/PyramidColorInputPresenter.class.st deleted file mode 100644 index 5e1d6b76..00000000 --- a/src/Pyramid-Bloc/PyramidColorInputPresenter.class.st +++ /dev/null @@ -1,199 +0,0 @@ -Class { - #name : #PyramidColorInputPresenter, - #superclass : #SpPresenter, - #instVars : [ - 'previewPresenter', - 'colorPickerButton', - 'textInput', - 'color', - 'whenSubmitDo' - ], - #category : #'Pyramid-Bloc-custom-specs-color' -} - -{ #category : #'menu actions' } -PyramidColorInputPresenter >> awaitSubmition [ - - self previewPresenter showWarning -] - -{ #category : #'as yet unclassified' } -PyramidColorInputPresenter >> changedText: aText [ - - (self validateString: aText) - ifTrue: [ - self previewPresenter color: (Color fromHexString: self textInput text). - self awaitSubmition ] - ifFalse: [ self hasUnacceptedEdits: true ] -] - -{ #category : #resolution } -PyramidColorInputPresenter >> clearSelection [ - self textInput text: ''. -] - -{ #category : #accessing } -PyramidColorInputPresenter >> color [ - - color ifNil: [ color := Color black ]. - ^ color -] - -{ #category : #accessing } -PyramidColorInputPresenter >> color: aColor [ - - color = aColor ifTrue: [ ^ self ]. - color := aColor. - self submitColor: aColor. - self previewPresenter color: aColor. - self textInput text: (self hexStringWithAlphaFrom: aColor). - self hasUnacceptedEdits: false -] - -{ #category : #'as yet unclassified' } -PyramidColorInputPresenter >> colorPickerAction [ - - | dialog | - dialog := ColorSelectorDialogWindow new - title: 'Choose color'; - selectedColor: self color. - dialog openModal. - dialog cancelled ifFalse: [ self color: dialog selectedColor ] -] - -{ #category : #accessing } -PyramidColorInputPresenter >> colorPickerButton [ - - ^ colorPickerButton -] - -{ #category : #accessing } -PyramidColorInputPresenter >> defaultColor: aColor [ - - color := aColor. - self previewPresenter color: aColor. - self textInput text: (self hexStringWithAlphaFrom: aColor). - self hasUnacceptedEdits: false -] - -{ #category : #'as yet unclassified' } -PyramidColorInputPresenter >> defaultLayout [ - - ^ SpBoxLayout newHorizontal - spacing: 4; - add: self previewPresenter expand: true; - add: self textInput withConstraints: [ :c | - c - width: 80; - height: 24 ]; - add: self colorPickerButton withConstraints: [ :c | - c - width: 24; - height: 24 ]; - yourself -] - -{ #category : #testing } -PyramidColorInputPresenter >> hasUnacceptedEdits: aBoolean [ - - aBoolean - ifTrue: [ self previewPresenter showError ] - ifFalse: [ - self previewPresenter showOk ] -] - -{ #category : #'as yet unclassified' } -PyramidColorInputPresenter >> hexStringWithAlphaFrom: aColor [ - - | s alpha | - - alpha := (aColor alpha * 255) asInteger printStringHex. - - s := aColor asHexString , '00'. - alpha size = 1 ifTrue: [ s at: 8 put: (alpha at: 1) ]. - alpha size = 2 ifTrue: [ - s at: 7 put: (alpha at: 1). - s at: 8 put: (alpha at: 2) ]. - ^ s -] - -{ #category : #accessing } -PyramidColorInputPresenter >> initializePresenters [ - - colorPickerButton := SpButtonPresenter new - icon: (self iconNamed: #haloRecolor); - extent: 10 asPoint; - action: [ self colorPickerAction ]; - yourself. - - textInput := SpTextInputFieldPresenter new. - textInput whenSubmitDo: [ :text | self submitText: text ]. - textInput whenTextChangedDo: [ :text | self changedText: text ]. - - previewPresenter := PyramidPaintPreviewSolidColor new yourself. - self defaultColor: self color -] - -{ #category : #accessing } -PyramidColorInputPresenter >> paint [ - - ^ self color asBlPaint -] - -{ #category : #accessing } -PyramidColorInputPresenter >> previewPresenter [ - - ^ previewPresenter -] - -{ #category : #'as yet unclassified' } -PyramidColorInputPresenter >> submitColor: aColor [ - - self whenSubmitDo value: aColor -] - -{ #category : #'as yet unclassified' } -PyramidColorInputPresenter >> submitText: aString [ - - (self validateString: aString) - ifTrue: [ self color: (Color fromHexString: self textInput text) ] - ifFalse: [ - self clearSelection. - self hasUnacceptedEdits: true ] -] - -{ #category : #accessing } -PyramidColorInputPresenter >> textInput [ - - ^ textInput -] - -{ #category : #'as yet unclassified' } -PyramidColorInputPresenter >> validateString: aString [ - - | text | - aString ifEmpty: [ ^ false ]. - text := aString first = $# - ifTrue: [ aString allButFirst ] - ifFalse: [ aString ]. - (text size < 6) ifTrue: [ ^ false ]. - (text size = 7) ifTrue: [ ^ false ]. - (text size > 8) ifTrue: [ ^ false ]. - - ^ text allSatisfy: [ :c | - c isDigit or: [ - { $a. $b. $c. $d. $e. $f. $A. $B. $C. $D. $E. $F } anySatisfy: [ - :any | any = c ] ] ] -] - -{ #category : #accessing } -PyramidColorInputPresenter >> whenSubmitDo [ - - ^ whenSubmitDo -] - -{ #category : #accessing } -PyramidColorInputPresenter >> whenSubmitDo: aBlock [ - - whenSubmitDo := aBlock -] diff --git a/src/Pyramid-Bloc/PyramidColorStopInputPresenter.class.st b/src/Pyramid-Bloc/PyramidColorStopInputPresenter.class.st new file mode 100644 index 00000000..a6faa134 --- /dev/null +++ b/src/Pyramid-Bloc/PyramidColorStopInputPresenter.class.st @@ -0,0 +1,65 @@ +Class { + #name : #PyramidColorStopInputPresenter, + #superclass : #PyramidInputPresenter, + #instVars : [ + 'colorInput', + 'stopInput' + ], + #category : #'Pyramid-Bloc-plugin-bloc' +} + +{ #category : #accessing } +PyramidColorStopInputPresenter >> colorInput [ + + ^ colorInput +] + +{ #category : #layout } +PyramidColorStopInputPresenter >> defaultLayout [ + + ^ SpBoxLayout newHorizontal + spacing: 4; + add: self stopInput width: 40; + add: '|' expand: false; + add: self colorInput; + yourself +] + +{ #category : #initialization } +PyramidColorStopInputPresenter >> initializePresenters [ + + colorInput := PyramidColorInputSingleLineWithPickupButtonPresenter new. + stopInput := PyramidNumberInputPresenter new +] + +{ #category : #accessing } +PyramidColorStopInputPresenter >> stopInput [ + + ^ stopInput +] + +{ #category : #'as yet unclassified' } +PyramidColorStopInputPresenter >> value [ + + | color | + color := self colorInput value. + color isColor ifFalse: [ ^ color ]. + (self stopInput value between: 0 and: 1) ifFalse: [self stopInput value: self stopInput value rounded]. + ^ self stopInput value -> self colorInput value +] + +{ #category : #'as yet unclassified' } +PyramidColorStopInputPresenter >> value: anAssociation [ + + anAssociation isAssociation ifFalse: [ + self colorInput value: PyramidUnknowState new ]. + self stopInput value: anAssociation key asNumber. + self colorInput value: anAssociation value +] + +{ #category : #'as yet unclassified' } +PyramidColorStopInputPresenter >> whenValueChangedDo: aBlock [ + + self colorInput whenValueChangedDo: [ :e | aBlock value: self value ]. + self stopInput whenValueChangedDo: [ :e | aBlock value: self value ] +] diff --git a/src/Pyramid-Bloc/PyramidConstraintsModel.class.st b/src/Pyramid-Bloc/PyramidConstraintsModel.class.st deleted file mode 100644 index 4ad75fda..00000000 --- a/src/Pyramid-Bloc/PyramidConstraintsModel.class.st +++ /dev/null @@ -1,225 +0,0 @@ -Class { - #name : #PyramidConstraintsModel, - #superclass : #Object, - #instVars : [ - 'icon', - 'title', - 'block', - 'targetClass', - 'associatedPresenter', - 'initializeBlock' - ], - #category : #'Pyramid-Bloc-custom-specs-constraints' -} - -{ #category : #'as yet unclassified' } -PyramidConstraintsModel class >> constraintsExact [ - - ^ self new - title: 'Exact'; - icon: (self iconNamed: #smallNew); - targetClass: BlLayoutExactResizer; - yourself -] - -{ #category : #'as yet unclassified' } -PyramidConstraintsModel class >> constraintsExactHorizontal [ - - | inputNumber | - inputNumber := PyramidNumberPresenter new - number: 50; - yourself. - ^ self constraintsExact - associatedPresenter: inputNumber; - block: [ :c | - inputNumber number ifNotNil: [ :n | c horizontal exact: n ] ]; - initializeBlock: [ :presenter | - inputNumber whenSubmitDo: [ :n | presenter whenSubmitDo value ] ]; - yourself -] - -{ #category : #'as yet unclassified' } -PyramidConstraintsModel class >> constraintsExactVertical [ - - | inputNumber | - inputNumber := PyramidNumberPresenter new - number: 50; - yourself. - ^ self constraintsExact - associatedPresenter: inputNumber; - block: [ :c | - inputNumber number ifNotNil: [ :n | c vertical exact: n ] ]; - initializeBlock: [ :presenter | - inputNumber whenSubmitDo: [ :n | presenter whenSubmitDo value ] ]; - yourself -] - -{ #category : #'as yet unclassified' } -PyramidConstraintsModel class >> constraintsFitContent [ - - ^ self new - title: 'Fit Content'; - icon: (self iconNamed: #glamorousZoomToFit); - targetClass: BlLayoutFitContentResizer; - yourself -] - -{ #category : #'as yet unclassified' } -PyramidConstraintsModel class >> constraintsFitContentHorizontal [ - - ^ self constraintsFitContent - associatedPresenter: SpNullPresenter new; - block: [ :c | - c horizontal fitContent ]; - yourself -] - -{ #category : #'as yet unclassified' } -PyramidConstraintsModel class >> constraintsFitContentVertical [ - - ^ self constraintsFitContent - associatedPresenter: SpNullPresenter new; - block: [ :c | c vertical fitContent ]; - yourself -] - -{ #category : #'as yet unclassified' } -PyramidConstraintsModel class >> constraintsMatchParent [ - - ^ self new - title: 'Match parent'; - icon: (self iconNamed: #smallFullscreen); - targetClass: BlLayoutMatchParentResizer; - yourself -] - -{ #category : #'as yet unclassified' } -PyramidConstraintsModel class >> constraintsMatchParentHorizontal [ - - ^ self constraintsMatchParent - associatedPresenter: SpNullPresenter new; - block: [ :c | c horizontal matchParent ]; - yourself -] - -{ #category : #'as yet unclassified' } -PyramidConstraintsModel class >> constraintsMatchParentVertical [ - - ^ self constraintsMatchParent - associatedPresenter: SpNullPresenter new; - block: [ :c | c vertical matchParent ]; - yourself -] - -{ #category : #'as yet unclassified' } -PyramidConstraintsModel class >> constraintsMixed [ - - ^ self new - title: 'Mixed Value'; - icon: (self iconNamed: #smallNew); - targetClass: nil; - yourself -] - -{ #category : #factory } -PyramidConstraintsModel class >> horizontal [ - - ^ { - self constraintsExactHorizontal. - self constraintsMatchParentHorizontal. - self constraintsFitContentHorizontal } -] - -{ #category : #factory } -PyramidConstraintsModel class >> horizontalMixed [ - - ^ { self constraintsMixed } , self horizontal -] - -{ #category : #factory } -PyramidConstraintsModel class >> vertical [ - - ^ { - self constraintsExactVertical. - self constraintsMatchParentVertical. - self constraintsFitContentVertical } -] - -{ #category : #factory } -PyramidConstraintsModel class >> verticalMixed [ - - ^ { self constraintsMixed } , self vertical -] - -{ #category : #accessing } -PyramidConstraintsModel >> associatedPresenter [ - - ^ associatedPresenter -] - -{ #category : #accessing } -PyramidConstraintsModel >> associatedPresenter: anObject [ - - associatedPresenter := anObject -] - -{ #category : #accessing } -PyramidConstraintsModel >> block [ - - ^ block -] - -{ #category : #accessing } -PyramidConstraintsModel >> block: anObject [ - - block := anObject -] - -{ #category : #accessing } -PyramidConstraintsModel >> icon [ - - ^ icon -] - -{ #category : #accessing } -PyramidConstraintsModel >> icon: anObject [ - - icon := anObject -] - -{ #category : #accessing } -PyramidConstraintsModel >> initializeBlock [ - - initializeBlock ifNil: [ initializeBlock := [ :n | ] ]. - ^ initializeBlock -] - -{ #category : #accessing } -PyramidConstraintsModel >> initializeBlock: anObject [ - - initializeBlock := anObject -] - -{ #category : #accessing } -PyramidConstraintsModel >> targetClass [ - - ^ targetClass -] - -{ #category : #accessing } -PyramidConstraintsModel >> targetClass: anObject [ - - targetClass := anObject -] - -{ #category : #accessing } -PyramidConstraintsModel >> title [ - - ^ title -] - -{ #category : #accessing } -PyramidConstraintsModel >> title: anObject [ - - title := anObject -] diff --git a/src/Pyramid-Bloc/PyramidConstraintsPresenter.class.st b/src/Pyramid-Bloc/PyramidConstraintsPresenter.class.st deleted file mode 100644 index 46505859..00000000 --- a/src/Pyramid-Bloc/PyramidConstraintsPresenter.class.st +++ /dev/null @@ -1,109 +0,0 @@ -Class { - #name : #PyramidConstraintsPresenter, - #superclass : #SpPresenter, - #instVars : [ - 'valueInput', - 'whenSubmitDo', - 'selectorInputs', - 'shouldTriggerAction', - 'submit' - ], - #category : #'Pyramid-Bloc-custom-specs-constraints' -} - -{ #category : #'as yet unclassified' } -PyramidConstraintsPresenter class >> constraintsHorizontal [ - - ^ self new model: { PyramidConstraintsModel constraintsExactHorizontal . PyramidConstraintsModel constraintsFitContentHorizontal . PyramidConstraintsModel constraintsMatchParentHorizontal }; yourself -] - -{ #category : #layout } -PyramidConstraintsPresenter >> defaultLayout [ - - |defaultLayout| - defaultLayout := SpBoxLayout newVertical - spacing: 4; yourself. - self selectorInputs do: [ :each | defaultLayout add: (SpBoxLayout newHorizontal - spacing: 4; - add: each key; - add: each value associatedPresenter; - yourself) ]. - ^ defaultLayout -] - -{ #category : #accessing } -PyramidConstraintsPresenter >> defaultValue: aDefaultValue [ - - shouldTriggerAction:= false. - aDefaultValue pyramidSelectConstraintsOn: self. - shouldTriggerAction:= true -] - -{ #category : #initialization } -PyramidConstraintsPresenter >> initializePresenters [ - - shouldTriggerAction := true. - selectorInputs := OrderedCollection new. - valueInput := SpNullPresenter new -] - -{ #category : #accessing } -PyramidConstraintsPresenter >> model: aModel [ - - self selectorInputs: (aModel collect: [ :each | - (SpRadioButtonPresenter new - label: each title; - yourself) -> each ]). - self selectorInputs first key associatedRadioButtons:( - self selectorInputs allButFirst collect: [ :each | each key ]). - self selectorInputs do: [ :each | - each key whenActivatedDo: [ self submit: each value ] ]. - - aModel do: [ :each | each initializeBlock value: self ]. - self layout: self defaultLayout -] - -{ #category : #layout } -PyramidConstraintsPresenter >> selectorInputs [ - - ^ selectorInputs -] - -{ #category : #layout } -PyramidConstraintsPresenter >> selectorInputs: anObject [ - - selectorInputs := anObject -] - -{ #category : #'as yet unclassified' } -PyramidConstraintsPresenter >> submit [ - - ^ submit -] - -{ #category : #'as yet unclassified' } -PyramidConstraintsPresenter >> submit: aModel [ - - - submit := aModel block. - shouldTriggerAction ifTrue: [ self whenSubmitDo value]. -] - -{ #category : #layout } -PyramidConstraintsPresenter >> valueInput [ - - ^ valueInput -] - -{ #category : #enumerating } -PyramidConstraintsPresenter >> whenSubmitDo [ - - whenSubmitDo ifNil: [ whenSubmitDo := [ ] ]. - ^ whenSubmitDo -] - -{ #category : #enumerating } -PyramidConstraintsPresenter >> whenSubmitDo: aBlock [ - - whenSubmitDo:= aBlock -] diff --git a/src/Pyramid-Bloc/PyramidContextMenuPlugin.class.st b/src/Pyramid-Bloc/PyramidContextMenuPlugin.class.st index f641a4fd..8f9352ee 100644 --- a/src/Pyramid-Bloc/PyramidContextMenuPlugin.class.st +++ b/src/Pyramid-Bloc/PyramidContextMenuPlugin.class.st @@ -42,6 +42,13 @@ PyramidContextMenuPlugin >> editor: anObject [ editor := anObject ] +{ #category : #'as yet unclassified' } +PyramidContextMenuPlugin >> getNameForSingle: aBlElement [ + + aBlElement id asSymbol ifNil: [ ^ '@\no name\ ', aBlElement hash printString ]. +^ aBlElement id asSymbol , ' ' , aBlElement hash printString +] + { #category : #'as yet unclassified' } PyramidContextMenuPlugin >> menuBrowseAndInspectOn: aBuilder [ @@ -81,23 +88,27 @@ PyramidContextMenuPlugin >> menuBrowseAndInspectOn: aBuilder [ { #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 + aBuilder + addGroupSingleSelection: [ :group :single | + group + addItem: [ :item | + item + icon: (self iconNamed: single systemIconName); + name: (self getNameForSingle: single); + 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/PyramidCopyPastePlugin.class.st b/src/Pyramid-Bloc/PyramidCopyPastePlugin.class.st similarity index 75% rename from src/Pyramid/PyramidCopyPastePlugin.class.st rename to src/Pyramid-Bloc/PyramidCopyPastePlugin.class.st index e69c1bc5..8c2b8009 100644 --- a/src/Pyramid/PyramidCopyPastePlugin.class.st +++ b/src/Pyramid-Bloc/PyramidCopyPastePlugin.class.st @@ -3,7 +3,7 @@ Class { #superclass : #Object, #traits : 'TPyramidPlugin', #classTraits : 'TPyramidPlugin classTrait', - #category : #'Pyramid-plugin-copy-paste' + #category : #'Pyramid-Bloc-plugin-copy-paste' } { #category : #'class initialization' } @@ -29,25 +29,13 @@ PyramidCopyPastePlugin >> copyAsStonInClipboard: aCollection [ { #category : #copying } PyramidCopyPastePlugin >> copyAsStonMenu: aBuilder [ - aBuilder - addGroupEmptySelection: [ :group :nothing | - group - addItem: [ :item | - item - icon: (self iconNamed: #smallCopy); - name: 'Copy as STON (select one element)'; - enabled: false; - yourself ]; - yourself ] - order: 20. - aBuilder addGroupSingleSelection: [ :group :single | group addItem: [ :item | item icon: (self iconNamed: #smallCopy); - name: 'Copy as STON'; + name: 'Copy'; action: [ self copyAsStonInClipboard: { single } ]; yourself ]; yourself ] @@ -59,7 +47,7 @@ PyramidCopyPastePlugin >> copyAsStonMenu: aBuilder [ addItem: [ :item | item icon: (self iconNamed: #smallCopy); - name: 'Copy as STON (select only one element)'; + name: 'Copy (select only one element)'; enabled: false; yourself ]; yourself ] diff --git a/src/Pyramid-Bloc/PyramidCornerRadiiInputPresenter.class.st b/src/Pyramid-Bloc/PyramidCornerRadiiInputPresenter.class.st new file mode 100644 index 00000000..336be849 --- /dev/null +++ b/src/Pyramid-Bloc/PyramidCornerRadiiInputPresenter.class.st @@ -0,0 +1,83 @@ +Class { + #name : #PyramidCornerRadiiInputPresenter, + #superclass : #PyramidInputPresenter, + #instVars : [ + 'inputArray', + 'whenValueChangedDo' + ], + #category : #'Pyramid-Bloc-plugin-bloc' +} + +{ #category : #'as yet unclassified' } +PyramidCornerRadiiInputPresenter >> applyStrings [ + + self inputArray strings: self strings +] + +{ #category : #'as yet unclassified' } +PyramidCornerRadiiInputPresenter >> cornerRadiiFrom: anArray [ + + anArray isCollection ifFalse: [ ^ anArray ]. + anArray size = 1 ifTrue: [ ^ BlCornerRadii radius: anArray first ]. + anArray size = 2 ifTrue: [ + ^ BlCornerRadii new + topLeft: anArray first; + topRight: anArray last; + bottomRight: anArray first; + bottomLeft: anArray last; + yourself ]. + anArray size = 4 ifTrue: [ + ^ BlCornerRadii new + topLeft: anArray first; + topRight: anArray second; + bottomRight: anArray third; + bottomLeft: anArray last; + yourself ]. + ^ PyramidUnknowState new +] + +{ #category : #layout } +PyramidCornerRadiiInputPresenter >> defaultLayout [ + +^ SpBoxLayout newHorizontal add: self inputArray; yourself +] + +{ #category : #initialization } +PyramidCornerRadiiInputPresenter >> initializePresenters [ + + whenValueChangedDo := [ :insets | ]. + inputArray := PyramidNumberArrayInputPresenter new + whenValueChangedDo: [ :array | + self whenValueChangedDo value: + (self cornerRadiiFrom: array) ] +] + +{ #category : #layout } +PyramidCornerRadiiInputPresenter >> inputArray [ + + ^ inputArray +] + +{ #category : #'as yet unclassified' } +PyramidCornerRadiiInputPresenter >> value [ + + ^ self cornerRadiiFrom: self inputArray value +] + +{ #category : #'as yet unclassified' } +PyramidCornerRadiiInputPresenter >> value: aBlCornerRadii [ + + aBlCornerRadii setCornerRadiiOn: self +] + +{ #category : #initialization } +PyramidCornerRadiiInputPresenter >> whenValueChangedDo [ + + ^ whenValueChangedDo +] + +{ #category : #initialization } +PyramidCornerRadiiInputPresenter >> whenValueChangedDo: aBlock [ + + whenValueChangedDo := aBlock +] diff --git a/src/Pyramid-Bloc/PyramidElementIdCommand.class.st b/src/Pyramid-Bloc/PyramidElementIdCommand.class.st new file mode 100644 index 00000000..6ef541b3 --- /dev/null +++ b/src/Pyramid-Bloc/PyramidElementIdCommand.class.st @@ -0,0 +1,17 @@ +Class { + #name : #PyramidElementIdCommand, + #superclass : #PyramidAbstractBlocCommand, + #category : #'Pyramid-Bloc-plugin-bloc' +} + +{ #category : #'as yet unclassified' } +PyramidElementIdCommand >> getValueFor: aBlElement [ + + ^ aBlElement id asSymbol +] + +{ #category : #'as yet unclassified' } +PyramidElementIdCommand >> setValueFor: aBlElement with: anArgument [ + + aBlElement id: anArgument +] diff --git a/src/Pyramid-Bloc/PyramidElementIdSortFunction.class.st b/src/Pyramid-Bloc/PyramidElementIdSortFunction.class.st new file mode 100644 index 00000000..b7e82381 --- /dev/null +++ b/src/Pyramid-Bloc/PyramidElementIdSortFunction.class.st @@ -0,0 +1,15 @@ +Class { + #name : #PyramidElementIdSortFunction, + #superclass : #SortFunction, + #category : #'Pyramid-Bloc-utils' +} + +{ #category : #evaluating } +PyramidElementIdSortFunction >> collate: anObject1 with: anObject2 [ + "visible > hidden > gone" + + anObject1 id = anObject2 id ifTrue: [ ^ 0 ]. + anObject1 id asSymbol ifNil: [ ^ 1 ]. + anObject2 id asSymbol ifNil: [ ^ -1 ]. + ^ anObject1 id asSymbol threeWayCompareTo: anObject2 id asSymbol +] diff --git a/src/Pyramid-Bloc/PyramidElementsManipulationHelper.class.st b/src/Pyramid-Bloc/PyramidElementsManipulationHelper.class.st new file mode 100644 index 00000000..30c82f83 --- /dev/null +++ b/src/Pyramid-Bloc/PyramidElementsManipulationHelper.class.st @@ -0,0 +1,81 @@ +Class { + #name : #PyramidElementsManipulationHelper, + #superclass : #Object, + #category : #'Pyramid-Bloc-utils' +} + +{ #category : #'as yet unclassified' } +PyramidElementsManipulationHelper class >> accumulateChildrenOf: aBlElement in: aCollection [ + + aCollection add: aBlElement. + (aBlElement children asArray sorted: PyramidElevationSortFunction new) + do: [ :each | + self accumulateChildrenOf: each in: aCollection ] +] + +{ #category : #'as yet unclassified' } +PyramidElementsManipulationHelper class >> accumulateParentsOf: aCollectionOfBlElement in: result [ + + | elementToTest onCollection nextCollection shouldKeepIt | + shouldKeepIt := true. + aCollectionOfBlElement isEmpty ifTrue: [ ^ self ]. + aCollectionOfBlElement size = 1 ifTrue: [ + result add: aCollectionOfBlElement first. + ^ self ]. + + elementToTest := aCollectionOfBlElement first. + onCollection := aCollectionOfBlElement allButFirst. + nextCollection := OrderedCollection new. + + onCollection do: [ :each | + (each hasParent: elementToTest) ifFalse: [ + nextCollection add: each ]. + (shouldKeepIt and: [ elementToTest hasParent: each ]) ifTrue: [ + shouldKeepIt := false ] ]. + shouldKeepIt ifTrue: [ result add: elementToTest ]. + self accumulateParentsOf: nextCollection in: result +] + +{ #category : #'as yet unclassified' } +PyramidElementsManipulationHelper class >> flattenChildrenOfCollection: aCollection [ + "Consider: +A1->A2-A3. +B1->B2->B3. + +col := { A1 . B2 } + +PyramidElementsManipulationHelper flattenChildrenOfCollection: col +returns +{ A1 . A2 . A3 . B2 . B3 } +" + + | ret | + ret := OrderedCollection new. + (aCollection asArray sorted: PyramidElevationSortFunction new) do: [ :each | + self accumulateChildrenOf: each in: ret ]. + ^ ret +] + +{ #category : #'as yet unclassified' } +PyramidElementsManipulationHelper class >> onlyParents: aCollectionOfBlElement [ + "return a collection whithout any parent-child relation. + Example: + consider this as all elements + A1->A2->A3 + B1->B2->B3. + C1->C2->C3. + D1->D2->D3. + + selection := {A1 . B1 . B2 . C1 . C3}. + PyramidElementsManipulationHelper onlyParents: selection + returns: { A1 . B1 . C1 } + " + + | result | + aCollectionOfBlElement isEmpty ifTrue: [ ^ { } ]. + aCollectionOfBlElement size = 1 ifTrue: [ + ^ { aCollectionOfBlElement first } ]. + result := OrderedCollection new. + self accumulateParentsOf: aCollectionOfBlElement in: result. + ^ result asArray +] diff --git a/src/Pyramid-Bloc/PyramidElevationSortFunction.class.st b/src/Pyramid-Bloc/PyramidElevationSortFunction.class.st new file mode 100644 index 00000000..8a02549a --- /dev/null +++ b/src/Pyramid-Bloc/PyramidElevationSortFunction.class.st @@ -0,0 +1,24 @@ +Class { + #name : #PyramidElevationSortFunction, + #superclass : #SortFunction, + #category : #'Pyramid-Bloc-utils' +} + +{ #category : #evaluating } +PyramidElevationSortFunction >> collate: aFirstObject with: aSecondObject [ + " res = zIndex - zIndex +if (res = 0) and (parent is same) and (parent not nil) then + ^ parent sibling order +else + ^ res +" + + | res | + res := aFirstObject elevation elevation - aSecondObject elevation elevation. + (res = 0 and: [ + aFirstObject parent = aSecondObject parent and: [ + aFirstObject parent isNotNil ] ]) ifTrue: [ + ^ (aFirstObject parent childIndexOf: aFirstObject) + - (aFirstObject parent childIndexOf: aSecondObject) ]. + ^ res +] diff --git a/src/Pyramid-Bloc/PyramidExistingOverlayError.class.st b/src/Pyramid-Bloc/PyramidExistingOverlayError.class.st new file mode 100644 index 00000000..8b2f13d4 --- /dev/null +++ b/src/Pyramid-Bloc/PyramidExistingOverlayError.class.st @@ -0,0 +1,5 @@ +Class { + #name : #PyramidExistingOverlayError, + #superclass : #Error, + #category : #'Pyramid-Bloc-plugin-space' +} diff --git a/src/Pyramid-Bloc/PyramidFakeBackgroundMixedValues.class.st b/src/Pyramid-Bloc/PyramidFakeBackgroundMixedValues.class.st deleted file mode 100644 index 8f89f6c2..00000000 --- a/src/Pyramid-Bloc/PyramidFakeBackgroundMixedValues.class.st +++ /dev/null @@ -1,31 +0,0 @@ -Class { - #name : #PyramidFakeBackgroundMixedValues, - #superclass : #Object, - #category : #'Pyramid-Bloc-custom-specs-background' -} - -{ #category : #testing } -PyramidFakeBackgroundMixedValues >> isNil [ - - ^ true -] - -{ #category : #testing } -PyramidFakeBackgroundMixedValues >> isNotNil [ - - ^ false -] - -{ #category : #'as yet unclassified' } -PyramidFakeBackgroundMixedValues >> pyramidBackgroundStrategy [ - - ^ PyramidBackgroundPropertyInputMixedValuesModel new -] - -{ #category : #'as yet unclassified' } -PyramidFakeBackgroundMixedValues >> pyramidModalDefaultPaint: aPyramidPaintInputPresenter [ -] - -{ #category : #'as yet unclassified' } -PyramidFakeBackgroundMixedValues >> pyramidSelectMenuOnModal: aModal [ -] diff --git a/src/Pyramid-Bloc/PyramidFakeBackgroundNoValue.class.st b/src/Pyramid-Bloc/PyramidFakeBackgroundNoValue.class.st deleted file mode 100644 index 484e3783..00000000 --- a/src/Pyramid-Bloc/PyramidFakeBackgroundNoValue.class.st +++ /dev/null @@ -1,29 +0,0 @@ -Class { - #name : #PyramidFakeBackgroundNoValue, - #superclass : #Object, - #category : #'Pyramid-Bloc-custom-specs-background' -} - -{ #category : #testing } -PyramidFakeBackgroundNoValue >> isNil [ - - ^ true -] - -{ #category : #testing } -PyramidFakeBackgroundNoValue >> isNotNil [ - - ^ false -] - -{ #category : #'as yet unclassified' } -PyramidFakeBackgroundNoValue >> pyramidBackgroundStrategy [ - - ^ PyramidBackgroundPropertyInputNoValueModel new -] - -{ #category : #'as yet unclassified' } -PyramidFakeBackgroundNoValue >> pyramidSelectMenuOnModal: aModal [ - - -] diff --git a/src/Pyramid-Bloc/PyramidFakeConstraintsMixed.class.st b/src/Pyramid-Bloc/PyramidFakeConstraintsMixed.class.st deleted file mode 100644 index 68c44a0f..00000000 --- a/src/Pyramid-Bloc/PyramidFakeConstraintsMixed.class.st +++ /dev/null @@ -1,34 +0,0 @@ -Class { - #name : #PyramidFakeConstraintsMixed, - #superclass : #Object, - #instVars : [ - 'isVertical' - ], - #category : #'Pyramid-Bloc-custom-specs-constraints' -} - -{ #category : #factory } -PyramidFakeConstraintsMixed >> horizontal [ - - isVertical := false. - ^ self -] - -{ #category : #accessing } -PyramidFakeConstraintsMixed >> isVertical [ -^ isVertical -] - -{ #category : #'as yet unclassified' } -PyramidFakeConstraintsMixed >> pyramidSelectConstraintsOn: aPyramidConstraintsPresenter [ - - self isVertical ifTrue: [aPyramidConstraintsPresenter model: PyramidConstraintsModel verticalMixed. ] ifFalse: [ aPyramidConstraintsPresenter model: PyramidConstraintsModel horizontalMixed. ]. - -] - -{ #category : #factory } -PyramidFakeConstraintsMixed >> vertical [ - - isVertical := true. - ^ self -] diff --git a/src/Pyramid-Bloc/PyramidFakeConstraintsNoValue.class.st b/src/Pyramid-Bloc/PyramidFakeConstraintsNoValue.class.st deleted file mode 100644 index 497387c6..00000000 --- a/src/Pyramid-Bloc/PyramidFakeConstraintsNoValue.class.st +++ /dev/null @@ -1,22 +0,0 @@ -Class { - #name : #PyramidFakeConstraintsNoValue, - #superclass : #Object, - #category : #'Pyramid-Bloc-custom-specs-constraints' -} - -{ #category : #factory } -PyramidFakeConstraintsNoValue >> horizontal [ - - ^ self -] - -{ #category : #'as yet unclassified' } -PyramidFakeConstraintsNoValue >> pyramidSelectConstraintsOn: aPyramidConstraintsPresenter [ - -] - -{ #category : #factory } -PyramidFakeConstraintsNoValue >> vertical [ - - ^ self -] diff --git a/src/Pyramid-Bloc/PyramidFakeGeometry.class.st b/src/Pyramid-Bloc/PyramidFakeGeometry.class.st deleted file mode 100644 index 60fbdb66..00000000 --- a/src/Pyramid-Bloc/PyramidFakeGeometry.class.st +++ /dev/null @@ -1,13 +0,0 @@ -Class { - #name : #PyramidFakeGeometry, - #superclass : #Object, - #category : #'Pyramid-Bloc-custom-specs-geometry' -} - -{ #category : #'as yet unclassified' } -PyramidFakeGeometry >> pyramidSelectOnPresenter: aPresenter [ - - aPresenter model: PyramidGeometryModel defaultWithMixed - - -] diff --git a/src/Pyramid-Bloc/PyramidFlowLayoutChangeOrientationCommand.class.st b/src/Pyramid-Bloc/PyramidFlowLayoutChangeOrientationCommand.class.st new file mode 100644 index 00000000..a6587570 --- /dev/null +++ b/src/Pyramid-Bloc/PyramidFlowLayoutChangeOrientationCommand.class.st @@ -0,0 +1,23 @@ +Class { + #name : #PyramidFlowLayoutChangeOrientationCommand, + #superclass : #PyramidAbstractBlocCommand, + #category : #'Pyramid-Bloc-plugin-bloc-layout' +} + +{ #category : #testing } +PyramidFlowLayoutChangeOrientationCommand >> canBeUsedFor: anObject [ + + ^ (super canBeUsedFor: anObject) and: [ anObject layout class == BlFlowLayout ] +] + +{ #category : #'as yet unclassified' } +PyramidFlowLayoutChangeOrientationCommand >> getValueFor: anObject [ + + ^ anObject layout orientation +] + +{ #category : #'as yet unclassified' } +PyramidFlowLayoutChangeOrientationCommand >> setValueFor: anObject with: anArgument [ + + anObject layout orientation: anArgument +] diff --git a/src/Pyramid-Bloc/PyramidFlowLayoutOrientationPresenter.class.st b/src/Pyramid-Bloc/PyramidFlowLayoutOrientationPresenter.class.st new file mode 100644 index 00000000..a3403f1a --- /dev/null +++ b/src/Pyramid-Bloc/PyramidFlowLayoutOrientationPresenter.class.st @@ -0,0 +1,27 @@ +Class { + #name : #PyramidFlowLayoutOrientationPresenter, + #superclass : #PyramidSwitchInputPresenter, + #instVars : [ + 'buttonSwitch' + ], + #category : #'Pyramid-Bloc-plugin-bloc-layout' +} + +{ #category : #'as yet unclassified' } +PyramidFlowLayoutOrientationPresenter >> switchState [ + + self value: self value switchOrientation. + self whenValueChangedDo value: self value +] + +{ #category : #'as yet unclassified' } +PyramidFlowLayoutOrientationPresenter >> value [ + + ^ self state asOrientationForPyramid +] + +{ #category : #'as yet unclassified' } +PyramidFlowLayoutOrientationPresenter >> value: anOrientation [ + + super value: anOrientation asBooleanForPyramid +] diff --git a/src/Pyramid-Bloc/PyramidFontSizeCommand.class.st b/src/Pyramid-Bloc/PyramidFontSizeCommand.class.st new file mode 100644 index 00000000..9753be50 --- /dev/null +++ b/src/Pyramid-Bloc/PyramidFontSizeCommand.class.st @@ -0,0 +1,22 @@ +Class { + #name : #PyramidFontSizeCommand, + #superclass : #PyramidBlocTextCommand, + #category : #'Pyramid-Bloc-plugin-bloc-text' +} + +{ #category : #'as yet unclassified' } +PyramidFontSizeCommand >> getValueFor: aBlTextElement [ + + aBlTextElement text attributesFinder + findAttributesSuchThat: [ :a | a class = BlFontSizeAttribute ] + indicesDo: [ :new :old :a | ^ a size ]. + self flag: #TODO. "I put 10 as a default font size. I don't know where this information come from." + ^ 10 +] + +{ #category : #'as yet unclassified' } +PyramidFontSizeCommand >> setValueFor: aBlTextElement with: aNumber [ + + aBlTextElement text attribute: + (BlFontSizeAttribute size: aNumber) +] diff --git a/src/Pyramid-Bloc/PyramidFontWeightCommand.class.st b/src/Pyramid-Bloc/PyramidFontWeightCommand.class.st new file mode 100644 index 00000000..22847065 --- /dev/null +++ b/src/Pyramid-Bloc/PyramidFontWeightCommand.class.st @@ -0,0 +1,19 @@ +Class { + #name : #PyramidFontWeightCommand, + #superclass : #PyramidBlocTextCommand, + #category : #'Pyramid-Bloc-plugin-bloc-text' +} + +{ #category : #'as yet unclassified' } +PyramidFontWeightCommand >> getValueFor: aBlTextElement [ + + aBlTextElement text attributesFinder findAttributesSuchThat: [ :a | a class = BlFontWeightAttribute ] indicesDo: [ :new :old :a | ^ a weight ]. + ^ LogicalFont weightRegular +] + +{ #category : #'as yet unclassified' } +PyramidFontWeightCommand >> setValueFor: aBlTextElement with: aNumber [ + + aBlTextElement text attribute: + (BlFontWeightAttribute weight: aNumber) +] diff --git a/src/Pyramid-Bloc/PyramidGeometryCommand.class.st b/src/Pyramid-Bloc/PyramidGeometryCommand.class.st new file mode 100644 index 00000000..411acf89 --- /dev/null +++ b/src/Pyramid-Bloc/PyramidGeometryCommand.class.st @@ -0,0 +1,17 @@ +Class { + #name : #PyramidGeometryCommand, + #superclass : #PyramidAbstractBlocCommand, + #category : #'Pyramid-Bloc-plugin-bloc-geometry' +} + +{ #category : #'as yet unclassified' } +PyramidGeometryCommand >> getValueFor: aBlElement [ + + ^ aBlElement geometry +] + +{ #category : #'as yet unclassified' } +PyramidGeometryCommand >> setValueFor: aBlElement with: anArgument [ + + aBlElement geometry: anArgument +] diff --git a/src/Pyramid-Bloc/PyramidGeometryInputModel.class.st b/src/Pyramid-Bloc/PyramidGeometryInputModel.class.st new file mode 100644 index 00000000..954113c7 --- /dev/null +++ b/src/Pyramid-Bloc/PyramidGeometryInputModel.class.st @@ -0,0 +1,123 @@ +Class { + #name : #PyramidGeometryInputModel, + #superclass : #Object, + #instVars : [ + 'buttonPresenter', + 'blocIcon', + 'defaultGeometry', + 'help', + 'input' + ], + #category : #'Pyramid-Bloc-plugin-bloc-geometry' +} + +{ #category : #accessing } +PyramidGeometryInputModel >> blocIcon [ + + ^ blocIcon +] + +{ #category : #accessing } +PyramidGeometryInputModel >> blocIcon: anObject [ + + blocIcon := anObject +] + +{ #category : #initialization } +PyramidGeometryInputModel >> buttonPresenter [ + + ^ buttonPresenter +] + +{ #category : #accessing } +PyramidGeometryInputModel >> defaultGeometry [ + + ^ defaultGeometry +] + +{ #category : #accessing } +PyramidGeometryInputModel >> defaultGeometry: anObject [ + + defaultGeometry := anObject +] + +{ #category : #'error handling' } +PyramidGeometryInputModel >> error [ + + self buttonPresenter icon: self iconError; help: 'Will do nothing'; action: [ ] +] + +{ #category : #accessing } +PyramidGeometryInputModel >> help [ + + ^ help +] + +{ #category : #accessing } +PyramidGeometryInputModel >> help: anObject [ + + help := anObject +] + +{ #category : #'as yet unclassified' } +PyramidGeometryInputModel >> iconColor: aColor [ + + ^ (self blocIcon background: aColor) exportAsForm +] + +{ #category : #'as yet unclassified' } +PyramidGeometryInputModel >> iconError [ + + ^self iconColor: (Color fromHexString: 'FFDB42') +] + +{ #category : #'as yet unclassified' } +PyramidGeometryInputModel >> iconNormal [ + + ^self iconColor: (Color fromHexString: 'a7a7a7') +] + +{ #category : #'as yet unclassified' } +PyramidGeometryInputModel >> iconSelected [ + + ^self iconColor: (Color fromHexString: 'AFD5FA') +] + +{ #category : #initialization } +PyramidGeometryInputModel >> initialize [ + + buttonPresenter := SpButtonPresenter new. +] + +{ #category : #accessing } +PyramidGeometryInputModel >> input [ + + ^ input +] + +{ #category : #accessing } +PyramidGeometryInputModel >> input: anObject [ + + input := anObject +] + +{ #category : #'error handling' } +PyramidGeometryInputModel >> normal [ + + self buttonPresenter + icon: self iconNormal; + help: self help; + action: [ + self input value: self defaultGeometry. + self input whenValueChangedDo value: self defaultGeometry. ] +] + +{ #category : #'error handling' } +PyramidGeometryInputModel >> selected [ + + self buttonPresenter + icon: self iconSelected; + help: self help; + action: [ + ] +] diff --git a/src/Pyramid-Bloc/PyramidGeometryInputPresenter.class.st b/src/Pyramid-Bloc/PyramidGeometryInputPresenter.class.st new file mode 100644 index 00000000..d7521426 --- /dev/null +++ b/src/Pyramid-Bloc/PyramidGeometryInputPresenter.class.st @@ -0,0 +1,165 @@ +Class { + #name : #PyramidGeometryInputPresenter, + #superclass : #PyramidInputPresenter, + #instVars : [ + 'whenValueChangedDo', + 'geometry', + 'geometryDictionnary' + ], + #category : #'Pyramid-Bloc-plugin-bloc-geometry' +} + +{ #category : #layout } +PyramidGeometryInputPresenter >> defaultLayout [ + + | defaultLayout | + defaultLayout := SpBoxLayout newHorizontal + spacing: 4; + yourself. + self geometryDictionnary valuesDo: [ :each | + defaultLayout add: each buttonPresenter width: 24 ]. + ^ defaultLayout +] + +{ #category : #accessing } +PyramidGeometryInputPresenter >> geometry [ + + ^ geometry. +] + +{ #category : #accessing } +PyramidGeometryInputPresenter >> geometry: anObject [ + + geometry := anObject +] + +{ #category : #accessing } +PyramidGeometryInputPresenter >> geometryDictionnary [ + + ^ geometryDictionnary +] + +{ #category : #initialization } +PyramidGeometryInputPresenter >> initializeGeometryButtons [ + + geometryDictionnary + at: BlRectangleGeometry + put: (PyramidGeometryInputModel new + input: self; + help: 'Change the geometry to a rectangle.'; + defaultGeometry: BlRectangleGeometry new; + blocIcon: (BlElement new + size: 16 asPoint; + geometry: BlRectangleGeometry new; + yourself); + yourself). + + geometryDictionnary + at: BlRectangleGeometry + put: (PyramidGeometryInputModel new + input: self; + help: 'Change the geometry to a rectangle.'; + defaultGeometry: BlRectangleGeometry new; + blocIcon: (BlElement new + size: 16 asPoint; + geometry: BlRectangleGeometry new; + yourself); + yourself). + + geometryDictionnary + at: BlEllipseGeometry + put: (PyramidGeometryInputModel new + input: self; + help: 'Change the geometry to an ellipse.'; + defaultGeometry: BlEllipseGeometry new; + blocIcon: (BlElement new + size: 16 asPoint; + geometry: BlEllipseGeometry new; + yourself); + yourself). + + geometryDictionnary + at: BlRoundedRectangleGeometry + put: (PyramidGeometryInputModel new + input: self; + help: 'Change the geometry to an ellipse.'; + defaultGeometry: (BlRoundedRectangleGeometry cornerRadius: 12); + blocIcon: (BlElement new + size: 16 asPoint; + geometry: (BlRoundedRectangleGeometry cornerRadius: 5); + yourself); + yourself). + + geometryDictionnary + at: BlPolygonGeometry + put: (PyramidGeometryInputModel new + input: self; + help: 'Change the geometry to a polygon geometry.'; + defaultGeometry: (BlPolygonGeometry vertices: { + (8 @ 0). + (13 @ 16). + (0 @ 6). + (16 @ 6). + (3 @ 16) } * 3); + blocIcon: (BlElement new + size: 16 asPoint; + geometry: (BlPolygonGeometry vertices: { + (8 @ 0). + (13 @ 16). + (0 @ 6). + (16 @ 6). + (3 @ 16) }); + yourself); + yourself) +] + +{ #category : #initialization } +PyramidGeometryInputPresenter >> initializePresenters [ + + whenValueChangedDo := [ :geo | ]. + geometryDictionnary := OrderedDictionary new. + self initializeGeometryButtons. + self value: PyramidUnknowState new +] + +{ #category : #'as yet unclassified' } +PyramidGeometryInputPresenter >> setNormalAndSelect: buttonModel [ + + self geometryDictionnary valuesDo: [ :each | each normal ]. + buttonModel defaultGeometry: self geometry. + buttonModel selected +] + +{ #category : #initialization } +PyramidGeometryInputPresenter >> setUnknow [ + + self geometryDictionnary valuesDo: [ :each | each error ]. +] + +{ #category : #'as yet unclassified' } +PyramidGeometryInputPresenter >> value [ + + ^ self geometry +] + +{ #category : #'as yet unclassified' } +PyramidGeometryInputPresenter >> value: aBlGeometry [ + + self geometry: aBlGeometry. + self geometryDictionnary + at: aBlGeometry class + ifPresent: [ :buttonModel | self setNormalAndSelect: buttonModel ] + ifAbsent: [ self setUnknow ] +] + +{ #category : #accessing } +PyramidGeometryInputPresenter >> whenValueChangedDo [ + + ^ whenValueChangedDo +] + +{ #category : #'as yet unclassified' } +PyramidGeometryInputPresenter >> whenValueChangedDo: anObject [ + + whenValueChangedDo := anObject +] diff --git a/src/Pyramid-Bloc/PyramidGeometryModel.class.st b/src/Pyramid-Bloc/PyramidGeometryModel.class.st deleted file mode 100644 index 918c7a4c..00000000 --- a/src/Pyramid-Bloc/PyramidGeometryModel.class.st +++ /dev/null @@ -1,206 +0,0 @@ -Class { - #name : #PyramidGeometryModel, - #superclass : #Object, - #instVars : [ - 'icon', - 'title', - 'associatedPresenter', - 'buttonPresenter', - 'geometryBlock', - 'initializeBlock', - 'selectBlock' - ], - #category : #'Pyramid-Bloc-custom-specs-geometry' -} - -{ #category : #accessing } -PyramidGeometryModel class >> default [ - - ^ { - self rectangle. - self roundedRectangle. - self ellipse } -] - -{ #category : #accessing } -PyramidGeometryModel class >> defaultWithMixed [ - - ^ { - self mixed. - self rectangle. - self roundedRectangle. - self ellipse } -] - -{ #category : #accessing } -PyramidGeometryModel class >> ellipse [ - - ^ self new - title: 'Ellipse'; - geometryBlock: [ BlEllipseGeometry new ]; - icon: (self makeFormFrom: BlEllipseGeometry new); - associatedPresenter: SpNullPresenter new; - yourself -] - -{ #category : #'as yet unclassified' } -PyramidGeometryModel class >> makeFormFrom: aBlGeometry [ - - ^ BlElement new size: 30 @ 20; geometry: aBlGeometry; background: Color black; exportAsForm -] - -{ #category : #accessing } -PyramidGeometryModel class >> mixed [ - - ^ self new - title: 'Mixed value'; - geometryBlock: [ nil ]; - icon: nil; - associatedPresenter: SpNullPresenter new; - yourself -] - -{ #category : #accessing } -PyramidGeometryModel class >> rectangle [ - - ^ self new - title: 'Rectangle'; - geometryBlock: [BlRectangleGeometry new]; - icon: (self makeFormFrom: BlRectangleGeometry new); - associatedPresenter: SpNullPresenter new; - yourself -] - -{ #category : #accessing } -PyramidGeometryModel class >> roundedRectangle [ - - | model inputRadius | - inputRadius := PyramidNumberPresenter new - number: 8; - yourself. - - model := self new - title: 'Rounded'; - geometryBlock: [ - (inputRadius number isNil or: [ inputRadius number < 1 ]) - ifTrue: [ BlRoundedRectangleGeometry cornerRadius: 8 ] - ifFalse: [ - BlRoundedRectangleGeometry cornerRadius: - inputRadius number ] ]; - icon: - (self makeFormFrom: - (BlRoundedRectangleGeometry cornerRadius: 8)); - associatedPresenter: inputRadius; - yourself. - model - initializeBlock: [ :presenter | - inputRadius whenSubmitDo: [ :n | presenter submit: model ] ]; - selectBlock: [ :geo | - inputRadius number: geo cornerRadii max. - model buttonPresenter click ]. - ^ model -] - -{ #category : #accessing } -PyramidGeometryModel >> associatedPresenter [ - - ^ associatedPresenter -] - -{ #category : #accessing } -PyramidGeometryModel >> associatedPresenter: anObject [ - - associatedPresenter := anObject -] - -{ #category : #accessing } -PyramidGeometryModel >> buttonPresenter [ - - ^ buttonPresenter -] - -{ #category : #accessing } -PyramidGeometryModel >> buttonPresenter: anObject [ - - buttonPresenter := anObject -] - -{ #category : #accessing } -PyramidGeometryModel >> geometryBlock [ - - ^ geometryBlock -] - -{ #category : #accessing } -PyramidGeometryModel >> geometryBlock: anObject [ - - geometryBlock := anObject -] - -{ #category : #accessing } -PyramidGeometryModel >> icon [ - - ^ icon -] - -{ #category : #accessing } -PyramidGeometryModel >> icon: anObject [ - - icon := anObject -] - -{ #category : #accessing } -PyramidGeometryModel >> initializeBlock [ - - initializeBlock ifNil: [ initializeBlock := [ :empty | ] ]. - ^ initializeBlock -] - -{ #category : #accessing } -PyramidGeometryModel >> initializeBlock: anObject [ - - initializeBlock := anObject -] - -{ #category : #testing } -PyramidGeometryModel >> isSelectableWith: aGeometry [ - - ^ self geometryBlock value class = aGeometry class -] - -{ #category : #'as yet unclassified' } -PyramidGeometryModel >> makeGeometry [ - - ^ self geometryBlock value -] - -{ #category : #accessing } -PyramidGeometryModel >> selectBlock [ - - selectBlock ifNil: [ selectBlock := [ :geo | self buttonPresenter click ] ]. - ^ selectBlock -] - -{ #category : #accessing } -PyramidGeometryModel >> selectBlock: anObject [ - - selectBlock := anObject -] - -{ #category : #'as yet unclassified' } -PyramidGeometryModel >> selectModelWith: aGeometry [ - - self selectBlock value: aGeometry -] - -{ #category : #accessing } -PyramidGeometryModel >> title [ - - ^ title -] - -{ #category : #accessing } -PyramidGeometryModel >> title: anObject [ - - title := anObject -] diff --git a/src/Pyramid-Bloc/PyramidGeometryPresenter.class.st b/src/Pyramid-Bloc/PyramidGeometryPresenter.class.st deleted file mode 100644 index 18715f46..00000000 --- a/src/Pyramid-Bloc/PyramidGeometryPresenter.class.st +++ /dev/null @@ -1,128 +0,0 @@ -Class { - #name : #PyramidGeometryPresenter, - #superclass : #SpPresenter, - #instVars : [ - 'model', - 'whenSubmitDo', - 'geometry', - 'shouldTrigger' - ], - #category : #'Pyramid-Bloc-custom-specs-geometry' -} - -{ #category : #accessing } -PyramidGeometryPresenter class >> default [ - - ^ self new - model: - PyramidGeometryModel default; - yourself -] - -{ #category : #layout } -PyramidGeometryPresenter >> defaultLayout [ - - | buttonLayout | - buttonLayout := SpBoxLayout newVertical - spacing: 4; - yourself. - self model do: [ :each | - buttonLayout - add: (SpBoxLayout newHorizontal - spacing: 4; - add: (SpImagePresenter new image: each icon) expand: false; - add: each buttonPresenter expand: true; - add: each associatedPresenter width: 48; - yourself) - height: 24 ]. - ^ buttonLayout -] - -{ #category : #accessing } -PyramidGeometryPresenter >> defaultValue: aBlGeometry [ - - self shouldTrigger: false. - aBlGeometry pyramidSelectOnPresenter: self. - self shouldTrigger: true -] - -{ #category : #accessing } -PyramidGeometryPresenter >> geometry [ - ^ geometry -] - -{ #category : #accessing } -PyramidGeometryPresenter >> geometry: aGeometry [ - - geometry:= aGeometry -] - -{ #category : #initialization } -PyramidGeometryPresenter >> initializePresenters [ - - model := { }. - shouldTrigger := true -] - -{ #category : #'as yet unclassified' } -PyramidGeometryPresenter >> makeRadioButton: aPyramidGeometryModel [ - - ^ SpRadioButtonPresenter new - label: aPyramidGeometryModel title; - whenActivatedDo: [ self submit: aPyramidGeometryModel ]; - yourself -] - -{ #category : #accessing } -PyramidGeometryPresenter >> model [ - - ^ model -] - -{ #category : #accessing } -PyramidGeometryPresenter >> model: aCollection [ - - | listOfButtons | - model := aCollection. - listOfButtons := aCollection collect: [ :each | - | button | - each initializeBlock value: self. - button := self makeRadioButton: each. - each buttonPresenter: button. - button ]. - listOfButtons first associatedRadioButtons: listOfButtons allButFirst. - self layout: self defaultLayout -] - -{ #category : #accessing } -PyramidGeometryPresenter >> shouldTrigger [ - - ^ shouldTrigger -] - -{ #category : #accessing } -PyramidGeometryPresenter >> shouldTrigger: aBoolean [ - - shouldTrigger:= aBoolean -] - -{ #category : #'as yet unclassified' } -PyramidGeometryPresenter >> submit: aGeometryModel [ - - self shouldTrigger ifFalse: [ ^ self ]. - self geometry: aGeometryModel makeGeometry. - self whenSubmitDo value -] - -{ #category : #accessing } -PyramidGeometryPresenter >> whenSubmitDo [ - - whenSubmitDo ifNil: [ whenSubmitDo := [ ] ]. - ^ whenSubmitDo -] - -{ #category : #accessing } -PyramidGeometryPresenter >> whenSubmitDo: anObject [ - - whenSubmitDo := anObject -] diff --git a/src/Pyramid-Bloc/PyramidGradientPaintInputPresenter.class.st b/src/Pyramid-Bloc/PyramidGradientPaintInputPresenter.class.st new file mode 100644 index 00000000..521b593c --- /dev/null +++ b/src/Pyramid-Bloc/PyramidGradientPaintInputPresenter.class.st @@ -0,0 +1,170 @@ +Class { + #name : #PyramidGradientPaintInputPresenter, + #superclass : #PyramidInputPresenter, + #instVars : [ + 'stopsInput', + 'radialButton', + 'linearButton', + 'whenValueChangedDo', + 'startInput', + 'radiusInput', + 'centerInput', + 'endInput' + ], + #category : #'Pyramid-Bloc-plugin-bloc' +} + +{ #category : #accessing } +PyramidGradientPaintInputPresenter >> centerInput [ + + ^ centerInput +] + +{ #category : #initialization } +PyramidGradientPaintInputPresenter >> defaultLayout [ + + | labelSize | + labelSize := 50. + + ^ SpBoxLayout newVertical + spacing: 0; + add: (SpBoxLayout newHorizontal + spacing: 4; + add: (SpBoxLayout newVertical + spacing: 8; + add: self linearButton height: 24; + add: (SpBoxLayout newHorizontal + spacing: 4; + vAlignCenter; + add: ' start' width: labelSize; + add: self startInput; + yourself) + height: 24; + add: (SpBoxLayout newHorizontal + spacing: 4; + vAlignCenter; + add: ' end' width: labelSize; + add: self endInput; + yourself) + height: 24; + yourself); + add: (SpBoxLayout newVertical + spacing: 8; + add: self radialButton height: 24; + add: (SpBoxLayout newHorizontal + spacing: 4; + vAlignCenter; + add: ' center' width: labelSize; + add: self centerInput; + yourself) + height: 24; + add: (SpBoxLayout newHorizontal + spacing: 4; + vAlignCenter; + add: ' radius' width: labelSize; + add: self radiusInput; + yourself) + height: 24; + add: SpNullPresenter new height: 24; + yourself); + yourself) + expand: false; + add: self stopsInput; + "height: 250"yourself +] + +{ #category : #accessing } +PyramidGradientPaintInputPresenter >> endInput [ + + ^ endInput +] + +{ #category : #initialization } +PyramidGradientPaintInputPresenter >> initializePresenters [ + + whenValueChangedDo := [ :paint | ]. + centerInput := PyramidPointInputPresenter new value: 0 @ 0; yourself. + startInput := PyramidPointInputPresenter new value: 0 @ 0; yourself. + endInput := PyramidPointInputPresenter new value: 1 @ 0; yourself. + radiusInput := PyramidNumberInputPresenter new value: 50; yourself. + stopsInput := PyramidStopsInputPresenter new whenValueChangedDo: [ + :stops | self whenValueChangedDo value: self value ]. + radialButton := SpRadioButtonPresenter new + label: 'Radial'; + whenActivatedDo: [ + self whenValueChangedDo value: self value ]; + yourself. + linearButton := SpRadioButtonPresenter new + label: 'Linear'; + whenActivatedDo: [ + self whenValueChangedDo value: self value ]; + yourself. + linearButton associatedRadioButtons: { radialButton } +] + +{ #category : #accessing } +PyramidGradientPaintInputPresenter >> linearButton [ + + ^ linearButton +] + +{ #category : #accessing } +PyramidGradientPaintInputPresenter >> radialButton [ + + ^ radialButton +] + +{ #category : #accessing } +PyramidGradientPaintInputPresenter >> radiusInput [ +^ radiusInput +] + +{ #category : #accessing } +PyramidGradientPaintInputPresenter >> startInput [ + +^ startInput. +] + +{ #category : #accessing } +PyramidGradientPaintInputPresenter >> stopsInput [ + + ^ stopsInput +] + +{ #category : #initialization } +PyramidGradientPaintInputPresenter >> value [ + + self linearButton state ifTrue: [ + ^ BlLinearGradientPaint new + start: self startInput value; + end: self endInput value; + stops: self stopsInput value; + yourself ]. + ^ BlRadialGradientPaint new + center: self centerInput value; + radius: self radiusInput value; + stops: self stopsInput value; + yourself +] + +{ #category : #initialization } +PyramidGradientPaintInputPresenter >> value: aBlGradientPaint [ + + | temp | + temp := self whenValueChangedDo. + self whenValueChangedDo: [ :something | ]. + aBlGradientPaint selectOnGradientPaintInput: self. + self whenValueChangedDo: temp +] + +{ #category : #accessing } +PyramidGradientPaintInputPresenter >> whenValueChangedDo [ + + ^ whenValueChangedDo +] + +{ #category : #accessing } +PyramidGradientPaintInputPresenter >> whenValueChangedDo: anObject [ + + whenValueChangedDo := anObject +] diff --git a/src/Pyramid-Bloc/PyramidGroupCommand.class.st b/src/Pyramid-Bloc/PyramidGroupCommand.class.st new file mode 100644 index 00000000..7cf5f3b2 --- /dev/null +++ b/src/Pyramid-Bloc/PyramidGroupCommand.class.st @@ -0,0 +1,74 @@ +Class { + #name : #PyramidGroupCommand, + #superclass : #PyramidAbstractGroupCommand, + #category : #'Pyramid-Bloc-plugin-bloc' +} + +{ #category : #testing } +PyramidGroupCommand >> canBeUsedFor: anObject [ + + ^ anObject isCollection and: [ + anObject isNotEmpty and: [ + | parent | + parent := anObject first parent. + anObject allSatisfy: [ :each | each parent = parent ] ] ] +] + +{ #category : #'as yet unclassified' } +PyramidGroupCommand >> commandInverse [ + + ^ PyramidGroupInverseCommand new +] + +{ #category : #'as yet unclassified' } +PyramidGroupCommand >> makeGroupElement [ + + ^ BlElement new id: #group; clipChildren: false; yourself +] + +{ #category : #'as yet unclassified' } +PyramidGroupCommand >> saveStatesOf: aCollection with: arguments [ + + | mementos | + mementos := aCollection asArray collect: [ :each | + PyramidCommandMemento new + command: self; + target: each; + arguments: arguments; + yourself ]. + mementos size = 1 ifTrue: [ ^ mementos first ]. + ^ PyramidCompositeMemento new + mementos: mementos; + yourself +] + +{ #category : #'as yet unclassified' } +PyramidGroupCommand >> saveStatesWithCommandInverseOf: aCollection with: arguments [ + + | mementos | + mementos := aCollection asArray collect: [ :each | + PyramidCommandMemento new + command: self commandInverse; + target: each; + arguments: arguments; + yourself ]. + mementos size = 1 ifTrue: [ ^ mementos first ]. + ^ PyramidCompositeMemento new + mementos: mementos; + yourself +] + +{ #category : #'as yet unclassified' } +PyramidGroupCommand >> setValueFor: aCollection with: roots [ + + | parent groupElement | + parent := aCollection first parent. + parent ifNotNil: [ parent removeChildren: aCollection ]. + groupElement := self makeGroupElement. + groupElement addChildren: aCollection. + parent ifNotNil: [ parent addChild: groupElement ]. + + (roots includesAny: aCollection) ifFalse: [ ^ self ]. + roots removeAll: aCollection. + roots add: groupElement +] diff --git a/src/Pyramid-Bloc/PyramidGroupInverseCommand.class.st b/src/Pyramid-Bloc/PyramidGroupInverseCommand.class.st new file mode 100644 index 00000000..55cb914e --- /dev/null +++ b/src/Pyramid-Bloc/PyramidGroupInverseCommand.class.st @@ -0,0 +1,40 @@ +Class { + #name : #PyramidGroupInverseCommand, + #superclass : #PyramidAbstractGroupCommand, + #category : #'Pyramid-Bloc-plugin-bloc' +} + +{ #category : #testing } +PyramidGroupInverseCommand >> canBeUsedFor: anObject [ + + ^ anObject isCollection and: [ + anObject isNotEmpty and: [ + | parent | + parent := anObject first parent. + parent isNotNil and: [ + anObject allSatisfy: [ :each | each parent = parent ] ] ] ] +] + +{ #category : #'as yet unclassified' } +PyramidGroupInverseCommand >> commandInverse [ + + ^ PyramidGroupCommand new +] + +{ #category : #'as yet unclassified' } +PyramidGroupInverseCommand >> setValueFor: aCollection with: roots [ + + | elements groupElement | + groupElement := aCollection first parent. + elements := groupElement children asArray. + (roots includesAny: elements) ifTrue: [ ^ self ]. + groupElement removeChildren. + + groupElement hasParent ifTrue: [ + groupElement parent addChildren: elements. + groupElement parent removeChild: groupElement ]. + + (roots includes: groupElement) ifFalse: [ ^ self ]. + roots remove: groupElement. + roots addAll: elements +] diff --git a/src/Pyramid-Bloc/PyramidInsetsInputPresenter.class.st b/src/Pyramid-Bloc/PyramidInsetsInputPresenter.class.st new file mode 100644 index 00000000..8f94d482 --- /dev/null +++ b/src/Pyramid-Bloc/PyramidInsetsInputPresenter.class.st @@ -0,0 +1,71 @@ +Class { + #name : #PyramidInsetsInputPresenter, + #superclass : #PyramidInputPresenter, + #instVars : [ + 'inputArray', + 'whenValueChangedDo' + ], + #category : #'Pyramid-Bloc-plugin-bloc' +} + +{ #category : #'as yet unclassified' } +PyramidInsetsInputPresenter >> applyStrings [ + + self inputArray strings: self strings. +] + +{ #category : #layout } +PyramidInsetsInputPresenter >> defaultLayout [ + +^ SpBoxLayout newHorizontal add: self inputArray; yourself +] + +{ #category : #initialization } +PyramidInsetsInputPresenter >> initializePresenters [ + + whenValueChangedDo := [ :insets | ]. + inputArray := PyramidNumberArrayInputPresenter new + whenValueChangedDo: [ :array | + self whenValueChangedDo value: + (self insetsFrom: array) ] +] + +{ #category : #layout } +PyramidInsetsInputPresenter >> inputArray [ + + ^ inputArray +] + +{ #category : #'as yet unclassified' } +PyramidInsetsInputPresenter >> insetsFrom: anArray [ + + anArray isCollection ifFalse: [ ^ anArray ]. + anArray size = 1 ifTrue: [ ^ BlInsets all: anArray first ]. + anArray size = 2 ifTrue: [ ^ BlInsets top: anArray first right: anArray last bottom: anArray first left: anArray last ]. + anArray size = 4 ifTrue: [ ^ BlInsets top: anArray first right: anArray second bottom: anArray third left: anArray last ]. + ^ PyramidUnknowState new +] + +{ #category : #'as yet unclassified' } +PyramidInsetsInputPresenter >> value [ + + ^ self insetsFrom: self inputArray value +] + +{ #category : #'as yet unclassified' } +PyramidInsetsInputPresenter >> value: aBlInsets [ + + aBlInsets setInsetsOn: self +] + +{ #category : #initialization } +PyramidInsetsInputPresenter >> whenValueChangedDo [ + + ^ whenValueChangedDo +] + +{ #category : #initialization } +PyramidInsetsInputPresenter >> whenValueChangedDo: aBlock [ + + whenValueChangedDo := aBlock +] diff --git a/src/Pyramid-Bloc/PyramidLayoutBlocCommand.class.st b/src/Pyramid-Bloc/PyramidLayoutBlocCommand.class.st new file mode 100644 index 00000000..880f6ede --- /dev/null +++ b/src/Pyramid-Bloc/PyramidLayoutBlocCommand.class.st @@ -0,0 +1,17 @@ +Class { + #name : #PyramidLayoutBlocCommand, + #superclass : #PyramidAbstractBlocCommand, + #category : #'Pyramid-Bloc-plugin-bloc-layout' +} + +{ #category : #'as yet unclassified' } +PyramidLayoutBlocCommand >> getValueFor: anObject [ + + ^ anObject layout +] + +{ #category : #'as yet unclassified' } +PyramidLayoutBlocCommand >> setValueFor: anObject with: anArgument [ + + anObject layout: anArgument +] diff --git a/src/Pyramid-Bloc/PyramidLayoutInputPresenter.class.st b/src/Pyramid-Bloc/PyramidLayoutInputPresenter.class.st new file mode 100644 index 00000000..cb1a9123 --- /dev/null +++ b/src/Pyramid-Bloc/PyramidLayoutInputPresenter.class.st @@ -0,0 +1,155 @@ +Class { + #name : #PyramidLayoutInputPresenter, + #superclass : #PyramidInputPresenter, + #instVars : [ + 'buttonBasic', + 'buttonFlow', + 'buttonProportionnal', + 'whenValueChangedDo', + 'value' + ], + #category : #'Pyramid-Bloc-plugin-bloc-layout' +} + +{ #category : #accessing } +PyramidLayoutInputPresenter >> buttonBasic [ + + ^ buttonBasic +] + +{ #category : #accessing } +PyramidLayoutInputPresenter >> buttonFlow [ + + ^ buttonFlow +] + +{ #category : #accessing } +PyramidLayoutInputPresenter >> buttonProportionnal [ + + ^ buttonProportionnal +] + +{ #category : #layout } +PyramidLayoutInputPresenter >> defaultLayout [ + + ^ SpBoxLayout newHorizontal + spacing: 4; + add: self buttonBasic; + add: self buttonFlow; + add: self buttonProportionnal; + yourself +] + +{ #category : #initialization } +PyramidLayoutInputPresenter >> initializePresenters [ + + whenValueChangedDo := [ :visibility | ]. + buttonBasic := SpButtonPresenter new + label: 'No layout'; + help: + 'Remove the layout. The children will be place according to their position.'; + action: [ + self value: BlBasicLayout new. + self whenValueChangedDo value: self value ]; + enabled: false; + yourself. + buttonFlow := SpButtonPresenter new + label: 'Flow'; + help: + 'Set the layout as Flow. The children will be place according to their order. The flow layout will display all children in line and will wrap arround if it does not have enought place.'; + action: [ + self value: BlFlowLayout horizontal. + self whenValueChangedDo value: self value ]; + enabled: false; + yourself. + buttonProportionnal := SpButtonPresenter new + label: 'ST layout'; + help: + 'Set the layout as Proportional. The children will be place according to their relative top/bottom and left/right proportion.'; + action: [ + self value: BlProportionalLayout new. + self whenValueChangedDo value: self value ]; + enabled: false; + yourself +] + +{ #category : #initialization } +PyramidLayoutInputPresenter >> setBasic [ + + self buttonBasic + enabled: true; + icon: (self iconNamed: #checkboxSelected). + self buttonFlow + enabled: true; + icon: (self iconNamed: #checkboxUnselected). + self buttonProportionnal + enabled: true; + icon: (self iconNamed: #checkboxUnselected) +] + +{ #category : #initialization } +PyramidLayoutInputPresenter >> setFlow [ + + self buttonBasic + enabled: true; + icon: (self iconNamed: #checkboxUnselected). + self buttonFlow + enabled: true; + icon: (self iconNamed: #checkboxSelected). + self buttonProportionnal + enabled: true; + icon: (self iconNamed: #checkboxUnselected) +] + +{ #category : #initialization } +PyramidLayoutInputPresenter >> setProportionnal [ + + self buttonBasic + enabled: true; + icon: (self iconNamed: #checkboxUnselected). + self buttonFlow + enabled: true; + icon: (self iconNamed: #checkboxUnselected). + self buttonProportionnal + enabled: true; + icon: (self iconNamed: #checkboxSelected) +] + +{ #category : #initialization } +PyramidLayoutInputPresenter >> setUnknowValue [ + + self buttonBasic + enabled: false; + icon: (self iconNamed: #checkboxUnselected). + self buttonFlow + enabled: false; + icon: (self iconNamed: #checkboxUnselected). + self buttonProportionnal + enabled: false; + icon: (self iconNamed: #checkboxUnselected) +] + +{ #category : #'as yet unclassified' } +PyramidLayoutInputPresenter >> value [ + + ^ value +] + +{ #category : #'as yet unclassified' } +PyramidLayoutInputPresenter >> value: anObject [ + + value := anObject. + anObject setLayoutOn: self +] + +{ #category : #accessing } +PyramidLayoutInputPresenter >> whenValueChangedDo [ + + ^ whenValueChangedDo +] + +{ #category : #accessing } +PyramidLayoutInputPresenter >> whenValueChangedDo: anObject [ + + whenValueChangedDo := anObject +] diff --git a/src/Pyramid-Bloc/PyramidLibraryElement.class.st b/src/Pyramid-Bloc/PyramidLibraryElement.class.st index 0d890209..4a3009f2 100644 --- a/src/Pyramid-Bloc/PyramidLibraryElement.class.st +++ b/src/Pyramid-Bloc/PyramidLibraryElement.class.st @@ -6,7 +6,7 @@ Class { 'form', 'blockMaker' ], - #category : #'Pyramid-Bloc-plugin-library' + #category : #'Pyramid-Bloc-plugin-tree-library' } { #category : #converting } @@ -25,7 +25,7 @@ PyramidLibraryElement >> blockMaker [ PyramidLibraryElement >> blockMaker: anObject [ blockMaker := anObject. - form := blockMaker value aeAsForm + form := blockMaker value exportAsForm ] { #category : #accessing } diff --git a/src/Pyramid-Bloc/PyramidLibraryView.class.st b/src/Pyramid-Bloc/PyramidLibraryPresenter.class.st similarity index 53% rename from src/Pyramid-Bloc/PyramidLibraryView.class.st rename to src/Pyramid-Bloc/PyramidLibraryPresenter.class.st index 3d72a0f1..8f10d4d4 100644 --- a/src/Pyramid-Bloc/PyramidLibraryView.class.st +++ b/src/Pyramid-Bloc/PyramidLibraryPresenter.class.st @@ -1,70 +1,72 @@ Class { - #name : #PyramidLibraryView, + #name : #PyramidLibraryPresenter, #superclass : #SpPresenter, #instVars : [ 'list', 'preview', 'editor', - 'addButton' + 'addButton', + 'idGenerator' ], - #category : #'Pyramid-Bloc-plugin-library' + #category : #'Pyramid-Bloc-plugin-tree-library' } +{ #category : #accessing } +PyramidLibraryPresenter class >> idGenerator [ +^ Generator on: [ :generator | + | index | + index := 1. + [ + Character alphabet do: [ :each | + | next suffix | + next := each asUppercase asString. + suffix := index = 1 + ifTrue: [ '' ] + ifFalse: [ index asString ]. + generator yield: next , suffix ]. + index := index + 1 ] repeat ]. +] + { #category : #initialization } -PyramidLibraryView >> addButton [ +PyramidLibraryPresenter >> addButton [ ^ addButton ] { #category : #'as yet unclassified' } -PyramidLibraryView >> buttonAction [ +PyramidLibraryPresenter >> buttonAction [ ^ self shouldBeImplemented ] { #category : #'as yet unclassified' } -PyramidLibraryView >> buttonLabel [ +PyramidLibraryPresenter >> buttonLabel [ ^ self shouldBeImplemented ] { #category : #'as yet unclassified' } -PyramidLibraryView >> defaultItemsList [ +PyramidLibraryPresenter >> defaultItemsList [ ^ { (PyramidLibraryElement new - title: 'Square red'; - blockMaker: [ - BlElement new - background: Color red; - id: #red; - yourself ]; - yourself). - (PyramidLibraryElement new - title: 'Square green'; + title: 'Square with randomized color'; blockMaker: [ BlElement new - background: Color green; - id: #green; - yourself ]; - yourself). - (PyramidLibraryElement new - title: 'Square blue'; - blockMaker: [ - BlElement new - background: Color blue; - id: #blue; + background: Color random; + id: self idGenerator next; yourself ]; yourself). (PyramidLibraryElement new title: 'Text'; blockMaker: [ - ('Example' asRopedText ) - asElement ]; + 'text' asRopedText asElement + id: self idGenerator next; + yourself ]; yourself) } ] { #category : #initialization } -PyramidLibraryView >> defaultLayout [ +PyramidLibraryPresenter >> defaultLayout [ ^ SpBoxLayout newVertical spacing: 4; @@ -94,23 +96,37 @@ PyramidLibraryView >> defaultLayout [ ] { #category : #accessing } -PyramidLibraryView >> editor [ +PyramidLibraryPresenter >> editor [ ^ editor ] { #category : #accessing } -PyramidLibraryView >> editor: aPyramidEditor [ +PyramidLibraryPresenter >> editor: aPyramidEditor [ editor := aPyramidEditor ] +{ #category : #accessing } +PyramidLibraryPresenter >> idGenerator [ + + ^ idGenerator +] + +{ #category : #accessing } +PyramidLibraryPresenter >> idGenerator: anObject [ + + idGenerator := anObject +] + { #category : #initialization } -PyramidLibraryView >> initializePresenters [ +PyramidLibraryPresenter >> initializePresenters [ + + idGenerator := self class idGenerator. addButton := SpButtonPresenter new - label: self buttonLabel; - action: [ self buttonAction ]; - yourself. + label: self buttonLabel; + action: [ self buttonAction ]; + yourself. preview := SpImagePresenter new. list := SpListPresenter new beSingleSelection; @@ -124,18 +140,18 @@ PyramidLibraryView >> initializePresenters [ ] { #category : #accessing } -PyramidLibraryView >> list [ +PyramidLibraryPresenter >> list [ ^ list ] { #category : #accessing } -PyramidLibraryView >> preview [ +PyramidLibraryPresenter >> preview [ ^ preview ] { #category : #'as yet unclassified' } -PyramidLibraryView >> updatePreviewWith: aLibraryElement [ +PyramidLibraryPresenter >> updatePreviewWith: aLibraryElement [ self preview image: aLibraryElement form ] diff --git a/src/Pyramid-Bloc/PyramidLibraryPresenterForElement.class.st b/src/Pyramid-Bloc/PyramidLibraryPresenterForElement.class.st new file mode 100644 index 00000000..fec3ea93 --- /dev/null +++ b/src/Pyramid-Bloc/PyramidLibraryPresenterForElement.class.st @@ -0,0 +1,20 @@ +Class { + #name : #PyramidLibraryPresenterForElement, + #superclass : #PyramidLibraryPresenter, + #category : #'Pyramid-Bloc-plugin-tree-library' +} + +{ #category : #'as yet unclassified' } +PyramidLibraryPresenterForElement >> buttonAction [ + + self editor propertiesManager commandExecutor + use: PyramidAddChildCommand new + on: self editor projectModel selection + with: self list selectedItem blockMaker value +] + +{ #category : #private } +PyramidLibraryPresenterForElement >> buttonLabel [ + + ^ 'Add new child' +] diff --git a/src/Pyramid-Bloc/PyramidLibraryPresenterForRoot.class.st b/src/Pyramid-Bloc/PyramidLibraryPresenterForRoot.class.st new file mode 100644 index 00000000..a15c9b17 --- /dev/null +++ b/src/Pyramid-Bloc/PyramidLibraryPresenterForRoot.class.st @@ -0,0 +1,17 @@ +Class { + #name : #PyramidLibraryPresenterForRoot, + #superclass : #PyramidLibraryPresenter, + #category : #'Pyramid-Bloc-plugin-tree-library' +} + +{ #category : #'as yet unclassified' } +PyramidLibraryPresenterForRoot >> buttonAction [ + + self editor propertiesManager commandExecutor use: PyramidAddToCollectionCommand new on: { self editor projectModel roots } with: self list selectedItem blockMaker value +] + +{ #category : #private } +PyramidLibraryPresenterForRoot >> buttonLabel [ + + ^ 'Add new root' +] diff --git a/src/Pyramid-Bloc/PyramidLibraryViewForElement.class.st b/src/Pyramid-Bloc/PyramidLibraryViewForElement.class.st deleted file mode 100644 index 8bebb355..00000000 --- a/src/Pyramid-Bloc/PyramidLibraryViewForElement.class.st +++ /dev/null @@ -1,22 +0,0 @@ -Class { - #name : #PyramidLibraryViewForElement, - #superclass : #PyramidLibraryView, - #instVars : [ - 'addChildButton' - ], - #category : #'Pyramid-Bloc-plugin-library' -} - -{ #category : #'as yet unclassified' } -PyramidLibraryViewForElement >> buttonAction [ - - self editor activeProject selection do: [ :each | - each addChild: self list selectedItem blockMaker value ]. - self editor activeProject informRootsChanged -] - -{ #category : #private } -PyramidLibraryViewForElement >> buttonLabel [ - - ^ 'Add new child' -] diff --git a/src/Pyramid-Bloc/PyramidLibraryViewForRoot.class.st b/src/Pyramid-Bloc/PyramidLibraryViewForRoot.class.st deleted file mode 100644 index 47e07231..00000000 --- a/src/Pyramid-Bloc/PyramidLibraryViewForRoot.class.st +++ /dev/null @@ -1,20 +0,0 @@ -Class { - #name : #PyramidLibraryViewForRoot, - #superclass : #PyramidLibraryView, - #instVars : [ - 'addRootButton' - ], - #category : #'Pyramid-Bloc-plugin-library' -} - -{ #category : #'as yet unclassified' } -PyramidLibraryViewForRoot >> buttonAction [ - - self editor activeProject roots add: self list selectedItem blockMaker value -] - -{ #category : #private } -PyramidLibraryViewForRoot >> buttonLabel [ - - ^ 'Add new root' -] diff --git a/src/Pyramid-Bloc/PyramidLogo.class.st b/src/Pyramid-Bloc/PyramidLogo.class.st new file mode 100644 index 00000000..c294c7c5 --- /dev/null +++ b/src/Pyramid-Bloc/PyramidLogo.class.st @@ -0,0 +1,446 @@ +Class { + #name : #PyramidLogo, + #superclass : #Object, + #category : #'Pyramid-Bloc-utils' +} + +{ #category : #'pyramid-serialized-bloc' } +PyramidLogo class >> logoMedium [ + "This class has been generated using Pyramid. + + By: YannLEGOFF + 2023-08-07 13:52:07" + + + ^ '[ + BlElement { + #children : BlChildrenArray [ ], + #constraints : BlLayoutCommonConstraints { + #vertical : BlLayoutCommonConstraintsAxis { + #resizer : BlLayoutExactResizer { + #size : 50.0 + } + }, + #horizontal : BlLayoutCommonConstraintsAxis { + #resizer : @6 + }, + #position : Point [ 0, 0 ], + #margin : BlInsets { + #top : 0.0, + #left : 0.0, + #bottom : 0.0, + #right : 0.0 + }, + #padding : @9, + #minHeight : 0.0, + #minWidth : 0.0, + #maxHeight : Float [ #infinity ], + #maxWidth : @10, + #ignoredByLayout : false, + #accountTransformation : false + }, + #visuals : BlCustomVisuals { + #geometry : BlPolygonGeometry { + #extent : Point [ 50.0, 50.0 ], + #pathCache : BlPathCache { + #geometry : @12, + #strokedBounds : BlBounds { + #left : -0.5, + #top : -0.5, + #right : 30.5, + #bottom : 60.5 + } + }, + #vertices : [ + Point [ 0.0, 34.0 ], + Point [ 30.0, 60.0 ], + Point [ 30.0, 0.0 ] + ] + }, + #border : BlBorder { + #paint : BlColorPaint { + #color : Color [ #black ] + }, + #width : 1, + #style : BlStrokeStyle { + #lineCap : BlStrokeLineButtCap { }, + #lineJoin : BlStrokeLineMiterJoin { }, + #miterLimit : 4.0, + #dashArray : [ ], + #dashOffset : 0.0 + }, + #opacity : 1.0 + }, + #background : BlPaintBackground { + #paint : BlColorPaint { + #color : Color { + #red : 0.38807429130009774, + #green : 0.7800586510263929, + #blue : 0.38807429130009774, + #alpha : 1.0 + } + } + }, + #outskirts : BlOutskirtsCentered { } + }, + #userData : IdentityDictionary { + #elementId : BlElementNamedId { + #identifier : #C + } + }, + #layout : BlBasicLayout { } + }, + BlElement { + #children : BlChildrenArray [ ], + #constraints : BlLayoutCommonConstraints { + #vertical : BlLayoutCommonConstraintsAxis { + #resizer : @6 + }, + #horizontal : BlLayoutCommonConstraintsAxis { + #resizer : @6 + }, + #position : Point [ 0, 0 ], + #margin : @9, + #padding : @9, + #minHeight : 0.0, + #minWidth : 0.0, + #maxHeight : @10, + #maxWidth : @10, + #ignoredByLayout : false, + #accountTransformation : false + }, + #visuals : BlCustomVisuals { + #geometry : BlPolygonGeometry { + #extent : Point [ 50.0, 50.0 ], + #pathCache : BlPathCache { + #geometry : @41, + #strokedBounds : BlBounds { + #left : 29.5, + #top : -0.5, + #right : 70.5, + #bottom : 60.5 + } + }, + #vertices : [ + Point [ 70.0, 30.0 ], + Point [ 30.0, 60.0 ], + Point [ 30.0, 0.0 ] + ] + }, + #border : BlBorder { + #paint : BlColorPaint { + #color : @22 + }, + #width : 1, + #style : BlStrokeStyle { + #lineCap : @24, + #lineJoin : @25, + #miterLimit : 4.0, + #dashArray : @26, + #dashOffset : 0.0 + }, + #opacity : 1.0 + }, + #background : BlPaintBackground { + #paint : BlColorPaint { + #color : Color [ #white ] + } + }, + #outskirts : @30 + }, + #userData : IdentityDictionary { + #elementId : BlElementNamedId { + #identifier : #D + } + }, + #layout : @33 + } +]' +] + +{ #category : #'pyramid-serialized-bloc' } +PyramidLogo class >> logoOpenInPyramid [ + "This class has been generated using Pyramid. + + By: YannLEGOFF + 2023-07-31 13:52:21" + + + ^ '[ + BlElement { + #children : BlChildrenArray [ ], + #constraints : BlLayoutCommonConstraints { + #vertical : BlLayoutCommonConstraintsAxis { + #resizer : BlLayoutExactResizer { + #size : 50.0 + } + }, + #horizontal : BlLayoutCommonConstraintsAxis { + #resizer : @6 + }, + #position : Point [ 9.0, 8.0 ], + #margin : BlInsets { + #top : 0.0, + #left : 0.0, + #bottom : 0.0, + #right : 0.0 + }, + #padding : @9, + #minHeight : 0.0, + #minWidth : 0.0, + #maxHeight : Float [ #infinity ], + #maxWidth : @10, + #ignoredByLayout : false, + #accountTransformation : false + }, + #visuals : BlCustomVisuals { + #geometry : BlPolygonGeometry { + #extent : Point [ 50.0, 50.0 ], + #pathCache : BlPathCache { + #geometry : @12, + #strokedBounds : BlBounds { + #left : -0.5, + #top : -0.5, + #right : 30.5, + #bottom : 60.5 + } + }, + #vertices : [ + Point [ 0.0, 34.0 ], + Point [ 30.0, 60.0 ], + Point [ 30.0, 0.0 ] + ] + }, + #border : BlBorder { + #paint : BlColorPaint { + #color : Color [ #black ] + }, + #width : 1, + #style : BlStrokeStyle { + #lineCap : BlStrokeLineButtCap { }, + #lineJoin : BlStrokeLineMiterJoin { }, + #miterLimit : 4.0, + #dashArray : [ ], + #dashOffset : 0.0 + }, + #opacity : 1.0 + }, + #background : BlPaintBackground { + #paint : BlColorPaint { + #color : Color { + #red : 0.38807429130009774, + #green : 0.7800586510263929, + #blue : 0.38807429130009774, + #alpha : 1.0 + } + } + }, + #outskirts : BlOutskirtsCentered { }, + #elevation : BlRelativeElevation { + #elevation : 2 + } + }, + #userData : IdentityDictionary { + #elementId : BlElementNamedId { + #identifier : #logo1 + } + }, + #layout : BlBasicLayout { }, + #eventDispatcher : BlElementEventDispatcher { + #owner : @2, + #handlers : [ ] + } + }, + BlElement { + #children : BlChildrenArray [ ], + #constraints : BlLayoutCommonConstraints { + #vertical : BlLayoutCommonConstraintsAxis { + #resizer : @6 + }, + #horizontal : BlLayoutCommonConstraintsAxis { + #resizer : @6 + }, + #position : Point [ 9.0, 8.0 ], + #margin : @9, + #padding : @9, + #minHeight : 0.0, + #minWidth : 0.0, + #maxHeight : @10, + #maxWidth : @10, + #ignoredByLayout : false, + #accountTransformation : false + }, + #visuals : BlCustomVisuals { + #geometry : BlPolygonGeometry { + #extent : Point [ 50.0, 50.0 ], + #pathCache : BlPathCache { + #geometry : @44, + #strokedBounds : BlBounds { + #left : 29.5, + #top : -0.5, + #right : 70.5, + #bottom : 60.5 + } + }, + #vertices : [ + Point [ 70.0, 30.0 ], + Point [ 30.0, 60.0 ], + Point [ 30.0, 0.0 ] + ] + }, + #border : BlBorder { + #paint : BlColorPaint { + #color : @22 + }, + #width : 1, + #style : BlStrokeStyle { + #lineCap : @24, + #lineJoin : @25, + #miterLimit : 4.0, + #dashArray : @26, + #dashOffset : 0.0 + }, + #opacity : 1.0 + }, + #background : BlPaintBackground { + #paint : BlColorPaint { + #color : Color [ #white ] + } + }, + #outskirts : @30, + #elevation : BlRelativeElevation { + #elevation : 2 + } + }, + #userData : IdentityDictionary { + #elementId : BlElementNamedId { + #identifier : #logo2 + } + }, + #layout : @34, + #eventDispatcher : BlElementEventDispatcher { + #owner : @37, + #handlers : [ ] + } + }, + BlElement { + #children : BlChildrenArray [ ], + #constraints : BlLayoutCommonConstraints { + #vertical : BlLayoutCommonConstraintsAxis { + #resizer : BlLayoutExactResizer { + #size : 80.0 + } + }, + #horizontal : BlLayoutCommonConstraintsAxis { + #resizer : BlLayoutExactResizer { + #size : 260.0 + } + }, + #position : Point [ 0.0, 0.0 ], + #margin : BlInsets { + #top : 0.0, + #left : 0.0, + #bottom : 0.0, + #right : 0.0 + }, + #padding : @71, + #minHeight : 0.0, + #minWidth : 0.0, + #maxHeight : @10, + #maxWidth : @10, + #ignoredByLayout : false, + #accountTransformation : false + }, + #visuals : BlCustomVisuals { + #border : BlBorder { + #paint : BlColorPaint { + #color : @22 + }, + #width : 2, + #style : BlStrokeStyle { + #lineCap : BlStrokeLineButtCap { }, + #lineJoin : BlStrokeLineMiterJoin { }, + #miterLimit : 4.0, + #dashArray : [ ], + #dashOffset : 0.0 + }, + #opacity : 1.0 + }, + #background : BlPaintBackground { + #paint : BlLinearGradientPaint { + #stops : [ + 0 : Color { + #red : 0.855327468230694, + #green : 0.7644183773216031, + #blue : 0.42717497556207235, + #alpha : 1.0 + }, + 1 : Color { + #red : 0.9100684261974584, + #green : 0.8592375366568915, + #blue : 0.6549364613880743, + #alpha : 1.0 + } + ], + #start : Point [ 0, 0 ], + #end : Point [ 0.0, 80.0 ] + } + } + }, + #userData : IdentityDictionary { + #elementId : BlElementNamedId { + #identifier : #background + } + }, + #layout : BlBasicLayout { }, + #eventDispatcher : BlElementEventDispatcher { + #owner : @63, + #handlers : [ ] + } + }, + BlTextElement { + #children : BlChildrenArray [ ], + #constraints : BlLayoutCommonConstraints { + #vertical : BlLayoutCommonConstraintsAxis { + #resizer : BlLayoutFitContentResizer { } + }, + #horizontal : BlLayoutCommonConstraintsAxis { + #resizer : @95 + }, + #position : Point [ 92, 30 ], + #margin : @71, + #padding : @71, + #minHeight : 0.0, + #minWidth : 0.0, + #maxHeight : @10, + #maxWidth : @10, + #ignoredByLayout : false, + #accountTransformation : false + }, + #visuals : BlDefaultVisuals { }, + #userData : IdentityDictionary { + #elementId : BlElementNamedId { + #identifier : #label + } + }, + #layout : @88, + #text : BlRopedText { + #rope : BlAttributeRope { + #attributes : [ + BlFontSizeAttribute { + #isOverwritableByStyler : true, + #size : 20 + }, + BlFontWeightAttribute { + #isOverwritableByStyler : true, + #weight : 700 + } + ], + #rope : BlCollectionRope { + #collection : ''Open in Pyramid'' + } + } + } + } +]' +] diff --git a/src/Pyramid-Bloc/PyramidMainExtension.class.st b/src/Pyramid-Bloc/PyramidMainExtension.class.st new file mode 100644 index 00000000..cc8bdd13 --- /dev/null +++ b/src/Pyramid-Bloc/PyramidMainExtension.class.st @@ -0,0 +1,165 @@ +Class { + #name : #PyramidMainExtension, + #superclass : #Object, + #traits : 'TPyramidSpaceExtension + TPyramidEditorExtension + TPyramidProjectModelObserver + TPyramidEditorTransformationObserver', + #classTraits : 'TPyramidSpaceExtension classTrait + TPyramidEditorExtension classTrait + TPyramidProjectModelObserver classTrait + TPyramidEditorTransformationObserver classTrait', + #instVars : [ + 'containerElement', + 'projectModel', + 'borderElement', + 'sizeElement', + 'extentButton', + 'extentView', + 'extentPopover' + ], + #category : #'Pyramid-Bloc-plugin-space-extensions' +} + +{ #category : #accessing } +PyramidMainExtension >> borderElement [ + + ^ borderElement +] + +{ #category : #accessing } +PyramidMainExtension >> containerElement [ + + ^ containerElement +] + +{ #category : #accessing } +PyramidMainExtension >> defaultBorder [ + + ^ BlBorder paint: Color blue width: 1 +] + +{ #category : #accessing } +PyramidMainExtension >> defaultExtent [ + + ^ 800 @ 600 +] + +{ #category : #accessing } +PyramidMainExtension >> editor: aPyramidEditor [ + + aPyramidEditor window at: #topRight addItem: [ :buttonBuilder | + buttonBuilder makeButtonWithIcon: self extentButton order: 10 ] +] + +{ #category : #geometry } +PyramidMainExtension >> extent: aPoint [ + + self elementAtWidgets size: aPoint. + self sizeElement size: aPoint +] + +{ #category : #accessing } +PyramidMainExtension >> extentButton [ + + ^ extentButton +] + +{ #category : #'as yet unclassified' } +PyramidMainExtension >> informTransformationChanged [ + + self elementAtEvents transformDo: [ :t | + t translateBy: self currentTransformTranslation negated ]. +] + +{ #category : #initialization } +PyramidMainExtension >> initialize [ + + extentView := SpPresenter new + layout: (SpBoxLayout newVertical + spacing: 4; + add: (SpLabelPresenter new + displayBold: [ true ]; + label: 'Window extent'; + yourself); + add: (PyramidPointInputPresenter new + value: self defaultExtent; + whenValueChangedDo: [ :point | self extent: point ]; + yourself); + yourself); + yourself. + + extentButton := SpButtonPresenter new + icon: (self iconNamed: #window); + help: 'Project configuration'; + action: [ extentPopover popup ]; + yourself. + extentPopover := PyramidPopoverFactory + makeWithPresenter: extentView + relativeTo: extentButton + position: SpPopoverPosition left. + + + containerElement := BlElement new + constraintsDo: [ :c | + c vertical matchParent. + c horizontal matchParent ]; + clipChildren: false; + zIndex: 0; + yourself. + borderElement := BlElement new + border: self defaultBorder; + outskirts: BlOutskirts outside; + constraintsDo: [ :c | + c vertical matchParent. + c horizontal matchParent ]; + clipChildren: false; + zIndex: 1; + yourself. + sizeElement := BlElement new + size: self defaultExtent; + clipChildren: false; + addChildren: { + containerElement. + borderElement } yourself +] + +{ #category : #displaying } +PyramidMainExtension >> installOn: aBuilder [ + + self builder: aBuilder. + aBuilder addTransformationObserver: self. + self elementAtMain addChild: self sizeElement. + self elementAtTransforms transformDo: [ :t | + t translateBy: self offsetTranslation ]. + self builder signalTransformationChanged. + self elementAtWidgets size: self defaultExtent +] + +{ #category : #'as yet unclassified' } +PyramidMainExtension >> offsetTranslation [ + + ^ 50 @ 50 +] + +{ #category : #accessing } +PyramidMainExtension >> projectModel [ + + ^ projectModel +] + +{ #category : #accessing } +PyramidMainExtension >> projectModel: aProjectModel [ + + projectModel:= aProjectModel. + aProjectModel addObserver: self. +] + +{ #category : #'as yet unclassified' } +PyramidMainExtension >> pyramidRootsChanged [ + + self containerElement removeChildren. + (self projectModel roots asArray sorted: PyramidElevationSortFunction new) do: [ :each | + each parent ifNotNil: [ :p | p removeChild: each ]. + self containerElement addChild: each ] +] + +{ #category : #accessing } +PyramidMainExtension >> sizeElement [ + + ^ sizeElement +] diff --git a/src/Pyramid-Bloc/PyramidMarginCommand.class.st b/src/Pyramid-Bloc/PyramidMarginCommand.class.st new file mode 100644 index 00000000..74052cc3 --- /dev/null +++ b/src/Pyramid-Bloc/PyramidMarginCommand.class.st @@ -0,0 +1,17 @@ +Class { + #name : #PyramidMarginCommand, + #superclass : #PyramidAbstractBlocCommand, + #category : #'Pyramid-Bloc-plugin-bloc' +} + +{ #category : #'as yet unclassified' } +PyramidMarginCommand >> getValueFor: aBlElement [ + + ^ aBlElement margin +] + +{ #category : #'as yet unclassified' } +PyramidMarginCommand >> setValueFor: aBlElement with: anArgument [ + + aBlElement margin: anArgument +] diff --git a/src/Pyramid-Bloc/PyramidMenuExtension.class.st b/src/Pyramid-Bloc/PyramidMenuExtension.class.st new file mode 100644 index 00000000..a3923c5b --- /dev/null +++ b/src/Pyramid-Bloc/PyramidMenuExtension.class.st @@ -0,0 +1,88 @@ +Class { + #name : #PyramidMenuExtension, + #superclass : #Object, + #traits : 'TPyramidSpaceExtension + TPyramidEditorExtension', + #classTraits : 'TPyramidSpaceExtension classTrait + TPyramidEditorExtension classTrait', + #instVars : [ + 'menu', + 'projectModel' + ], + #category : #'Pyramid-Bloc-plugin-space-extensions' +} + +{ #category : #'as yet unclassified' } +PyramidMenuExtension >> backgroundColors [ + + ^ { + Color white. + Color gray. + Color black } +] + +{ #category : #accessing } +PyramidMenuExtension >> editor: aPyramidEditor [ + + self menu: (aPyramidEditor window services at: #selectionMenu) +] + +{ #category : #displaying } +PyramidMenuExtension >> installOn: aBuilder [ + + self builder: aBuilder. + + self elementAtDisplay background: Color gray. + + self elementAtEvents + when: BlSecondaryMouseUpEvent + do: [ :evt | self showMenuAt: evt ] +] + +{ #category : #accessing } +PyramidMenuExtension >> menu [ + + ^ menu +] + +{ #category : #accessing } +PyramidMenuExtension >> menu: anObject [ + + menu := anObject +] + +{ #category : #accessing } +PyramidMenuExtension >> projectModel [ + + ^ projectModel +] + +{ #category : #accessing } +PyramidMenuExtension >> projectModel: aProjectModel [ + + projectModel := aProjectModel +] + +{ #category : #accessing } +PyramidMenuExtension >> showMenuAt: anEvent [ + + | currentMenu chooseColorSubMenu | + self menu ifNil: [ ^ self ]. + self projectModel ifNil: [ ^ self ]. + currentMenu := self menu builder menuFor: self projectModel selection. + chooseColorSubMenu := SpMenuPresenter new. + self backgroundColors do: [ :color | + chooseColorSubMenu addItem: [ :item | + item + name: color printString; + action: [ self elementAtDisplay background: color ]; + icon: [ + self elementAtDisplay background paint color = color + ifTrue: [ self iconNamed: #testGreen ] + ifFalse: [ self iconNamed: #testNotRun ] ] ] ]. + + currentMenu addGroup: [ :group | + group addItem: [ :item | + item + name: 'Space backgorund color'; + subMenu: chooseColorSubMenu ] ]. + currentMenu openWithSpecAt: self currentHand position +] diff --git a/src/Pyramid-Bloc/PyramidMouseTransformExtension.class.st b/src/Pyramid-Bloc/PyramidMouseTransformExtension.class.st new file mode 100644 index 00000000..27799086 --- /dev/null +++ b/src/Pyramid-Bloc/PyramidMouseTransformExtension.class.st @@ -0,0 +1,62 @@ +Class { + #name : #PyramidMouseTransformExtension, + #superclass : #Object, + #traits : 'TPyramidSpaceExtension + TPyramidEditorExtension', + #classTraits : 'TPyramidSpaceExtension classTrait + TPyramidEditorExtension classTrait', + #instVars : [ + 'isDragging', + 'origin' + ], + #category : #'Pyramid-Bloc-plugin-space-extensions' +} + +{ #category : #initialization } +PyramidMouseTransformExtension >> initialize [ + + isDragging:= false. + origin := 0 @ 0. +] + +{ #category : #displaying } +PyramidMouseTransformExtension >> installOn: aBuilder [ + + self builder: aBuilder. + + self elementAtEvents when: BlMiddleMouseDownEvent do: [ :evt | + self origin: self currentTransformTranslation - evt position. + self isDragging: true ]. + + self elementAtEvents when: BlMouseMoveEvent do: [ :evt | + evt middleButtonPressed ifFalse: [ self isDragging: false ]. + self isDragging ifTrue: [ + self elementAtTransforms transformDo: [ :t | + t translateBy: evt position + self origin ]. + self builder signalTransformationChanged ] ]. + self elementAtEvents + when: BlMiddleMouseUpEvent + do: [ :evt | self isDragging: false ] +] + +{ #category : #accessing } +PyramidMouseTransformExtension >> isDragging [ + + ^ isDragging +] + +{ #category : #accessing } +PyramidMouseTransformExtension >> isDragging: anObject [ + + isDragging := anObject +] + +{ #category : #accessing } +PyramidMouseTransformExtension >> origin [ + + ^ origin +] + +{ #category : #accessing } +PyramidMouseTransformExtension >> origin: anObject [ + + origin := anObject +] diff --git a/src/Pyramid-Bloc/PyramidOverlay.class.st b/src/Pyramid-Bloc/PyramidOverlay.class.st deleted file mode 100644 index c17f6e6d..00000000 --- a/src/Pyramid-Bloc/PyramidOverlay.class.st +++ /dev/null @@ -1,84 +0,0 @@ -Class { - #name : #PyramidOverlay, - #superclass : #Object, - #instVars : [ - 'overlayElement', - 'nextOverlay', - 'name', - 'model' - ], - #category : #'Pyramid-Bloc-plugin-space' -} - -{ #category : #adding } -PyramidOverlay >> addNextOverlay: aPyramidOverlay [ - - self nextOverlay ifNotNil: [ Error signal: 'Overlay currently in use' ]. - self overlayElement addChild: aPyramidOverlay overlayElement. - self nextOverlay: aPyramidOverlay -] - -{ #category : #initialization } -PyramidOverlay >> initialize [ - - overlayElement := BlElement new - zIndex: 100; - yourself. - name := 'Anonymous overlay controller' -] - -{ #category : #accessing } -PyramidOverlay >> model [ - - ^ model -] - -{ #category : #accessing } -PyramidOverlay >> model: anObject [ - - model := anObject -] - -{ #category : #accessing } -PyramidOverlay >> name [ - - ^ name -] - -{ #category : #accessing } -PyramidOverlay >> name: anObject [ - - name := anObject -] - -{ #category : #accessing } -PyramidOverlay >> nextOverlay [ - - ^ nextOverlay -] - -{ #category : #accessing } -PyramidOverlay >> nextOverlay: anObject [ - - nextOverlay := anObject -] - -{ #category : #accessing } -PyramidOverlay >> overlayElement [ - - ^ overlayElement -] - -{ #category : #accessing } -PyramidOverlay >> overlayElement: anObject [ - - overlayElement := anObject -] - -{ #category : #adding } -PyramidOverlay >> removeNextOverlay [ - - self nextOverlay ifNil: [ Error signal: 'Overlay currently not in use' ]. - self overlayElement removeChild: self nextOverlay overlayElement. - self nextOverlay: nil -] diff --git a/src/Pyramid-Bloc/PyramidOverlayBuilder.class.st b/src/Pyramid-Bloc/PyramidOverlayBuilder.class.st deleted file mode 100644 index 5f4445a7..00000000 --- a/src/Pyramid-Bloc/PyramidOverlayBuilder.class.st +++ /dev/null @@ -1,274 +0,0 @@ -Class { - #name : #PyramidOverlayBuilder, - #superclass : #Object, - #instVars : [ - 'model', - 'overlay' - ], - #category : #'Pyramid-Bloc-plugin-space' -} - -{ #category : #'as yet unclassified' } -PyramidOverlayBuilder class >> fakeWindowBlock [ - - ^ [ :builder | - | windowDisplay | - builder - at: #size - subscribeWith: [ :size | - builder overlay overlayElement size: size ]. - - windowDisplay := BlElement new - constraintsDo: [ :c | - c horizontal matchParent. - c vertical matchParent ]; - background: BlBackground transparent; - border: (BlBorder paint: Color blue width: 1); - outskirts: BlOutskirts outside; - yourself. - builder - name: #fakeWindow; - constraintsSize: (builder at: #size); - clipChildren: false; - addElement: windowDisplay ] -] - -{ #category : #'as yet unclassified' } -PyramidOverlayBuilder class >> mousePositionBlock [ - - ^ [ :builder | - | textDisplay rope | - textDisplay := (builder at: #origin) asRopedText asElement. - textDisplay - background: Color white; - padding: (BlInsets top: 3). - builder - name: #mousePosition; - constraintsMatchParent; - clipChildren: false; - addElement: textDisplay; - addEventWhen: BlMouseMoveEvent do: [ :evt | - rope := (evt position - (builder at: #origin)) printString - asRopedText. - textDisplay text: rope ] ] -] - -{ #category : #'as yet unclassified' } -PyramidOverlayBuilder class >> movementMouseEventBlock [ - - ^ [ :builder | - | isDragging startPosition | - builder - name: #movementMouseEvent; - constraintsMatchParent; - clipChildren: false. - - isDragging := false. - startPosition := builder at: #origin. - builder addEventWhen: BlMouseDownEvent do: [ :evt | - evt middleButtonPressed ifTrue: [ - isDragging := true. - startPosition := evt position - (builder at: #origin) ] ]. - builder addEventWhen: BlMouseMoveEvent do: [ :evt | - evt middleButtonPressed - ifTrue: [ isDragging ifTrue: [ builder at: #origin put: evt position - startPosition ] ] - ifFalse: [ isDragging ifTrue: [ isDragging := false ] ] ]. - builder - addEventWhen: BlMouseUpEvent - do: [ :evt | - evt middleButtonPressed ifTrue: [ isDragging := false ] ] ] -] - -{ #category : #'as yet unclassified' } -PyramidOverlayBuilder class >> movementTransformationBlock [ - - ^ [ :builder | - builder - at: #origin - subscribeWith: [ :origin | - builder overlay overlayElement position: origin ]. - - builder - name: #movementTransformation; - constraintsMatchParent; - position: (builder at: #origin); - clipChildren: false ] -] - -{ #category : #'as yet unclassified' } -PyramidOverlayBuilder class >> movementWheelEventBlock [ - - ^ [ :builder | - | noKeyPressed shiftKeyPressed | - builder at: #keyboardPressed subscribeWith: [ :col | - noKeyPressed := col isEmpty. - shiftKeyPressed := col allSatisfy: [ :key | key isShift ] ]. - - builder - name: #movementWheelEvent; - constraintsMatchParent; - clipChildren: false. - - noKeyPressed := true. - shiftKeyPressed := false. - - builder addEventWhen: BlMouseWheelEvent do: [ :evt | - noKeyPressed - ifTrue: [ - builder - at: #origin - put: ((builder at: #origin) + (evt vector asPoint * 10)) ] - ifFalse: [ - shiftKeyPressed ifTrue: [ - builder - at: #origin - put: - (builder at: #origin) + (evt vector asPoint leftRotated * 10) ] ] ] ] -] - -{ #category : #'as yet unclassified' } -PyramidOverlayBuilder class >> selectionDisplayBlock [ - - ^ [ :builder | - | controller | - builder - name: #selectionDisplay; - constraintsMatchParent; - clipChildren: false. - controller := PyramidSelectionDisplayController new - overlay: builder overlay; - origin: (builder model at: #origin); - yourself. - builder - at: #origin - subscribeWith: [ :editor | controller updateOriginPreviews ]. - - builder - at: #editor - subscribeWith: [ :editor | - controller activeProject: editor activeProject. - controller pipeline: editor commandPipeline ] ] -] - -{ #category : #'as yet unclassified' } -PyramidOverlayBuilder class >> selectionMakerBlock [ - - ^ [ :builder | - | controller | - builder - name: #selectionMaker; - constraintsMatchParent; - clipChildren: false. - controller := PyramidSelectionMakerController new - overlay: builder overlay; - keyboardPressed: (builder at: #keyboardPressed); - yourself. - builder - at: #editor - subscribeWith: [ :editor | - controller updateEditor: editor ] ] -] - -{ #category : #'api - resizer' } -PyramidOverlayBuilder >> addElement: aBlElement [ - - self addElement: aBlElement atElevation: 200 -] - -{ #category : #'api - resizer' } -PyramidOverlayBuilder >> addElement: aBlElement atElevation: aNumber [ - - aBlElement zIndex: aNumber. - self overlay overlayElement addChild: aBlElement -] - -{ #category : #'api - resizer' } -PyramidOverlayBuilder >> addEventWhen: anEventClass do: aBlock [ - - self overlay overlayElement when: anEventClass do: aBlock -] - -{ #category : #accessing } -PyramidOverlayBuilder >> at: aKey [ - - ^ (self model at: aKey )object -] - -{ #category : #accessing } -PyramidOverlayBuilder >> at: aKey put: anObject [ - - (self model at: aKey) object: anObject -] - -{ #category : #accessing } -PyramidOverlayBuilder >> at: aKey subscribeWith: aBlock [ - - (self model - at: aKey) subcribe: self with: aBlock -] - -{ #category : #building } -PyramidOverlayBuilder >> build [ - - ^ self overlay -] - -{ #category : #'api - resizer' } -PyramidOverlayBuilder >> clipChildren: aBoolean [ - - self overlay overlayElement clipChildren: aBoolean -] - -{ #category : #'api - resizer' } -PyramidOverlayBuilder >> constraintsMatchParent [ - - self overlay overlayElement constraintsDo: [ :c | - c horizontal matchParent. - c vertical matchParent ] -] - -{ #category : #'api - resizer' } -PyramidOverlayBuilder >> constraintsSize: anExtent [ - - self overlay overlayElement constraintsDo: [ :c | - c horizontal exact: anExtent x. - c vertical exact: anExtent y ] -] - -{ #category : #initialization } -PyramidOverlayBuilder >> initialize [ - - overlay := PyramidOverlay new -] - -{ #category : #accessing } -PyramidOverlayBuilder >> model [ - - ^ model -] - -{ #category : #accessing } -PyramidOverlayBuilder >> model: anObject [ - - model := anObject. - self overlay model: anObject -] - -{ #category : #accessing } -PyramidOverlayBuilder >> name: aString [ - - self overlay name: aString. - self overlay overlayElement id: aString asSymbol -] - -{ #category : #building } -PyramidOverlayBuilder >> overlay [ - - ^ overlay -] - -{ #category : #'api - resizer' } -PyramidOverlayBuilder >> position: aPoint [ - - self overlay overlayElement position: aPoint -] diff --git a/src/Pyramid-Bloc/PyramidOverlayGlobalModelValue.class.st b/src/Pyramid-Bloc/PyramidOverlayGlobalModelValue.class.st deleted file mode 100644 index 93b0f363..00000000 --- a/src/Pyramid-Bloc/PyramidOverlayGlobalModelValue.class.st +++ /dev/null @@ -1,51 +0,0 @@ -Class { - #name : #PyramidOverlayGlobalModelValue, - #superclass : #Object, - #instVars : [ - 'callbacks', - 'object' - ], - #category : #'Pyramid-Bloc-plugin-space' -} - -{ #category : #accessing } -PyramidOverlayGlobalModelValue >> callbacks [ - - ^ callbacks -] - -{ #category : #initialization } -PyramidOverlayGlobalModelValue >> initialize [ - - callbacks := Dictionary new. -] - -{ #category : #accessing } -PyramidOverlayGlobalModelValue >> object [ - - ^ object -] - -{ #category : #accessing } -PyramidOverlayGlobalModelValue >> object: anObject [ - - object := anObject. - self triggerCallbacks -] - -{ #category : #'as yet unclassified' } -PyramidOverlayGlobalModelValue >> subcribe: anObject with: aBlock [ - - self callbacks at: anObject put: aBlock -] - -{ #category : #accessing } -PyramidOverlayGlobalModelValue >> triggerCallbacks [ - self callbacks valuesDo: [ :block | block value: self object ] -] - -{ #category : #'as yet unclassified' } -PyramidOverlayGlobalModelValue >> unsubcribe: anObject [ - - self callbacks remove: anObject -] diff --git a/src/Pyramid-Bloc/PyramidOverlaysManager.class.st b/src/Pyramid-Bloc/PyramidOverlaysManager.class.st deleted file mode 100644 index a6e70e64..00000000 --- a/src/Pyramid-Bloc/PyramidOverlaysManager.class.st +++ /dev/null @@ -1,140 +0,0 @@ -Class { - #name : #PyramidOverlaysManager, - #superclass : #Object, - #classTraits : 'TPyramidProjectModelObserver classTrait', - #instVars : [ - 'overlays', - 'frontLayer', - 'model', - 'space', - 'spaceLayer' - ], - #category : #'Pyramid-Bloc-plugin-space' -} - -{ #category : #adding } -PyramidOverlaysManager >> addOverlay: anOverlay [ - - self uninstallOverlays. - self overlays add: anOverlay. - self installOverlays -] - -{ #category : #adding } -PyramidOverlaysManager >> addOverlays: aCollection [ - - self uninstallOverlays. - self overlays addAll: aCollection. - self installOverlays -] - -{ #category : #accessing } -PyramidOverlaysManager >> frontLayer [ - - ^ frontLayer -] - -{ #category : #accessing } -PyramidOverlaysManager >> frontLayer: anObject [ - - self uninstallOverlays. - frontLayer := anObject. - self installOverlays. -] - -{ #category : #initialization } -PyramidOverlaysManager >> initialize [ - - self initializeSpace. - - overlays := OrderedCollection new. - - frontLayer := PyramidOverlay new. - frontLayer overlayElement - constraintsDo: [ :c | - c horizontal matchParent. - c vertical matchParent ]; - clipChildren: false -] - -{ #category : #initialization } -PyramidOverlaysManager >> initializeSpace [ - - space := BlSpace new. - spaceLayer := PyramidOverlay new. - spaceLayer overlayElement: space root. - space root constraintsDo: [ :c | - c horizontal matchParent. - c vertical matchParent ]. -] - -{ #category : #adding } -PyramidOverlaysManager >> installOverlays [ - - self overlays overlappingPairsDo: [ :each :next | - each addNextOverlay: next ]. - self overlays last addNextOverlay: self frontLayer. - self spaceLayer addNextOverlay: self overlays first -] - -{ #category : #accessing } -PyramidOverlaysManager >> model [ - - ^ model -] - -{ #category : #accessing } -PyramidOverlaysManager >> model: anObject [ - - model := anObject -] - -{ #category : #accessing } -PyramidOverlaysManager >> overlays [ - - ^ overlays -] - -{ #category : #accessing } -PyramidOverlaysManager >> overlays: anObject [ - - overlays := anObject -] - -{ #category : #initialization } -PyramidOverlaysManager >> resetSpace [ - - self space hide. - self uninstallOverlays. - self initializeSpace. - self installOverlays. - self space show -] - -{ #category : #accessing } -PyramidOverlaysManager >> space [ - - ^ space -] - -{ #category : #accessing } -PyramidOverlaysManager >> spaceLayer [ - - ^ spaceLayer -] - -{ #category : #accessing } -PyramidOverlaysManager >> spaceLayer: anObject [ - - self uninstallOverlays. - spaceLayer := anObject. - self installOverlays -] - -{ #category : #adding } -PyramidOverlaysManager >> uninstallOverlays [ - - self overlays ifEmpty: [ ^ self ]. - self spaceLayer removeNextOverlay. - self overlays do: [ :each | each removeNextOverlay ] -] diff --git a/src/Pyramid-Bloc/PyramidOverlaysManagerFactory.class.st b/src/Pyramid-Bloc/PyramidOverlaysManagerFactory.class.st deleted file mode 100644 index 407f9552..00000000 --- a/src/Pyramid-Bloc/PyramidOverlaysManagerFactory.class.st +++ /dev/null @@ -1,106 +0,0 @@ -Class { - #name : #PyramidOverlaysManagerFactory, - #superclass : #Object, - #instVars : [ - 'manager', - 'model' - ], - #category : #'Pyramid-Bloc-plugin-space' -} - -{ #category : #'as yet unclassified' } -PyramidOverlaysManagerFactory class >> editManager [ - - | factory | - factory := self new. - - factory at: #keyboardPressed put: Set new. - 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. - (factory model at: #keyboardPressed) triggerCallbacks ]. - factory manager space when: BlKeyUpEvent do: [ :evt | - (factory model at: #keyboardPressed) object remove: evt key. - (factory model at: #keyboardPressed) triggerCallbacks ]. - - factory addOverlays: { - PyramidOverlayBuilder mousePositionBlock. - PyramidOverlayBuilder selectionDisplayBlock. - PyramidOverlayBuilder movementWheelEventBlock. - PyramidOverlayBuilder movementMouseEventBlock. - PyramidOverlayBuilder selectionMakerBlock. - PyramidOverlayBuilder movementTransformationBlock. - PyramidOverlayBuilder fakeWindowBlock }. - - ^ factory manager -] - -{ #category : #tests } -PyramidOverlaysManagerFactory class >> testEditManager [ - -