-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from OpenSmock/dev
Dev
- Loading branch information
Showing
29 changed files
with
782 additions
and
700 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 0 additions & 93 deletions
93
src/Pyramid-Bloc/PyramidBlocWindowForLayoutPresenter.class.st
This file was deleted.
Oops, something went wrong.
185 changes: 185 additions & 0 deletions
185
src/Pyramid-Bloc/PyramidBorderBuilderPresenter.class.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
] |
Oops, something went wrong.