Skip to content

Commit

Permalink
Merge pull request #9 from OpenSmock/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
labordep authored Jul 4, 2023
2 parents 200f79e + 0a86035 commit 4b2f51f
Show file tree
Hide file tree
Showing 29 changed files with 782 additions and 700 deletions.
9 changes: 5 additions & 4 deletions src/BaselineOfPyramid/BaselineOfPyramid.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ BaselineOfPyramid >> baseline: spec [
spec postLoadDoIt: #postload:package:.
self dependencies: spec.
spec
package: #Pyramid
with: [ spec requires: #( #BlocSerialization ) ];
package: #'Pyramid-Bloc' with: [ spec requires: #( #Pyramid #Bloc ) ];
package: #'Pyramid-Tests' with: [ spec requires: #( #Pyramid ) ] ]
package: #Pyramid with: [ spec requires: #( #BlocSerialization ) ];
package: #'Pyramid-Bloc'
with: [ spec requires: #( #Pyramid #Bloc ) ];
package: #'Pyramid-Tests' with: [ spec requires: #( #Pyramid ) ];
package: #'Pyramid-IDE' with: [ spec requires: #( #Pyramid ) ] ]
]

{ #category : #baselines }
Expand Down
93 changes: 0 additions & 93 deletions src/Pyramid-Bloc/PyramidBlocWindowForLayoutPresenter.class.st

This file was deleted.

185 changes: 185 additions & 0 deletions src/Pyramid-Bloc/PyramidBorderBuilderPresenter.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
Class {
#name : #PyramidBorderBuilderPresenter,
#superclass : #SpPresenter,
#instVars : [
'builder',
'buttonCaps',
'buttonJoins',
'paintInput',
'widthInput',
'previewCap',
'previewJoin'
],
#category : #'Pyramid-Bloc-custom-specs-border'
}

{ #category : #accessing }
PyramidBorderBuilderPresenter >> builder [

^ builder
]

{ #category : #accessing }
PyramidBorderBuilderPresenter >> buttonCaps [

^ buttonCaps
]

{ #category : #accessing }
PyramidBorderBuilderPresenter >> buttonJoins [

^ buttonJoins
]

{ #category : #layout }
PyramidBorderBuilderPresenter >> capsLayout [

| capsLayout |
capsLayout := SpBoxLayout newVertical
spacing: 4;
yourself.
self buttonCaps do: [ :each | capsLayout add: each expand: false ].
^ capsLayout
]

{ #category : #layout }
PyramidBorderBuilderPresenter >> defaultLayout [

^ SpBoxLayout newVertical
spacing: 4;
add: self previewPresenter expand: true;
add: self paintInput expand: false;
add: self widthInput expand: false;
add: (SpBoxLayout newHorizontal
spacing: 4;
add: self capsLayout;
add: self joinsLayout;
yourself);
yourself
]

{ #category : #initialization }
PyramidBorderBuilderPresenter >> initializeButtonCaps [

| round square butt |
round := SpRadioButtonPresenter new
label: 'cap round';
yourself.
square := SpRadioButtonPresenter new
label: 'cap square';
yourself.
butt := SpRadioButtonPresenter new
label: 'cap butt';
yourself.

round associatedRadioButtons: {
square.
butt }.
round whenActivatedDo: [ self builder capRound. self updatePreview ].
square whenActivatedDo: [ self builder capSquare. self updatePreview ].
butt whenActivatedDo: [ self builder capButt. self updatePreview ].

buttonCaps := {
round.
square.
butt }
]

{ #category : #initialization }
PyramidBorderBuilderPresenter >> initializeButtonJoins [

| bevel miter round |
bevel := SpRadioButtonPresenter new
label: 'join bevel';
yourself.
miter := SpRadioButtonPresenter new
label: 'join miter';
yourself.
round := SpRadioButtonPresenter new
label: 'join round';
yourself.

bevel associatedRadioButtons: {
miter.
round }.
bevel whenActivatedDo: [ self builder joinBevel. self updatePreview ].
miter whenActivatedDo: [ self builder joinMiter. self updatePreview ].
round whenActivatedDo: [ self builder joinRound. self updatePreview ].

buttonJoins := {
bevel.
miter.
round }
]

{ #category : #initialization }
PyramidBorderBuilderPresenter >> initializePresenters [

builder := BlBorderBuilder new
paint: Color black;
width: 1;
yourself.
paintInput := PyramidColorInputPresenter new
whenSubmitDo: [ :color |
self builder paint: color.
self updatePreview ];
yourself.
widthInput := PyramidNumberPresenter new
number: 1;
whenSubmitDo: [ :width |
self builder width: width.
self updatePreview ];
yourself.
previewCap := SpImagePresenter new.
previewJoin := SpImagePresenter new.
self initializeButtonCaps.
self initializeButtonJoins.
self updatePreview
]

{ #category : #layout }
PyramidBorderBuilderPresenter >> joinsLayout [

| joinsLayout |
joinsLayout := SpBoxLayout newVertical
spacing: 4;
yourself.
self buttonJoins do: [ :each | joinsLayout add: each expand: false ].
^ joinsLayout
]

{ #category : #accessing }
PyramidBorderBuilderPresenter >> paintInput [

^ paintInput
]

{ #category : #accessing }
PyramidBorderBuilderPresenter >> previewPresenter [

^ previewPresenter
]

{ #category : #actions }
PyramidBorderBuilderPresenter >> updatePreview [

| element |
element := BlElement new
geometry: (BlPolylineGeometry vertices: {
(0 @ 0).
(100 @ 0).
(50 @ 25).
(50 @ 50).
(0 @ 50) });
outskirts: BlOutskirts centered;
position: 10 @ 10;
border: self builder build;
yourself.
self previewPresenter image: element exportAsForm
]

{ #category : #accessing }
PyramidBorderBuilderPresenter >> widthInput [

^ widthInput
]
103 changes: 103 additions & 0 deletions src/Pyramid-Bloc/PyramidContextMenuPlugin.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
Class {
#name : #PyramidContextMenuPlugin,
#superclass : #Object,
#traits : 'TPyramidPlugin',
#classTraits : 'TPyramidPlugin classTrait',
#instVars : [
'editor'
],
#category : #'Pyramid-Bloc-plugin-context-menu'
}

{ #category : #'class initialization' }
PyramidContextMenuPlugin class >> initialize [

PyramidPluginManager uniqueInstance removePlugin: self.
PyramidPluginManager uniqueInstance addPlugin: self
]

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

aPyramidSimpleWindow at: #selectionMenu addItem: [ :builder |
self menuContextOn: builder.
self menuBrowseAndInspectOn: builder ]
]

{ #category : #'as yet unclassified' }
PyramidContextMenuPlugin >> connectOn: aPyramidEditor [

self editor: aPyramidEditor.
]

{ #category : #accessing }
PyramidContextMenuPlugin >> editor [

^ editor
]

{ #category : #accessing }
PyramidContextMenuPlugin >> editor: anObject [

editor := anObject
]

{ #category : #'as yet unclassified' }
PyramidContextMenuPlugin >> menuBrowseAndInspectOn: aBuilder [

aBuilder addGroupSingleSelection: [ :group :single |
group
addItem: [ :item |
item
icon: (self iconNamed: #nautilus);
name: 'Browse selected item';
action: [ single browse ];
yourself ];
addItem: [ :item |
item
icon: (self iconNamed: #smallInspectIt);
name: 'Inspect selected item';
action: [ single inspect ];
yourself ];
yourself ] order: 1.

aBuilder addGroupMultiSelection: [ :group :multi |
group
addItem: [ :item |
item
icon: (self iconNamed: #nautilus);
name: 'Browse first item';
action: [ multi first browse ];
yourself ];
addItem: [ :item |
item
icon: (self iconNamed: #smallInspectIt);
name: 'Inspect all items';
action: [ multi inspect ];
yourself ];
yourself ] order: 1
]

{ #category : #'as yet unclassified' }
PyramidContextMenuPlugin >> menuContextOn: aBuilder [

aBuilder addGroupSingleSelection: [ :group :single |
group
addItem: [ :item |
item
icon: (self iconNamed: single systemIconName);
name: single id asSymbol , ' ' , single hash printString;
enabled: false;
yourself ];
yourself ] order: 0.

aBuilder addGroupMultiSelection: [ :group :multi |
group
addItem: [ :item |
item
icon: (self iconNamed: #collection);
name: multi size printString , ' elements';
enabled: false;
yourself ];
yourself ] order: 0
]
Loading

0 comments on commit 4b2f51f

Please sign in to comment.