Skip to content

Commit 15e74a4

Browse files
authored
Add #isSettledIn: on space phases + Adopt Bloc's #deferAndSettle: (#401)
1 parent f4a9f53 commit 15e74a4

104 files changed

Lines changed: 4441 additions & 4881 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/Toplo-Demo/ToDemoPresenter.class.st

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,15 @@ ToDemoPresenter class >> demo3 [
5959
{
6060
ToRawTheme.
6161
ToRawDarkTheme } do: [ :themeClass |
62-
containerElement addChild: (ToRadioButton new
62+
containerElement addChild:
63+
(ToRadioButton new
6364
labelText: themeClass label;
6465
in: [ :rad | rad userData at: #themeClass put: themeClass ];
6566
yourself) ].
6667

6768
containerElement groupCheckAction: [ :evt |
68-
containerElement space toTheme:
69-
(evt checkedList anyOne userData at: #themeClass) new ].
69+
containerElement space toTheme:
70+
(evt checkedList anyOne userData at: #themeClass) new ].
7071

7172
containerElement children second checked: true.
7273

@@ -94,8 +95,8 @@ ToDemoPresenter class >> open [
9495
{ #category : #private }
9596
ToDemoPresenter >> drawOnCanvas: anElement [
9697

97-
self canva space toTheme: ToRawTheme new.
98-
super drawOnCanvas: anElement.
98+
self canvas space toTheme: ToRawTheme new.
99+
super drawOnCanvas: anElement
99100
]
100101

101102
{ #category : #accessing }

src/Toplo-Demo/ToSkinDemoStyleSheetTest.class.st

Lines changed: 19 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ ToSkinDemoStyleSheetTest >> testRuleBackgroundDependsOnParentOrChildren [
6060
position: 150 @ 50.
6161
childElem := ToElement new.
6262
parentElem addChild: childElem.
63-
space toTheme: theme.
64-
space root addChild: elem.
65-
space root addChild: parentElem.
66-
self waitTestingSpaces.
63+
space deferAndSettle: [
64+
space toTheme: theme.
65+
space root addChild: elem.
66+
space root addChild: parentElem ].
6767
self assert: elem background paint color equals: Color red.
6868
self assert: parentElem background paint color equals: Color blue.
6969
self assert: childElem background paint color equals: Color green
@@ -112,9 +112,9 @@ ToSkinDemoStyleSheetTest >> testRuleBackgroundDependsOnSibling [
112112
sibling1.
113113
sibling2 }.
114114

115-
space toTheme: theme.
116-
space root addChild: container.
117-
self waitTestingSpaces.
115+
space deferAndSettle: [
116+
space toTheme: theme.
117+
space root addChild: container ].
118118
self assert: sibling1 background paint color equals: Color blue.
119119
self assert: sibling2 background paint color equals: Color green.
120120
self assert: container background paint color equals: Color red
@@ -168,27 +168,18 @@ ToSkinDemoStyleSheetTest >> testRuleBackgroundDependsOnSizeWithActionBlock [
168168
extent: 100 asPoint;
169169
position: 150 asPoint.
170170

171-
space root addChild: elem.
172-
space root addChild: verticalElem.
173-
space root addChild: horizontalElem.
174-
space root addChild: biggerElem.
175-
176-
assertsTested := false.
177-
space root whenLayoutedDoOnce: [
178-
assertsTested := true.
179-
space toTheme: theme.
180-
self waitTestingSpaces.
181-
self assert: elem background paint color equals: Color green.
182-
self
183-
assert: verticalElem background paint color
184-
equals: Color yellow.
185-
self
186-
assert: horizontalElem background paint color
187-
equals: Color blue.
188-
self assert: biggerElem background paint color equals: Color red ].
189-
190-
space root forceLayout.
191-
self assert: assertsTested
171+
space deferAndSettle: [
172+
space root addChild: elem.
173+
space root addChild: verticalElem.
174+
space root addChild: horizontalElem.
175+
space root addChild: biggerElem ].
176+
177+
space deferAndSettle: [ space toTheme: theme ].
178+
179+
self assert: elem background paint color equals: Color green.
180+
self assert: verticalElem background paint color equals: Color yellow.
181+
self assert: horizontalElem background paint color equals: Color blue.
182+
self assert: biggerElem background paint color equals: Color red
192183
]
193184

194185
{ #category : #tests }

src/Toplo-Examples/ToExWorkspace.class.st

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Class {
1515
ToExWorkspace class >> open [
1616

1717
<script>
18-
self openInHost: BlOSWindowSDL2Host new
18+
self openInHost: BlOSWindowSDL2Host default
1919
]
2020

2121
{ #category : #'instance creation' }
@@ -33,14 +33,14 @@ ToExWorkspace class >> openInHost: aBlOSWindowHost [
3333
ToExWorkspace class >> openInMorphic [
3434

3535
<script>
36-
self openInHost: BlMorphicWindowHost new
36+
self openInHost: BlMorphicWindowHost default
3737
]
3838

3939
{ #category : #'instance creation' }
4040
ToExWorkspace class >> openInSDL [
4141

4242
<script>
43-
self openInHost: BlOSWindowSDL2Host new
43+
self openInHost: BlOSWindowSDL2Host default
4444
]
4545

4646
{ #category : #binding }

src/Toplo-Examples/ToExperiments.class.st

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -697,8 +697,7 @@ ToExperiments class >> example_PasteUpWithPlaceHolder [
697697
event consume ].
698698
blue addEventHandlerOn: BlDragEvent do: [ :event |
699699
event consume.
700-
blue position: event position - pblue.
701-
blue forceLayout ].
700+
blue position: event position - pblue ].
702701
blue addEventHandlerOn: BlDragEndEvent do: [ :event | event consume ].
703702

704703
blue
@@ -1621,7 +1620,6 @@ ToExperiments class >> example_twoChildrenMatchParentInFitContent [
16211620
c vertical matchParent ].
16221621
parent addChild: child.
16231622
parent addChild: child2.
1624-
parent forceLayout.
16251623
^ parent openInSpace
16261624
]
16271625

src/Toplo-Examples/ToExperimentsMockTest.class.st

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,7 @@ Class {
77
{ #category : #tests }
88
ToExperimentsMockTest >> closeWindows [
99

10-
{
11-
BlOSWindowSDL2Host.
12-
BlMorphicWindowHost } do: [ :host |
13-
host universe closeSpaces.
14-
host
15-
stop;
16-
start ].
17-
BlSpace allInstances do: [ :each | each close ].
18-
BlParallelUniverse all do: [ :each | each closeSpaces ]
10+
Toplo closeSpaces
1911
]
2012

2113
{ #category : #tests }

src/Toplo-Examples/ToFiniteListElementStresserWithActionMethods.class.st

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ ToFiniteListElementStresserWithActionMethods >> processBlock [
171171
self maxRound timesRepeat: [
172172
round := round + 1.
173173
self selectActionsToRun shuffled do: [ :act |
174-
list inUIProcessDo: [ self perform: act with: list ] ] ].
174+
list deferOrValue: [ self perform: act with: list ] ] ].
175175
endTime := DateAndTime now.
176176
(endTime - startTime) asDuration traceCr ]
177177
]

src/Toplo-Examples/ToListElementStresser.class.st

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ ToListElementStresser class >> run [
3131
ToListElementStresser class >> runInSDL [
3232

3333
<script>
34-
self new runInHost: BlOSWindowSDL2Host new
34+
self new runInHost: BlOSWindowSDL2Host default
3535
]
3636

3737
{ #category : #actions }

src/Toplo-Examples/ToListElementStresserWithAdditionalSelecters.class.st

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ ToListElementStresserWithAdditionalSelecters class >> run [
2222
ToListElementStresserWithAdditionalSelecters class >> runInSDL [
2323

2424
<script>
25-
self new runInHost: BlOSWindowSDL2Host new
25+
self new runInHost: BlOSWindowSDL2Host default
2626
]
2727

2828
{ #category : #actions }

src/Toplo-Examples/ToSandBox.class.st

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3396,9 +3396,10 @@ ToSandBox class >> example_ListWithAllClassesAndTraitsSorted [
33963396
| l vscrollBar space |
33973397
l := ToListElement new nodeBuilder: [ :node :dataItem :holder |
33983398
node ensureCanManageToploSkin.
3399-
node addChild: (ToClassNameViewExamplePart new
3400-
class: dataItem position: holder position;
3401-
yourself) ].
3399+
node addChild:
3400+
(ToClassNameViewExamplePart new
3401+
class: dataItem position: holder position;
3402+
yourself) ].
34023403
l withRowNumbers.
34033404
l dataAccessor addAll:
34043405
(Smalltalk allClassesAndTraits sorted: [ :a :b | a name < b name ]).
@@ -3692,7 +3693,6 @@ ToSandBox class >> example_Menu2 [
36923693

36933694
{ #category : #menu }
36943695
ToSandBox class >> example_Menu3 [
3695-
<demo>
36963696

36973697
| container |
36983698
container := ToElement new matchParent.
@@ -6137,7 +6137,6 @@ ToSandBox class >> example_ToggleButtonInListElement [
61376137

61386138
space := BlSpace new.
61396139
space root addChild: moveListElement.
6140-
space pulse.
61416140
space resizable: true.
61426141
space show
61436142
]
@@ -7141,7 +7140,7 @@ ToSandBox class >> example_hugePane [
71417140
space root addChild: pane.
71427141
space show.
71437142

7144-
space root inUIProcessDo: [
7143+
space root deferOrValue: [
71457144
1 to: 100 do: [ :i |
71467145
| label button |
71477146
label := 'Button ' , i asString.

src/Toplo-Examples/ToSandBoxMockTest.class.st

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,7 @@ Class {
77
{ #category : #tests }
88
ToSandBoxMockTest >> closeWindows [
99

10-
{
11-
BlOSWindowSDL2Host.
12-
BlMorphicWindowHost } do: [ :host |
13-
host universe closeSpaces.
14-
host
15-
stop;
16-
start ].
17-
BlSpace allInstances do: [ :each | each close ].
18-
BlParallelUniverse all do: [ :each | each closeSpaces ]
10+
Toplo closeSpaces
1911
]
2012

2113
{ #category : #tests }

0 commit comments

Comments
 (0)