Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass on references to BlOSpace (removing them) #346

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ Extension { #name : #BlCompositeBackgroundTest }
BlCompositeBackgroundTest >> testAeApplyTo [

| space background blElement backgroundList |
space := BlOSpace new.
space := BlSpace new.

backgroundList := OrderedCollection with: (BlBackground paint: Color blue).
background := BlCompositeBackground withAll: backgroundList.
blElement := BlElement new background: background.
blElement := BlElement new background: background; yourself.
space root addChild: blElement.

space aeAsForm. "check no errors"
Expand Down
13 changes: 9 additions & 4 deletions src/Bloc-Alexandrie-Tests/BlSpaceBuilder.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,18 @@ BlSpaceBuilder >> initialize [

super initialize.

space := BlOSpace new.
space := BlSpace new.
spaceExtent := 100 asPoint.
host := BlOSWindowSDL2Host new.

random := Random seed: 7.
alphabetGenerator := Generator on: [ :generator |
alphabetGenerator := self newAlphabetGenerator
]

{ #category : #initialization }
BlSpaceBuilder >> newAlphabetGenerator [

^ Generator on: [ :generator |
| index |
index := 1.
[ Character alphabet do: [ :each |
Expand All @@ -150,8 +156,7 @@ BlSpaceBuilder >> initialize [
ifTrue: [ '' ]
ifFalse: [ index asString ].
generator yield: next, suffix ].
index := index + 1 ] repeat ].

index := index + 1 ] repeat ]
]

{ #category : #'instance creation' }
Expand Down
8 changes: 4 additions & 4 deletions src/Bloc-DevTool/BlDevHalosEventListenerExample.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ BlDevHalosEventListenerExample >> activatedHalos [
anEvent modifiers
alt: true;
shift: true.
BlOSpace simulateEvent: anEvent on: (aContainer childAt: 1).
BlSpace simulateEvent: anEvent on: (aContainer childAt: 1).

theNewElements := aSpace children asArray.
"self assert: theNewElements size equals: thePriorElements size + 1."
Expand Down Expand Up @@ -86,7 +86,7 @@ BlDevHalosEventListenerExample >> newSpace [

<sampleInstance>
| aSpace |
aSpace := BlOSpace new.
aSpace := BlSpace new.
aSpace host: BlHeadlessHost new.
aSpace title: 'Async Element Examples'.
aSpace extent: 600 @ 400.
Expand All @@ -96,14 +96,14 @@ BlDevHalosEventListenerExample >> newSpace [

{ #category : #utility }
BlDevHalosEventListenerExample >> putInSpace: aBlElement [

<sampleInstance>

| aSpace |
self
assert: [ aBlElement isNotNil ]
description: [ 'Element must be non-nil' ].
aSpace := self newSpace.
aSpace addChild: aBlElement.
aSpace root addChild: aBlElement.
^ aSpace
]

Expand Down
4 changes: 2 additions & 2 deletions src/Bloc-Examples/BlAnimationExamples.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ BlAnimationExamples class >> ballsAnim [
alp }.
els add: el ].

space := BlOSpace new.
space := BlSpace new.
space root addChildren: els.
space show.

Expand Down Expand Up @@ -88,7 +88,7 @@ BlAnimationExamples class >> sequential [
position: 100 @ 100.
element addAnimation: sequential.

space := BlOSpace new.
space := BlSpace new.
space root addChild: element.
space show
]
Expand Down
4 changes: 2 additions & 2 deletions src/Bloc-Examples/BlErrorHandlingExamples.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ BlErrorHandlingExamples >> sceneWith: aFaultyElement [

aContainer addChildren: { aLeftChild . aRightChild }.

aSpace := BlOSpace new.
aSpace := BlSpace new.
aSpace host: BlMorphicWindowHost new.
aSpace addChild: aContainer.
aSpace root addChild: aContainer.
aSpace show.
aSpace pulse.
aSpace close.
Expand Down
2 changes: 1 addition & 1 deletion src/Bloc-Examples/BlMouseProcessorExamples.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ BlMouseProcessorExamples >> mouseProcessor [
| aMouseProcessor aSpace |
<gtExample>

aSpace := BlOSpace new.
aSpace := BlSpace new.
aMouseProcessor := BlMouseProcessor space: aSpace.

self assert: aMouseProcessor space equals: aSpace.
Expand Down
15 changes: 11 additions & 4 deletions src/Bloc-Examples/BlSharedEventDistributorExamples.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ BlSharedEventDistributorExamples >> mouseEnterEventOneOutOfTwoElements [
anElementOne when: BlMouseEnterEvent do: [ aMouseEnterOne := aMouseEnterOne + 1 ].
anElementTwo when: BlMouseEnterEvent do: [ aMouseEnterTwo := aMouseEnterTwo + 1 ].

BlOSpace simulateMouseMoveInside: anElementOne.
BlSpace simulateMouseMoveInside: anElementOne.

self assert: aMouseEnterOne equals: 1.
self assert: aMouseEnterTwo equals: 1.
Expand All @@ -105,6 +105,7 @@ BlSharedEventDistributorExamples >> mouseEnterEventOneOutOfTwoElements [
{ #category : #'examples - sharing events' }
BlSharedEventDistributorExamples >> mouseLeaveEventOneOutOfTwoElements [
<gtExample>

| aHandler anElements aContainer aMouseLeaveTwo aMouseLeaveOne anElementOne anElementTwo |
aMouseLeaveOne := aMouseLeaveTwo := 0.
aHandler := self installTwoElements.
Expand All @@ -118,10 +119,16 @@ BlSharedEventDistributorExamples >> mouseLeaveEventOneOutOfTwoElements [
anElementOne when: BlMouseLeaveEvent do: [ aMouseLeaveOne := aMouseLeaveOne + 1 ].
anElementTwo when: BlMouseLeaveEvent do: [ aMouseLeaveTwo := aMouseLeaveTwo + 1 ].

BlOSpace
BlSpace
simulateEvents: {
BlMouseMoveEvent new position: (BlOSpace locationInside: anElementOne); screenPosition: 0@0.
BlMouseMoveEvent new position: (BlOSpace locationOutside: aContainer); screenPosition: 0@0 }
BlMouseMoveEvent new
position: (BlSpace locationInside: anElementOne);
screenPosition: 0@0;
yourself.
BlMouseMoveEvent new
position: (BlSpace locationOutside: aContainer);
screenPosition: 0@0;
yourself }
on: aContainer.

self assert: aMouseLeaveOne equals: 1.
Expand Down
6 changes: 4 additions & 2 deletions src/Bloc-Examples/BlSpaceEventExamples.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ BlSpaceEventExamples >> ignoreSpaceEventsAfterCloseRequest [
{ #category : #'instance creation' }
BlSpaceEventExamples >> space [
<gtExample>

^ BlOSpace new host: BlHeadlessHost new

^ BlSpace new
host: BlHeadlessHost new;
yourself
]

{ #category : #'show / close' }
Expand Down
2 changes: 1 addition & 1 deletion src/Bloc-Examples/BlTaskTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ BlTaskTest >> testAddElementWithTaskToSpace [

| anElement aSpace aTask |
anElement := self testAddTaskToTheElementWithoutSpace.
aSpace := BlOSpace new.
aSpace := BlSpace new.
aSpace root addChild: anElement.
"task were moved to the space"
self assert: anElement taskQueue tasks isEmpty.
Expand Down
6 changes: 4 additions & 2 deletions src/Bloc-Examples/TBlExample.trait.st
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ Trait {
{ #category : #opening }
TBlExample classSide >> openInWindow: anElement named: aTitleString extent: aPoint [
"Open a given element in a window of a provided extent and specified title"

| aSpace |
aSpace := BlOSpace new
aSpace := BlSpace new
extent: aPoint;
title: aTitleString.
title: aTitleString;
yourself.

aSpace root background: self spaceBackground.
aSpace root addChild: anElement.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@ BlFlowLayoutCompositionSmokeTest class >> exampleText [

{ #category : #examples }
BlFlowLayoutCompositionSmokeTest class >> floatingCells [
| aSpace |
<script: 'self floatingCells'>

aSpace := BlOSpace new.
| aSpace |
aSpace := BlSpace new.
aSpace root addChild: self new floatingCells.
aSpace root addEventHandler:
(BlEventHandler
Expand Down
10 changes: 6 additions & 4 deletions src/Bloc-Scripter/BlDevScripter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,12 @@ BlDevScripter >> continue [

{ #category : #initialization }
BlDevScripter >> defaultSpace [

^ BlOSpace new
title: 'Scripter';
extent: 800 @ 600;
host: BlMockedHost new.
host: BlMockedHost new;
yourself.
]

{ #category : #'accessing - element' }
Expand Down Expand Up @@ -181,7 +183,7 @@ BlDevScripter >> showSpace [

{ #category : #'accessing - space' }
BlDevScripter >> space [
<return: #BlOSpace>

^ space
]

Expand All @@ -192,10 +194,10 @@ BlDevScripter >> spaceTasks [

{ #category : #'accessing - space' }
BlDevScripter >> spaceWithElement [
"Return ${class:BlSpace}$ and ensure that the ==element== is its child
"Return a space and ensure that the element is its child
Useful when someone wants to display the resulting space (window) with the element.
It cannot be used during the script execution."
<return: #BlOSpace>

self element space = self space ifFalse: [
self space addChild: self elementWithoutParent ].
^ self space
Expand Down
2 changes: 1 addition & 1 deletion src/Bloc-Scripter/BlDevScripterClickStep.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ BlDevScripterClickStep >> omitDoubleClickOn: aScripter [
BlDevScripterClickStep >> playOn: aScripter [
self omitDoubleClickOn: aScripter.
self
setMousePosition: (BlOSpace simulateClickOn: (self target findTargetStartingInScripter: aScripter))
setMousePosition: (BlSpace simulateClickOn: (self target findTargetStartingInScripter: aScripter))
in: aScripter.

aScripter pulse
Expand Down
4 changes: 2 additions & 2 deletions src/Bloc-Scripter/BlDevScripterDoubleClickStep.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ BlDevScripterDoubleClickStep >> defaultLabel [

{ #category : #actions }
BlDevScripterDoubleClickStep >> playOn: aScripter [
BlOSpace simulateClickOn: (self target findTargetStartingInScripter: aScripter).
BlOSpace simulateClickOn: (self target findTargetStartingInScripter: aScripter).
BlSpace simulateClickOn: (self target findTargetStartingInScripter: aScripter).
BlSpace simulateClickOn: (self target findTargetStartingInScripter: aScripter).
aScripter pulse
]
4 changes: 2 additions & 2 deletions src/Bloc-Scripter/BlDevScripterKeyClickStep.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ BlDevScripterKeyClickStep >> defaultLabel [

{ #category : #actions }
BlDevScripterKeyClickStep >> playOn: aScripter [
BlOSpace simulateKeyDownOn: aScripter element key: self key.
BlOSpace simulateKeyUpOn: aScripter element key: self key.
BlSpace simulateKeyDownOn: aScripter element key: self key.
BlSpace simulateKeyUpOn: aScripter element key: self key.
aScripter pulse
]
2 changes: 1 addition & 1 deletion src/Bloc-Scripter/BlDevScripterKeyDownStep.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ BlDevScripterKeyDownStep >> defaultLabel [

{ #category : #actions }
BlDevScripterKeyDownStep >> playOn: aScripter [
BlOSpace simulateKeyDownOn: aScripter element key: self key.
BlSpace simulateKeyDownOn: aScripter element key: self key.
aScripter pulse
]
2 changes: 1 addition & 1 deletion src/Bloc-Scripter/BlDevScripterKeyUpStep.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ BlDevScripterKeyUpStep >> defaultLabel [

{ #category : #actions }
BlDevScripterKeyUpStep >> playOn: aScripter [
BlOSpace simulateKeyUpOn: aScripter element key: self key.
BlSpace simulateKeyUpOn: aScripter element key: self key.
aScripter pulse
]
2 changes: 1 addition & 1 deletion src/Bloc-Scripter/BlDevScripterMouseDownStep.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ BlDevScripterMouseDownStep >> defaultLabel [

{ #category : #actions }
BlDevScripterMouseDownStep >> playOn: aScripter [
BlOSpace simulateMouseDownOn: aScripter element at: (self getMousePositionIn: aScripter).
BlSpace simulateMouseDownOn: aScripter element at: (self getMousePositionIn: aScripter).
aScripter pulse
]
2 changes: 1 addition & 1 deletion src/Bloc-Scripter/BlDevScripterMouseMoveOverStep.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ BlDevScripterMouseMoveOverStep >> playOn: aScripter [

self setMousePosition: aNewPosition in: aScripter.

BlOSpace simulateMouseMoveOn: aScripter element from: anOldPositon to: aNewPosition.
BlSpace simulateMouseMoveOn: aScripter element from: anOldPositon to: aNewPosition.
aScripter pulse
]
2 changes: 1 addition & 1 deletion src/Bloc-Scripter/BlDevScripterMouseMoveStep.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ BlDevScripterMouseMoveStep >> playOn: aScripter [

self setMousePosition: aNewPosition in: aScripter.

BlOSpace simulateMouseMoveOn: aScripter element from: anOldPositon to: aNewPosition.
BlSpace simulateMouseMoveOn: aScripter element from: anOldPositon to: aNewPosition.
aScripter pulse
]
2 changes: 1 addition & 1 deletion src/Bloc-Scripter/BlDevScripterMouseUpStep.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ BlDevScripterMouseUpStep >> defaultLabel [

{ #category : #actions }
BlDevScripterMouseUpStep >> playOn: aScripter [
BlOSpace simulateMouseUpOn: aScripter element at: (self getMousePositionIn: aScripter).
BlSpace simulateMouseUpOn: aScripter element at: (self getMousePositionIn: aScripter).
aScripter pulse
]
2 changes: 1 addition & 1 deletion src/Bloc-Scripter/BlDevScripterMouseWheelStep.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ BlDevScripterMouseWheelStep >> playOn: aScripter [
aTarget := self target findTargetStartingInScripter: aScripter.

self
setMousePosition: (BlOSpace simulateMouseWheelOn: aTarget by: self vector)
setMousePosition: (BlSpace simulateMouseWheelOn: aTarget by: self vector)
in: aScripter.

aScripter pulse
Expand Down
2 changes: 1 addition & 1 deletion src/Bloc-Scripter/BlDevScripterSecondaryClickStep.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ BlDevScripterSecondaryClickStep >> defaultLabel [
{ #category : #actions }
BlDevScripterSecondaryClickStep >> playOn: aScripter [
self
setMousePosition: (BlOSpace simulateSecondaryClickOn: (self target findTargetStartingInScripter: aScripter))
setMousePosition: (BlSpace simulateSecondaryClickOn: (self target findTargetStartingInScripter: aScripter))
in: aScripter.
aScripter pulse
]
2 changes: 1 addition & 1 deletion src/Bloc-Scripter/BlDevScripterTypeTextStep.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ BlDevScripterTypeTextStep >> playOn: aScripter [
anInputEvent := BlTextInputEvent new
text: self text.

BlOSpace
BlSpace
simulateEvent: anInputEvent
on: aTarget.

Expand Down
15 changes: 8 additions & 7 deletions src/Bloc-Spec2/SpBlSpaceInMorphPresenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,13 @@ SpBlSpaceInMorphPresenter class >> example [
layout: BlFlowLayout horizontal.

50 timesRepeat: [
aSpace addChild: (BlElement new
background: Color random translucent;
addEventHandlerOn: BlMouseEnterEvent
do: [ :evt | evt target
background: Color random ];
yourself) ].
aSpace root addChild:
(BlElement new
background: Color random translucent;
addEventHandlerOn: BlMouseEnterEvent
do: [ :evt | evt target
background: Color random ];
yourself) ].

spacePresenter open.

Expand All @@ -62,7 +63,7 @@ SpBlSpaceInMorphPresenter >> initializePresenters [
yourself);
yourself.

space := BlOSpace new
space := BlSpace new
host: (BlMorphicHost new
containerMorph: morphPresenter morph;
yourself);
Expand Down
2 changes: 1 addition & 1 deletion src/Bloc-Tests/BlElementTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ BlElementTest >> setUp [

super setUp.

space := BlOSpace new.
space := BlSpace new.
host := BlMockedHost new.

space host: host.
Expand Down
Loading
Loading