Skip to content

Commit 343b639

Browse files
committed
Simplifies the creation of annotation morphs, thereby removes another stray border, increases padding for annotation morphs
1 parent 7717162 commit 343b639

File tree

8 files changed

+61
-70
lines changed

8 files changed

+61
-70
lines changed

packages/Babylonian-UI.package/BPAnnotationMorph.class/instance/initialize.st

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ initialize
1010
listDirection: #leftToRight;
1111
hResizing: #shrinkWrap;
1212
vResizing: #shrinkWrap;
13-
layoutInset: 1.
13+
cellInset: 2;
14+
layoutInset: 2.

packages/Babylonian-UI.package/BPAnnotationMorph.class/methodProperties.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"iconSize" : "pre 7/24/2019 13:18",
2323
"id" : "pre 7/2/2019 16:38",
2424
"id:" : "pre 7/2/2019 16:38",
25-
"initialize" : "pre 10/6/2020 17:20",
25+
"initialize" : "pre 10/8/2020 11:33",
2626
"isAssertion" : "pre 7/3/2019 11:11",
2727
"isBPAnnotationMorph" : "pre 7/3/2019 11:10",
2828
"isExample" : "pre 7/23/2019 12:47",
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
accessing
22
annotation: anObject
3-
3+
44
super annotation: anObject.
5-
self updateFrom: self emptyTraces.
5+
self updateAssertionFieldsMorph.

packages/Babylonian-UI.package/BPAssertionMorph.class/instance/initialize.st

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ initialization
22
initialize
33

44
super initialize.
5-
self listDirection: #leftToRight.
5+
self listDirection: #leftToRight.
6+
self updateAssertionFieldsMorph.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
private - ui
2+
updateAssertionFieldsMorph
3+
4+
| assertionScript assertionScriptMorph exampleSelectionMorph |
5+
assertionFieldsMorph ifNotNil: [assertionFieldsMorph abandon].
6+
assertionFieldsMorph := Morph new
7+
color: Color transparent;
8+
changeTableLayout;
9+
cellPositioning: #topLeft;
10+
listDirection: #leftToRight;
11+
hResizing: #shrinkWrap;
12+
vResizing: #shrinkWrap;
13+
yourself.
14+
15+
assertionScript := self annotation ifNil: [''] ifNotNil: [:a | a assertion asString].
16+
assertionScript := assertionScript copyFrom: 2 to: (assertionScript size - 1 max: 1). "Removes the square brackets"
17+
assertionScriptMorph := self
18+
editFieldInitialContent: assertionScript
19+
onChange: [:str |
20+
self annotation assertion: ('[{1}]' format: {str}).
21+
self codeContentChanged]
22+
onAccept: [:str |
23+
self containingBrowser codeTextMorph accept].
24+
25+
exampleSelectionMorph := BPSelectFieldMorph new
26+
optionsBlock: [
27+
{BPExampleSpecificScript allExamplesName} ,
28+
(SystemNavigation default allExamples collect: [:e | e uniqueIdentifier])];
29+
model: (BPObjectValueModel new
30+
object: (self annotation ifNotNil: [:a | a exampleName] ifNil: ['']);
31+
onChangeBlock: [:exampleName |
32+
self annotation exampleName: exampleName.
33+
self codeContentChanged]);
34+
yourself.
35+
36+
assertionFieldsMorph
37+
addMorphBack: assertionScriptMorph;
38+
addMorphBack: exampleSelectionMorph.
39+
40+
41+
widgetsMorph addMorphBack: assertionFieldsMorph.
Lines changed: 8 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,16 @@
11
private
22
updateFrom: traces
33

4-
| assertionScriptMorph assertionScript exampleSelectionMorph removeButton editFieldsMorph tracesMorph |
5-
self removeAllMorphs.
6-
7-
editFieldsMorph := Morph new
8-
color: Color transparent;
9-
changeTableLayout;
10-
cellPositioning: #topLeft;
11-
listDirection: #leftToRight;
12-
hResizing: #shrinkWrap;
13-
vResizing: #shrinkWrap;
14-
yourself.
15-
16-
widgetsMorph := Morph new
17-
color: Color transparent;
18-
changeTableLayout;
19-
cellPositioning: #topLeft;
20-
listDirection: #topToBottom;
21-
hResizing: #shrinkWrap;
22-
vResizing: #shrinkWrap;
23-
yourself.
24-
25-
assertionScript := self annotation ifNil: [''] ifNotNil: [:a | a assertion asString].
26-
assertionScript := assertionScript copyFrom: 2 to: (assertionScript size - 1 max: 1). "Removes the square brackets"
27-
assertionScriptMorph := self
28-
editFieldInitialContent: assertionScript
29-
onChange: [:str |
30-
self annotation assertion: ('[{1}]' format: {str}).
31-
self codeContentChanged]
32-
onAccept: [:str |
33-
self containingBrowser codeTextMorph accept].
34-
35-
exampleSelectionMorph := BPSelectFieldMorph new
36-
optionsBlock: [
37-
{BPExampleSpecificScript allExamplesName} ,
38-
(SystemNavigation default allExamples collect: [:e | e uniqueIdentifier])];
39-
model: (BPObjectValueModel new
40-
object: (self annotation ifNotNil: [:a | a exampleName] ifNil: ['']);
41-
onChangeBlock: [:exampleName |
42-
self annotation exampleName: exampleName.
43-
self codeContentChanged]);
44-
yourself.
45-
46-
removeButton := self newRemoveButton.
47-
48-
self
49-
addMorphBack: widgetsMorph;
50-
addMorphBack: removeButton.
51-
52-
editFieldsMorph
53-
addMorphBack: assertionScriptMorph;
54-
addMorphBack: exampleSelectionMorph.
55-
widgetsMorph addMorphBack: editFieldsMorph.
4+
| scrollPane |
5+
tracesMorph removeAllMorphs.
566

577
"Now to the results"
58-
tracesMorph := self newTracesMorph.
598
self relevantTracesOf: traces do: [:t | | lineMorph valuesMorph |
60-
lineMorph := self newExampleLineMorph.
61-
lineMorph addMorphBack: (self newExampleLabelMorphFor: t).
62-
valuesMorph := self newExampleLineMorph.
9+
lineMorph := self ensureLineMorphFor: t.
10+
scrollPane := (lineMorph submorphNamed: #scrollWrapper) submorphNamed: #scrollPane.
11+
scrollPane scroller removeAllMorphs.
6312

13+
valuesMorph := self newExampleLineMorph.
6414
(t resultsForAssertionId: self annotation id)
6515
ifEmpty: [lineMorph addMorphBack: ToolIcons testGray asMorph]
6616
ifNotEmpty: [:results |
@@ -72,9 +22,6 @@ updateFrom: traces
7222
after it wrapped around its submorphs"
7323
valuesMorph layoutChanged; fullBounds.
7424

75-
valuesMorph := self checkAndConvertValuesMorphIfNecessary: valuesMorph.
76-
lineMorph addMorphBack: valuesMorph.
77-
tracesMorph addMorphBack: lineMorph].
78-
tracesMorph submorphs ifNotEmpty: [
79-
widgetsMorph addMorphFront: tracesMorph].
25+
scrollPane scroller addMorph: valuesMorph.
26+
scrollPane height: valuesMorph height + self scrollBarSize].
8027

packages/Babylonian-UI.package/BPAssertionMorph.class/methodProperties.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
"class" : {
33
},
44
"instance" : {
5-
"annotation:" : "pre 11/18/2019 12:33",
5+
"annotation:" : "pre 10/8/2020 11:45",
66
"checkAndConvertValuesMorphIfNecessary:" : "pre 8/25/2020 08:42",
7-
"initialize" : "pre 9/22/2020 10:14",
7+
"initialize" : "pre 10/8/2020 11:44",
88
"isAssertion" : "pre 11/18/2019 11:50",
99
"isProbe" : "pre 11/18/2019 12:31",
1010
"relevantTracesOf:do:" : "pre 11/18/2019 12:54",
11-
"updateFrom:" : "pre 9/22/2020 10:14" } }
11+
"updateAssertionFieldsMorph" : "pre 10/8/2020 11:45",
12+
"updateFrom:" : "pre 10/8/2020 11:41" } }

packages/Babylonian-UI.package/BPAssertionMorph.class/properties.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
],
77
"commentStamp" : "",
88
"instvars" : [
9-
],
9+
"assertionFieldsMorph" ],
1010
"name" : "BPAssertionMorph",
1111
"pools" : [
1212
],

0 commit comments

Comments
 (0)