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

Fix BPExamplesMorph Resizing #158

Merged
merged 11 commits into from
Oct 2, 2023
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
drawing
drawOn: aCanvas
<exampleNamed: 'normal example' setUp: '' tearDown: '' self: 'BPMountain new
extent: 400@400;
yourself' with: '(Form extent: 20@20 depth: 32) getCanvas'>
extent: 400@400;
yourself' with: '(Form extent: 20@20 depth: 32) getCanvas'>
<exampleNamed: 'small example' self: 'BPMountain new
extent: 20@20;
yourself' with: '(Form extent: 20@20 depth: 32) getCanvas'>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"instance" : {
"color" : "pre 2/5/2021 09:08",
"color:" : "pre 2/5/2021 09:08",
"drawOn:" : "pre 7/15/2022 14:50",
"drawOn:" : "joabe 8/9/2023 17:24",
"initialize" : "pre 2/5/2021 09:57",
"ratio" : "pre 2/5/2021 09:57",
"ratio:" : "pre 2/5/2021 09:57" } }
2 changes: 1 addition & 1 deletion packages/Babylonian-ExampleMining.package/.squot-contents
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ SquotTrackedObjectMetadata {
#id : UUID [ '31a714b5b534fd4988afa4e5447e0082' ],
#objectsReplacedByNames : true,
#serializer : #SquotCypressCodeSerializer
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ addArgumentScriptMorphs
| editField container |
self example argumentNames withIndexDo: [:argumentName :index |
container := self newLabelContainerMorph: (argumentName , ': ').
container cellInset: self defaultCellInset;
layoutInset: self defaultLayoutInset.

editField := self
editFieldStyledInitialContent: (self example argumentScriptStringAt: index)
Expand All @@ -13,9 +15,7 @@ addArgumentScriptMorphs
onAccept: [:str |
self acceptChangesAtSource.
false "Do not continue handling this morphs edit"].
editField
balloonText: 'write code that instantiates the argument';
width: 240.
editField balloonText: 'write code that instantiates the argument'.
container addMorphBack: editField.

"Live specimen editing"
Expand All @@ -28,5 +28,6 @@ addArgumentScriptMorphs
self example argumentScripts at: index put: specimen.
self codeContentChanged.
editField setText: (self example argumentScriptStringAt: index)]]).


exampleSpecificMorphs addMorphBack: container].
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ addReceiverConstructorMorph

| container editField |
container := self newLabelContainerMorph: 'self: '.
container cellInset: self defaultCellInset;
layoutInset: self defaultLayoutInset.

editField := (self
editFieldStyledInitialContent: self example receiverConstructorString
Expand All @@ -14,8 +16,7 @@ addReceiverConstructorMorph
editField
balloonText: 'Write code that instantiates the receiver.
You can also provide a selector that will be called on the
class-side of this class to create a receiver object.';
width: 240.
class-side of this class to create a receiver object.'.
container addMorphBack: editField.

"Live specimen editing"
Expand All @@ -28,5 +29,5 @@ class-side of this class to create a receiver object.';
self example receiverConstructor: specimen.
self codeContentChanged.
editField setText: self example receiverConstructorString]]).

exampleSpecificMorphs addMorphBack: container.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"class" : {
},
"instance" : {
"addArgumentScriptMorphs" : "joabe 7/6/2023 22:59",
"addReceiverConstructorMorph" : "joabe 7/6/2023 22:51",
"addArgumentScriptMorphs" : "joabe 8/9/2023 16:45",
"addReceiverConstructorMorph" : "joabe 8/9/2023 16:45",
"newSpecimenEditingButtonFor:" : "ek 7/24/2023 18:34" } }
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,5 @@ editFieldFor: model text: getTextSelector onChange: setTextSelector onAccept: ac
wrapFlag: true;
wantsFrameAdornments: false;
cellPositioning: #topLeft;
layoutInset: 0;
width: ((TextStyle defaultFont widthOfString: (model perform: getTextSelector)) + (self fontWidth)
max: (20 * self fontWidth)).
layoutInset: 0.
^ pluggableTextMorph
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ editFieldStyledInitialContent: aText onChange: changeBlock onAccept: acceptBlock
onAccept: acceptBlock.

field
hResizing: #spaceFill;
styler: (SHTextStylerST80 new view: field);
updateStyleNow.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ initialize
listDirection: #leftToRight;
vResizing: #shrinkWrap;
cellInset: 1;
layoutInset: 1.
layoutInset: 5@1.

BPStyler
withSidebarAnnotations: [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ui
rightSidePadding

^ 40
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
"codeContentChanged" : "pre 1/21/2021 16:45",
"containingBrowser" : "pre 1/6/2021 19:45",
"createErrorIndicatorFor:" : "pre 2/22/2021 12:15",
"editFieldFor:text:onChange:onAccept:" : "pre 6/7/2021 16:27",
"editFieldFor:text:onChange:onAccept:" : "joabe 8/22/2023 17:40",
"editFieldInitialContent:onChange:onAccept:" : "pre 7/20/2022 17:19",
"editFieldStyledInitialContent:onChange:onAccept:" : "pre 7/20/2022 17:17",
"editFieldStyledInitialContent:onChange:onAccept:" : "joabe 8/22/2023 17:45",
"emptyTraces" : "pre 5/3/2021 16:56",
"ensureErrorIndicatorFor:" : "jb 12/7/2020 18:57",
"ensureNoErrorIndicator" : "jb 12/7/2020 18:57",
Expand All @@ -31,7 +31,7 @@
"iconSize" : "pre 7/24/2019 13:18",
"id" : "pre 7/2/2019 16:38",
"id:" : "pre 7/2/2019 16:38",
"initialize" : "joabe 5/31/2023 14:28",
"initialize" : "joabe 8/9/2023 16:59",
"isAssertion" : "pre 7/3/2019 11:11",
"isBPAnnotationMorph" : "pre 7/3/2019 11:10",
"isExample" : "pre 7/23/2019 12:47",
Expand All @@ -51,6 +51,7 @@
"openInBrowser" : "jb 2/22/2022 20:45",
"refreshTextComposition" : "pre 1/11/2021 11:31",
"removeButtonClicked" : "jb 12/7/2020 18:57",
"rightSidePadding" : "joabe 8/22/2023 16:36",
"scrollBarSize" : "pre 7/23/2019 11:18",
"smallFontHeight" : "pre 10/6/2020 16:54",
"startTag" : "pre 7/25/2019 15:42",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ addExampleSpecificMorphs

exampleSpecificMorphs := self newContainerMorph.
exampleSpecificMorphs
hResizing: #shrinkWrap;
hResizing: #spaceFill;
listDirection: #topToBottom;
cellPositioning: #topLeft;
cellGap: ((self fontHeight * 0.2) rounded max: 2).
cellGap: ((self fontHeight * 0.2) rounded max: 2).
self addMorphBack: exampleSpecificMorphs.
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ initialize
BPStyler withSidebarAnnotations: [
self
wrapDirection: #leftToRight;
hResizing: #shrinkWrap;
hResizing: #spaceFill;
vResizing: #shrinkWrap].

self
cellPositioning: #leftCenter;
cellInset: 0;
cellGap: ((0.7 * self fontWidth) rounded max: 2)
cellGap: ((0.7 * self fontWidth) rounded max: 2);
layoutInset: 20@2;
hResizing: #spaceFill.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ private - ui
newLabelContainerMorph: aLabelString

| container label |
container := self newContainerMorph cellPositioning: #topLeft; yourself.
container := self newContainerMorph
cellPositioning: #topLeft;
hResizing: #spaceFill;
yourself.
label := aLabelString asMorph
color: self class textColor;
borderWidth: 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"addCollapseButtonMorph" : "pre 7/19/2022 15:28",
"addDeleteButtonMorph" : "pre 2/22/2021 12:06",
"addExampleNameMorph" : "pre 2/22/2021 12:06",
"addExampleSpecificMorphs" : "jb 12/5/2021 02:01",
"addExampleSpecificMorphs" : "joabe 8/9/2023 16:50",
"addLoaderIconHolder" : "jb 12/7/2020 18:58",
"addMenuButtonMorph" : "lu 1/25/2022 00:15",
"applyUserInterfaceTheme" : "joabe 7/4/2023 11:57",
Expand All @@ -28,19 +28,19 @@
"example:" : "jb 12/7/2020 18:58",
"expand" : "pre 7/19/2022 15:29",
"expandInExamplesMorph" : "pre 7/19/2022 15:41",
"initialize" : "pre 5/3/2021 12:00",
"initialize" : "joabe 8/9/2023 17:00",
"isCollapsed" : "pre 1/12/2021 10:20",
"isExample" : "pre 9/30/2020 10:34",
"isExampleActive" : "pre 9/30/2020 10:34",
"menuContentsSymbolQuints" : "joabe 5/9/2023 17:34",
"newLabelContainerMorph:" : "joabe 7/4/2023 12:10",
"newLabelContainerMorph:" : "joabe 8/22/2023 17:47",
"newMenuButton" : "lu 2/15/2022 09:47",
"offerMenuContent" : "lu 1/24/2022 23:40",
"openExampleInDockedProbeLog" : "joabe 5/9/2023 17:33",
"openExampleInProbeLog" : "joabe 5/9/2023 17:37",
"openInProbeLogClicked" : "joabe 5/9/2023 17:34",
"removeButtonClicked" : "jb 1/10/2022 19:46",
"step" : "joabe 9/28/2022 22:58",
"step" : "joabe 8/9/2023 13:56",
"textEmphasis" : "pre 9/30/2020 10:35",
"timeoutButtonClicked" : "joabe 9/27/2022 22:35",
"updateAssertResultIcon" : "jb 12/30/2021 22:33",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
stepping
stepping and presenter
step

BPStyler withoutSidebarAnnotations: [
self width: self owner width - 40]
self width: self owner width - self rightSidePadding]
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"initialize" : "joabe 5/31/2023 18:31",
"isExamples" : "pre 11/25/2020 16:52",
"rememberThat:hasACollapsedStateOf:" : "pre 7/19/2022 15:23",
"step" : "pre 1/21/2021 18:20",
"step" : "joabe 8/22/2023 16:42",
"stepTime" : "pre 1/21/2021 18:01",
"textEmphasis" : "pre 7/20/2022 16:41",
"update:" : "pre 5/6/2021 16:49",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
private - ui
defaultCellInset

^ 3@0
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
private - ui
defaultLayoutInset

^ 20@0
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@
"addArgumentScriptMorphs" : "joabe 7/4/2023 11:23",
"addExampleSpecificMorphs" : "pre 1/8/2021 13:48",
"addReceiverConstructorMorph" : "joabe 7/4/2023 11:24",
"defaultCellInset" : "joabe 8/9/2023 16:46",
"defaultLayoutInset" : "joabe 8/9/2023 16:46",
"newSpecimenSelectionButtonOnClick:" : "jb 12/5/2021 01:50",
"selectLiveSpecimen:then:" : "pre 1/10/2023 16:19" } }
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ addScriptMorph

| editField container |
container := self newLabelContainerMorph: 'script: '.

editField := (self
editFieldStyledInitialContent: self example script
onChange: [:str |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
},
"instance" : {
"addExampleSpecificMorphs" : "pre 1/8/2021 13:48",
"addScriptMorph" : "joabe 7/4/2023 12:11" } }
"addScriptMorph" : "joabe 8/9/2023 14:18" } }
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ step

| newTraces tracesChanged |
self methodReference ifNil: [^ false].

self resetHeight.

newTraces := self getTraces asIdentitySet.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"newWidgetsMorph" : "pre 11/23/2020 13:43",
"removeLinesWithoutCurrentTrace:" : "jb 12/7/2020 19:00",
"resetHeight" : "pre 1/11/2021 13:59",
"step" : "pre 1/11/2021 13:59",
"step" : "joabe 8/9/2023 13:55",
"stepTime" : "pre 8/20/2020 17:35",
"update:" : "jb 12/7/2020 19:00",
"updateFrom:" : "jb 12/7/2020 19:00" } }
Loading